Search

US-12620131-B2 - Optical center determination method and apparatus, electronic device, and medium

US12620131B2US 12620131 B2US12620131 B2US 12620131B2US-12620131-B2

Abstract

Provided are an optical center determination method and apparatus, an electronic device, and a medium. The optical center determination method includes: obtaining at least one reference line by connecting edge points with the largest distance therebetween in a target image; determining, on the at least one reference line, at least two reference points with grayscale values in a preset ratio to a grayscale peak value, and determining the position information of an optical center is according to the at least two reference points and auxiliary points with grayscale values consistent with the grayscale value of a reference point.

Inventors

  • Guozhen Wang

Assignees

  • ZHEJIANG UNIVIEW TECHNOLOGIES CO., LTD.

Dates

Publication Date
20260505
Application Date
20211223
Priority Date
20210730

Claims (15)

  1. 1 . An optical center determination method, comprising: obtaining at least one reference line by connecting edge points with a largest distance therebetween in a target image; determining at least two reference points on the at least one reference line, wherein grayscale values of the at least two reference points are in a preset ratio to a grayscale peak value, wherein the grayscale peak value is a maximum value among grayscale values of pixel points on the at least one reference line; and determining position information of an optical center according to the at least two reference points and auxiliary points with grayscale values consistent with a grayscale value of a reference point among the at least two reference points; wherein determining the position information of the optical center according to the at least two reference points and the auxiliary points with grayscale values consistent with the grayscale value of the reference point, comprises: determining, in a same horizontal direction as the reference point and in a same vertical direction as the reference point, points with grayscale values consistent with the grayscale value of the reference point as the auxiliary points: determining midpoints of connection lines between the auxiliary points and a respective reference point among the at least two reference points; and determining the position information of the optical center according to the midpoints; or in a case where an optical spot where the optical center is located is circular, determining the position information of the optical center according to perpendicular bisectors of connection lines between the at least two reference points and respective auxiliary points.
  2. 2 . The method according to claim 1 , wherein determining the at least two reference points on the at least one reference line, wherein grayscale values of the at least two reference points are in the preset ratio to the grayscale peak value, comprises: determining a target grayscale value according to a product of the grayscale peak value and the preset ratio; and determining on the at least one reference line, at least two points with grayscale values consistent with the target grayscale value as the at least two reference points.
  3. 3 . The method according to claim 1 , wherein a determination process of the preset ratio comprises: determining a first difference value between the grayscale peak value and a grayscale value of a target endpoint on a reference line among the at least one reference line, wherein the target endpoint is an endpoint with a larger grayscale value among two endpoints of the reference line; determining a product value of the first difference value and a preset coefficient and, determining a second difference value between the grayscale peak value and the product value, wherein the preset coefficient is in a range of (0, 1); and determining a ratio of the second difference value to the grayscale peak value as the preset ratio.
  4. 4 . The method according to claim 1 , wherein determining the position information of the optical center according to the midpoints comprises: obtaining at least two auxiliary lines by connecting midpoints respectively belonging to disjoint connection lines among the connection lines; and determining the position information of the optical center according to an intersection point of the at least two auxiliary lines.
  5. 5 . The method according to claim 4 , wherein the at least two auxiliary lines comprise at least four auxiliary lines; and determining the position information of the optical center according to the intersection point of the at least two auxiliary lines comprises: in a case where the at least four auxiliary lines have at least two intersection points, determining the position information of the optical center according to an average value of the at least two intersection points.
  6. 6 . An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when executing the computer program, the processor is configured to perform an optical center determination method comprising: obtaining at least one reference line by connecting edge points with a largest distance therebetween in a target image; determining at least two reference points on the at least one reference line, wherein grayscale values of the at least two reference points are in a preset ratio to a grayscale peak value, wherein the grayscale peak value is a maximum value among grayscale values of pixel points on the at least one reference line; and determining position information of an optical center according to the at least two reference points and auxiliary points with grayscale values consistent with a grayscale value of a reference point among the at least two reference points; wherein determining the position information of the optical center according to the at least two reference points and the auxiliary points with grayscale values consistent with the grayscale value of the reference point, comprises: determining, in a same horizontal direction as the reference point and in a same vertical direction as the reference point, points with grayscale values consistent with the grayscale value of the reference point as the auxiliary points; determining midpoints of connection lines between the auxiliary points and a respective reference point among the at least two reference points; and determining the position information of the optical center according to the midpoints; or in a case where an optical spot where the optical center is located is circular, determining the position information of the optical center according to perpendicular bisectors of connection lines between the at least two reference points and respective auxiliary points.
  7. 7 . The electronic device according to claim 6 , wherein determining the at least two reference points on the at least one reference line, wherein grayscale values of the at least two reference points are in the preset ratio to the grayscale peak value, comprises: determining a target grayscale value according to a product of the grayscale peak value and the preset ratio; and determining on the at least one reference line, at least two points with grayscale values consistent with the target grayscale value as the at least two reference points.
  8. 8 . The electronic device according to claim 6 , wherein a determination process of the preset ratio comprises: determining a first difference value between the grayscale peak value and a grayscale value of a target endpoint on a reference line among the at least one reference line, wherein the target endpoint is an endpoint with a larger grayscale value among two endpoints of the reference line; determining a product value of the first difference value and a preset coefficient and, determining a second difference value between the grayscale peak value and the product value, wherein the preset coefficient is in a range of (0, 1); and determining a ratio of the second difference value to the grayscale peak value as the preset ratio.
  9. 9 . The electronic device according to claim 6 , wherein determining the position information of the optical center according to the midpoints comprises: obtaining at least two auxiliary lines by connecting midpoints respectively belonging to disjoint connection lines among the connection lines; and determining the position information of the optical center according to an intersection point of the at least two auxiliary lines.
  10. 10 . The electronic device according to claim 9 , wherein the at least two auxiliary lines comprise at least four auxiliary lines; and determining the position information of the optical center according to the intersection point of the at least two auxiliary lines comprises: in a case where the at least four auxiliary lines have at least two intersection points, determining the position information of the optical center according to an average value of the at least two intersection points.
  11. 11 . A non-transitory computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is configured to perform an optical center determination method comprising: obtaining at least one reference line by connecting edge points with a largest distance therebetween in a target image; determining at least two reference points on the at least one reference line, wherein grayscale values of the at least two reference points are in a preset ratio to a grayscale peak value, wherein the grayscale peak value is a maximum value among grayscale values of pixel points on the at least one reference line; and determining position information of an optical center according to the at least two reference points and auxiliary points with grayscale values consistent with a grayscale value of a reference point among the at least two reference points; wherein determining the position information of the optical center according to the at least two reference points and the auxiliary points with grayscale values consistent with the grayscale value of the reference point, comprises: determining, in a same horizontal direction as the reference point and in a same vertical direction as the reference point, points with grayscale values consistent with the grayscale value of the reference point as the auxiliary points; determining midpoints of connection lines between the auxiliary points and a respective reference point among the at least two reference points; and determining the position information of the optical center according to the midpoints; or in a case where an optical spot where the optical center is located is circular, determining the position information of the optical center according to perpendicular bisectors of connection lines between the at least two reference points and respective auxiliary points.
  12. 12 . The non-transitory computer-readable storage medium according to claim 11 , wherein determining the at least two reference points on the at least one reference line, wherein grayscale values of the at least two reference points are in the preset ratio to the grayscale peak value, comprises: determining a target grayscale value according to a product of the grayscale peak value and the preset ratio; and determining on the at least one reference line, at least two points with grayscale values consistent with the target grayscale value as the at least two reference points.
  13. 13 . The non-transitory computer-readable storage medium according to claim 11 , wherein a determination process of the preset ratio comprises: determining a first difference value between the grayscale peak value and a grayscale value of a target endpoint on a reference line among the at least one reference line, wherein the target endpoint is an endpoint with a larger grayscale value among two endpoints of the reference line; determining a product value of the first difference value and a preset coefficient and, determining a second difference value between the grayscale peak value and the product value, wherein the preset coefficient is in a range of (0, 1); and determining a ratio of the second difference value to the grayscale peak value as the preset ratio.
  14. 14 . The non-transitory computer-readable storage medium according to claim 11 , wherein determining the position information of the optical center according to the midpoints comprises: obtaining at least two auxiliary lines by connecting midpoints respectively belonging to disjoint connection lines among the connection lines; and determining the position information of the optical center according to an intersection point of the at least two auxiliary lines.
  15. 15 . The non-transitory computer-readable storage medium according to claim 14 , wherein the at least two auxiliary lines comprise at least four auxiliary lines; and determining the position information of the optical center according to the intersection point of the at least two auxiliary lines comprises: in a case where the at least four auxiliary lines have at least two intersection points, determining the position information of the optical center according to an average value of the at least two intersection points.

Description

CROSS REFERENCE TO RELATED APPLICATIONS This is a National Stage Application, filed under 35 U.S.C. § 371 of International Patent Application No. PCT/CN2021/140671, filed Dec. 23, 2021, which claims priority to Chinese Patent application Ser. No. 202110875409.8, filed Jul. 30, 2021, the disclosures of which are incorporated herein by reference in their entireties. TECHNICAL FIELD The present application relates to the field of computer vision technology, for example, an optical center determination method and apparatus, an electronic device, and a medium. BACKGROUND When a camera shoots an image, the intersection point between the optical axis of a camera lens and the photosensitive plane of a sensor is the optical center of the camera lens. In the conventional use of the camera, the optical center of the lens is located in the center of the image. A large deviation in the position of the optical center of the camera lens may directly affect the image shooting quality of the camera. Therefore, the accurate solving of the position of the optical center of the camera is the premise of adjusting the optical center to be located in the center of the image. In the related art, a camera is used for shooting a uniform white light plate to obtain a light intensity distribution diagram first. Then the light intensity distribution diagram is converted into a grayscale image. Binarization processing is performed for grayscale values on the grayscale image (data greater than a certain percentage and data less than the percentage are assigned to 1 and 0 respectively). Then coordinates of the optical center are obtained through centroid calculation. However, in this solution, grayscale values of pixel points of the entire image need to be calculated, resulting in large data processing. With the increase of pixel points of the image in an actual scene, this solution may increase the burden of data processing. SUMMARY The present application provides an optical center determination method and apparatus, an electronic device, and a medium. An optical center determination method is provided. The method includes the steps below. At least one reference line is obtained by connecting edge points with a largest distance therebetween in a target image. At least two reference points on the at least one reference line are determined. Grayscale values of the at least two reference points are in a preset ratio to a grayscale peak value. The grayscale peak value is a maximum value among grayscale values of pixel points on the at least one reference line. Position information of an optical center is determined according to the at least two reference points and auxiliary points with grayscale values consistent with a grayscale value of a reference point among the at least two reference points. An optical center determination apparatus is also provided. The apparatus includes a reference line obtaining module, a reference point determination module, and an optical center position information determination module. The reference line obtaining module is configured to obtain at least one reference line by connecting edge points with a largest distance therebetween in a target image. The reference point determination module is configured to determine at least two reference points on the at least one reference line. Grayscale values of the at least two reference points are in a preset ratio to a grayscale peak value. The grayscale peak value is a maximum value among grayscale values of pixel points on the at least one reference line. The optical center position information determination module is configured to determine position information of an optical center according to the at least two reference points and auxiliary points with grayscale values consistent with a grayscale value of a reference point among the at least two reference points. An electronic device is also provided. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executing the computer program, the processor performs the optical center determination method according to embodiments of the present application. A computer-readable storage medium is also provided. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the optical center determination method according to embodiments of the present application is performed. BRIEF DESCRIPTION OF DRAWINGS FIG. 1 is a flowchart of an optical center determination method according to an embodiment of the present application. FIG. 2 is a diagram illustrating the determination of a reference line according to an embodiment of the present application. FIG. 3 is a diagram illustrating the determination of reference points according to an embodiment of the present application. FIG. 4 is a flowchart of an optical center determination method according to another embodiment of the present applicat