1. A method for detecting the horizontal and gravity directions of an image, characterized in that said method comprises: step S 1 : selecting equidistant sampling points in the image at an interval of the radius of the sampling circle of an attention focus detector; step S 2 : placing the center of the sampling circle of the attention focus detector on each of the sampling points respectively, and using the attention focus detector to acquire attention focus coordinates (x i , y i ) and the corresponding significant orientation angle γ i ranging from 0 degree to 180 degrees, wherein the subscript i is corresponding to the ith attention focus and i is a natural number, and all attention focus coordinates and the corresponding significant orientation angles constitute a set Ω p ; step S 3 : for each element (x i , y 1 , γ i ) in the set Ω p , using an orientation perceptron to determine a local orientation angle α i and a weight η i at the attention focus (x i , y i ) near the significant orientation angle γ i according to the gray image information, said local orientation angle α i ranging from 0 degree to 180 degrees, and generating a local orientation function Dir i (θ)=η i e −(θ−α i ) 2 /δ 2 using the local orientation angle and weight at the attention focus, wherein δ is a given constant and θ∈R=(−∞, −∞; step S 4 : obtaining a sum of each of the local orientation functions as an image direction function P I ( θ ) = ∑ i Dir i ( θ ) ; step S 5 : using a function O I (θ)=P I (θ)+P I (θ+π/2) , θ∈[0,π/2, and continuing O I (θ) into a periodic function ) l (θ+π)=O I (θ), θ∈R, then convolving said function with k e ( θ ) = { - ( θ a ) 4 + 1 θ ∈ [ - a , a ] 0 else as a kernel function to obtain a function M CGCS ( β ) = ∫ - ∞ + ∞ k e ( β - θ ) O I ( θ )  θ , wherein α is a given constant and β∈[0, π/2), and then obtaining the horizontal and gravity identification angles {argmaxM CGCS (β), argmaxM CGCS (β)+π/2}.