Method and device for obtaining homography and electronic equipment
By using the vanishing point of the image to determine the line segment and project the rectangular vertices to the layout diagram, the cumbersome problem of manually labeling points in the prior art is solved, and the accuracy and efficiency of homography calculation are improved.
Patent Information
- Application Number
- CN202311577812.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-23
AI Technical Summary
The method of obtaining homography in the prior art requires manual labeling of points in the image and finding corresponding points on the layout diagram, resulting in large workloads and prone to inaccurate labeling problems.
Calculate homography by determining the line segment based on the vanishing point of the image, setting the rectangle in the image, and projecting the vertices of the rectangle to the corresponding points in the layout diagram.
Improves the calculation accuracy of homography, reduces the workload, and avoids manual labeling errors.
Smart Images

Figure CN120031887A_ABST
Abstract
Claims
1. A device for obtaining homography, It is characterized in that The device comprises: A segmentation device, which segments the image taken by the camera; an extraction device, which determines the vanishing points in the image and obtains line segments corresponding to different vanishing points, retains the line segments distributed on the predetermined object according to the segmentation result of the image, and extracts the rectangle in the image according to the line segments distributed on the predetermined object; A projection device projects the vertices of the rectangle onto corresponding points in the layout diagram; and A computing device is used to compute homography based on the coordinates of the vertices of the rectangle and the coordinates of the corresponding points in the layout diagram.
2. The device according to claim 1, in, Projecting the vertices of the rectangle onto corresponding points in the layout diagram includes: Taking the extending direction of the side of the rectangle closest to the camera as the direction of the first axis; Determine, according to a point closest to the camera on an edge of the rectangle closest to the camera, a first shape of the rectangle when the rectangle is located on one side of the camera in a direction of a second axis perpendicular to the first axis, and a second shape of the rectangle when the rectangle is located on the other side of the camera; Determine a first rectangle in the layout diagram according to the first shape, and determine a second rectangle in the layout diagram according to the second shape; determining, according to a point closest to the camera on an edge of the rectangle closest to the camera, a third shape of the rectangle when the rectangle is located on one side of the camera in the direction of the first axis, and a fourth shape of the rectangle when the rectangle is located on the other side of the camera; Determining a third rectangle in the layout diagram according to the third shape, and determining a fourth rectangle in the layout diagram according to the fourth shape; and According to the positions of the first rectangle, the second rectangle, the third rectangle, and the fourth rectangle in the layout diagram, a rectangle in the layout diagram corresponding to the rectangle in the image is determined based on a predetermined rule.
3. The device according to claim 2, in, The predetermined rules include: In the layout diagram, the area of the region occupied by the rectangle corresponding to the predetermined object is the largest; and / or, The rectangle does not exceed the scope of the layout diagram.
4. The device according to claim 1, in, Calculating the homography according to the coordinates of the vertices of the rectangle and the coordinates of the corresponding points in the layout diagram includes: Using the pixel coordinate system of the vertices of the rectangle in the image as a first coordinate system, and using the pixel coordinates of each vertex as coordinates in the first coordinate system; Converting the world coordinate system of the corresponding point in the layout diagram into the pixel coordinate system of the layout diagram as a second coordinate system, and calculating the coordinates of each vertex in the second coordinate system; and The homography is obtained according to the coordinates of each vertex in the first coordinate system and the coordinates of each vertex in the second coordinate system.
5. The device according to claim 1, in, The device also includes: A display control device displays the image content in the rectangle in the image at a position corresponding to the rectangle in the layout diagram.
6. The device according to claim 5, in, When the direction of the image is inconsistent with the direction of the layout diagram, the image content in the rectangle in the image is rotated, and the rotated image content is displayed at a position corresponding to the rectangle in the layout diagram.
7. An electronic device, comprising the device for obtaining homography according to any one of claims 1 to 6.
8. A method for obtaining homography, It is characterized in that The method comprises: Segment the images captured by the camera; Determine the vanishing points in the image and obtain line segments corresponding to different vanishing points, retain the line segments distributed on the predetermined object according to the segmentation result of the image, and extract the rectangle in the image according to the line segments distributed on the predetermined object; Projecting the vertices of the rectangle onto corresponding points in the layout diagram; and A homography is calculated according to the coordinates of the vertices of the rectangle and the coordinates of the corresponding points in the layout diagram.
9. The method according to claim 8, in, Projecting the vertices of the rectangle onto corresponding points in the layout diagram includes: Taking the extending direction of the side of the rectangle closest to the camera as the direction of the first axis; Determine, according to a point closest to the camera on an edge of the rectangle closest to the camera, a first shape of the rectangle when the rectangle is located on one side of the camera in a direction of a second axis perpendicular to the first axis, and a second shape of the rectangle when the rectangle is located on the other side of the camera; Determine a first rectangle in the layout diagram according to the first shape, and determine a second rectangle in the layout diagram according to the second shape; determining, according to a point closest to the camera on an edge of the rectangle closest to the camera, a third shape of the rectangle when the rectangle is located on one side of the camera in the direction of the first axis, and a fourth shape of the rectangle when the rectangle is located on the other side of the camera; Determining a third rectangle in the layout diagram according to the third shape, and determining a fourth rectangle in the layout diagram according to the fourth shape; and According to the positions of the first rectangle, the second rectangle, the third rectangle, and the fourth rectangle in the layout diagram, a rectangle in the layout diagram corresponding to the rectangle in the image is determined based on a predetermined rule.
10. The method according to claim 9, in, The predetermined rules include: In the layout diagram, the area of the region occupied by the rectangle corresponding to the predetermined object is the largest; and / or, The rectangle does not exceed the scope of the layout diagram.