Patent ID: 11959744
Assignee: NORTH CHINA UNIVERSITY OF SCIENCE AND TECHNOLOGY
Field: Audio-visual technology (Electrical engineering)
Classification: CPC G  H  Y | IPC G

Claim 0:
1. A stereophotogrammetric method based on binocular vision, comprising the following steps:
S1: using binocular cameras to shoot an object, acquiring images shot by the left and right cameras, and correcting images by using intrinsic and extrinsic parameters of the cameras, so that the image are corrected to be taken on the same plane;
S2: performing down-sampling on the corrected images continuously to acquire images of different sizes;
S3: performing a stereo matching, and specifically performing cost matching and cost aggregation respectively on the images of different sizes obtained in the S2;
performing a cost matching, specifically fusing pixel cost, color cost and gradient cost to acquire matching cost of the images; and taking an average of an absolute value of a RBG difference of three color components of the images as the color cost, acquiring image gradient information by using the Sobel operator algorithm, and taking an average of an absolute value of an image gradient difference as the gradient cost;
performing a cost calculation, specifically, converting the binocular images into gray scale images, establishing a 9×7 matching window with pixel points to be matched on the gray scale image in the left map as a center, averaging two interval pixel points in the upper, lower, left and right directions of the central pixel point with the central pixel point respectively, selecting maximum and minimum values, then, comparing each pixel point in the window with the central pixel point, the maximum and minimum values respectively, and finally calculating and taking an average value of their cost as the image pixel cost; according to the difference of a RGB trichromatic channel, acquiring trichromatic channel color information of the binocular images, calculating a difference between RGB values of the left map and RGB values of the right map respectively, setting a color threshold to 7 (when the difference between the colors is greater than 7, it is still taken as 7), and taking an average absolute value of the difference as the color cost; acquiring the image gradient information for the left and right maps respectively using the Sobel operator algorithm, calculating the difference between gradient values of the left map and gradient values of the right map respectively, setting the gradient threshold to 2, taking the difference between the gradient differences greater than 2 as 2, and taking the average absolute value of the difference as the gradient cost; adding the color cost and gradient cost with a weight of 0.11:0.89 to acquire a joint cost, fusing the image pixel cost and the joint cost by a normalized combination method to acquire the matching cost; and fusion weight values of the image pixel cost and the joint cost are 15 and 35, respectively, a fusion formula is C(p, d)=2−exp(−Cns(p, d)/35)−exp (−CComm(p, d)/15), wherein Cns is the joint cost of the color cost and the gradient cost, and CComm is the pixel cost; and
performing a cost aggregation, specifically, adopting an aggregation strategy of minimum spanning tree and scanning line optimization for the cost obtained by cost matching for images of difference sizes, and calculating and obtaining an initial disparity map of images of each size; and acquiring an optimal aggregation cost of the original size image according to a multi-size aggregation model;
S4: performing disparity calculation and optimization on the acquired aggregation cost to acquire a disparity map;
S5: performing image segmentation on the corrected images to determine edge pixel points of the object to be measured; and
S6: according to a triangle measurement method, constructing a three-dimensional coordinate of the real world of the vertex by calculating a depth of the edge pixel points of the object to be measured and a distance between each vertex and the camera, so as to complete object dimension measurement, with the steps of distance calculation of each vertex from the camera as follows: point P is a point on the object to be measured, 01 and 0r are optical centers of the two cameras, respectively, X1 and Xr are imaging points of point P on photo-receptors of the two cameras respectively, X1 and Xr are the distances from the imaging points X1 and Xr to the left edges of respective planes, respectively, f is a focal length of the camera, B is a center distances of the two cameras, and Z is desired depth information; after correction, the two camera image places are accurately located on the same plane; and acquiring the distance, Z
  =
  
   
    f
    ·
    B
   
   
    
     x
     l
    
    -
    
     x
     r
    
   
  
 

 between the pixel point and the camera using a triangle relationship; according to the smallest quadrilateral vertex coordinates of the object to be measured acquired in S5, calculating the distance of each vertex from the camera, that is, acquiring the three-dimensional coordinate of each vertex in the real world, and calculating a real distance between the four vertexes using the Euclidean equation, so as to realize the measurement of the size of the object.