Light source positioning method, device, equipment and readable storage medium based on plane mirror
Through the light source positioning method based on the plane mirror, the plane mirror reflection principle and spatial circular target positioning technology are used to solve the problem that the light source outside the camera field of view cannot be accurately positioned in the prior art, achieving high accuracy and real-time light source positioning, and improving robustness.
Patent Information
- Application Number
- CN202310457009.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2043-04-25
AI Technical Summary
The prior art cannot accurately locate the light source position outside the camera field of view, and the complex calculation process leads to poor robustness.
The light source positioning method based on the plane mirror is adopted. By acquiring a fixed camera, a fixed light source and a movable plane mirror, the plane mirror reflection principle and spatial circular target positioning technology are used to adjust the plane mirror to present the light source virtual image of the light source on the plane mirror, and the detection image is obtained through the camera shooting of the plane mirror, the positioning image is obtained and the actual position of the light source is calculated.
It realizes accurate positioning of light sources not in the camera field of view, with accuracy and real-time performance, and can locate multiple light sources on a single frame image, reducing the complexity of data processing and improving the robustness of light source positioning.
Smart Images

Figure CN116580105B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer-aided design, and in particular to a method, device, equipment and readable storage medium for locating a light source based on a plane mirror. Background Art
[0002] Humans obtain 80% to 90% of information through vision, and the direction of a person's gaze also reflects a lot of information. The gaze tracking system is a system that estimates the current gaze direction or gaze point position of a person's eyes through the characteristics of human eye movement. Gaze tracking technology can be applied in fields such as psychology, medical research, and human-computer interaction. The principles of gaze tracking technology can be divided into two-dimensional gaze tracking methods and three-dimensional gaze tracking methods. Among them, the three-dimensional gaze tracking method based on head-mounted devices has higher accuracy and fewer calibration procedures, but requires accurate camera coordinate system coordinates of the light source, and the light source is not within the camera's field of view. Light source positioning is part of the system calibration of the gaze tracking system, and essentially belongs to the field of visual positioning.
[0003] Visual positioning methods can be divided into monocular visual positioning, binocular visual positioning and multi-camera visual positioning. Monocular visual positioning methods are widely used because of their low hardware cost and the lack of calibration between two cameras. Monocular visual positioning can be basically divided into two types: one is a positioning method based on a single-frame image, and the other is a positioning method based on multiple-frame images. Commonly used positioning methods based on single-frame images are divided into positioning based on point features, positioning based on line features, and positioning based on curve features. Monocular visual positioning based on point features is also called the PnP (Perspective-n-Point) problem. It requires more than three points by shooting n light sources known in the object coordinate system and solving the camera coordinate system positions of n light sources; positioning based on line features constructs multiple non-parallel lines, and solves multiple nonlinear equations based on the geometric relationship of the projection to perform positioning; positioning based on curve features generally requires solving complex nonlinear systems and calculating accurate curve equations. The positioning method based on multiple-frame images is that the camera shoots the light source during the movement process, and calculates the coordinates of the light source according to the coordinate changes of the camera coordinate system, without relying on artificial marks.
[0004] However, the existing visual positioning methods have the following defects: binocular visual positioning and multi-eye visual positioning have high hardware costs, require multiple cameras, and the accurate calibration of the rotation matrix and translation matrix of the coordinate system between cameras is difficult, and the positioning field of view is narrow and the accuracy is insufficient. Monocular visual positioning based on point features requires multiple points to be solved, and cannot solve a single point, and the calculation process is relatively complicated. Monocular visual positioning based on straight line features also has the disadvantages of complex calculations and poor robustness. The positioning method based on curve features has a fast positioning speed, but it cannot directly solve the problem of the light source not being in the field of view, and requires precise curve contour positioning, and has poor robustness. The positioning method based on multi-frame images has a slow positioning speed, requires complex spatial geometry calculations, requires multiple iterative operations, and is not real-time enough.
[0005] There is currently no effective solution to the technical problems that the existing technology cannot accurately locate the position of the light source outside the camera's field of view and the calculation process is complex, resulting in poor robustness. Summary of the invention
[0006] The purpose of the present invention is to provide a light source positioning method, device, equipment and readable storage medium based on a plane mirror, which can solve the technical problems that the prior art cannot accurately locate the position of the light source outside the camera's field of view and the calculation process is complex resulting in poor robustness.
[0007] One aspect of the present invention provides a method for locating a light source based on a plane mirror, the method comprising: obtaining a fixed camera, a fixed light source and a movable plane mirror, wherein the plane mirror is provided with no less than three non-collinear targets; determining the camera field of view of the camera, and adjusting the plane mirror according to the camera field of view so that a virtual image of the light source appears on the plane mirror, wherein the camera is located between the light source and the plane mirror, and the adjusted plane mirror is within the camera field of view; obtaining a detection image by photographing the plane mirror with the camera, and obtaining a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source in the detection image; and calculating the actual position information of the light source based on the position information of all positioning images obtained on the detection image.
[0008] Optionally, the actual position information of the light source is calculated based on the position information of all positioning images acquired on the detection image, including: calculating the position information of the target and the position information of the virtual image of the light source through the position information of all positioning images; determining the plane equation of the plane mirror based on the position information of the target; and calculating the actual position information of the light source based on the plane equation of the plane mirror and the position information of the virtual image of the light source.
[0009] Optionally, the position information of the target and the position information of the virtual image of the light source are calculated through the position information of all positioning images, including: obtaining the point coordinates of all positioning images in the image coordinate system and the point coordinates of the camera coordinate system; obtaining a target position calculation formula, wherein the target position calculation formula includes an initial ellipse general equation and an initial ellipse cone equation, the initial ellipse general equation and the initial ellipse cone equation both include multiple unknown coefficients, and there is a correlation between the coefficients of the initial ellipse general equation and the coefficients of the initial ellipse cone equation; substituting the point coordinates of the image coordinate system into the initial ellipse general equation to obtain the coefficients of the initial ellipse general equation; calculating the coefficients of the initial ellipse cone equation through the coefficients of the initial ellipse general equation and the point coordinates of the camera coordinate system, and substituting the coefficients of the initial ellipse cone equation into the initial ellipse cone equation to obtain the ellipse cone equation; converting the ellipse cone equation into a first matrix, and solving the target position information and the position information of the virtual image of the light source through the first matrix.
[0010] Optionally, determining the plane equation of the plane mirror according to the position information of the target includes: acquiring the position information of the target and an initial plane equation, wherein the initial plane equation includes multiple unknown coefficients; converting the initial plane equation into a second matrix; solving the coefficients of the initial plane equation through the second matrix, substituting the coefficients into the initial plane equation, and obtaining the plane equation of the plane mirror.
[0011] Optionally, calculating the actual position information of the light source according to the plane equation of the plane mirror and the position information of the virtual image of the light source includes: obtaining the plane equation of the plane mirror and the actual position of the virtual image of the light source; calculating the normal vector of the plane mirror by the plane equation of the plane mirror; substituting the normal vector of the plane equation of the plane mirror and the actual position of the virtual image of the light source into a preset light source position calculation formula to obtain the actual position information of the light source, wherein the preset light source position calculation formula is:
[0012] x0 ′ The actual position information of the light source, x0 is the position information of the virtual image of the light source, w is the normal vector of the plane mirror, and D is the coefficient of the plane equation of the plane mirror.
[0013] Optionally, before determining the camera field of view of the camera, the method further includes: calibrating the camera to determine the intrinsic parameter matrix and distortion parameters of the camera.
[0014] Optionally, it is characterized in that after obtaining the detection image by photographing the plane mirror through the camera, the method also includes: converting the image coordinate system of the detection image to the camera coordinate system through the intrinsic parameter matrix, and performing a dedistortion operation in the camera coordinate system; converting the camera coordinate system back to the image coordinate system, and interpolating the pixel points of the detection image after the dedistortion operation through the original pixel values of the detection image; performing preprocessing operations, morphological operations and binarization operations on the interpolated detection image, wherein the preprocessing operations include at least any one of the following: digitization, geometric transformation, normalization, smoothing, restoration and enhancement, and the morphological operations include at least any one of the following: erosion, expansion, opening operation, closing operation, morphological gradient, top hat operation, black hat operation.
[0015] Another aspect of the present invention provides a light source positioning device based on a plane mirror, the device comprising: an acquisition module, used to acquire a fixed camera, a fixed light source and a movable plane mirror, wherein the plane mirror is provided with no less than three non-collinear targets; an adjustment module, used to determine the camera field of view of the camera, and adjust the plane mirror according to the camera field of view so that the virtual image of the light source appears on the plane mirror, wherein the camera is located between the light source and the plane mirror, and the adjusted plane mirror is within the camera field of view; an identification module, used to obtain a detection image by photographing the plane mirror with a camera, and obtain a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source in the detection image; a calculation module, used to calculate the actual position information of the light source based on the position information of all positioning images acquired on the detection image.
[0016] Another aspect of the present invention provides a computer device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the plane mirror-based light source positioning method of any of the above-mentioned embodiments when executing the computer program.
[0017] Another aspect of the present invention provides a computer storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for locating a light source based on a plane mirror of any of the above embodiments is implemented. Further, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of a blockchain node, etc.
[0018] The present invention utilizes the principle of plane mirror reflection and spatial circular target positioning technology to realize the positioning of light sources that are not in the camera field of view, with accuracy and real-time performance. Multiple light sources can be positioned on a single frame image without determining the relative position information between the light sources, which reduces the complexity of data processing, reduces the influencing factors of light source positioning, and improves the robustness of light source positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0020] Figure 1 An optional flow chart of a method for locating a light source based on a plane mirror provided in Embodiment 1 of the present invention is shown;
[0021] Figure 2 An optional structural schematic diagram of a light source positioning method provided in the first embodiment of the present invention is shown;
[0022] Figure 3 An optional structural schematic diagram of circular target imaging provided by the first embodiment of the present invention is shown;
[0023] Figure 4 A structural block diagram of a light source positioning device based on a plane mirror provided in Embodiment 2 of the present invention is shown; and
[0024] Figure 5 A block diagram of a computer device suitable for implementing a light source positioning method based on a plane mirror provided in Embodiment 3 of the present invention is shown. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0026] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0027] Embodiment 1
[0028] This embodiment provides a light source positioning method based on a plane mirror. Figure 1 A flow chart of the method for locating a light source based on a plane mirror is shown, as Figure 1 As shown, the light source positioning method based on a plane mirror may include steps S101 to S104, wherein:
[0029] Step S101, obtaining a fixed camera, a fixed light source, and a movable plane mirror, wherein the plane mirror is provided with no less than three non-collinear targets;
[0030] In the actual visual positioning scenario, the camera and the light source are both fixed devices, and the plane mirror is a movable device. At the same time, no less than three non-collinear targets are set on the plane mirror, and the number of targets is set according to the actual scene requirements. For example, when the plane mirror is far away from the camera, a larger number of targets can be set; when the plane mirror is close to the camera, a smaller number of targets can be set. In particular, the plane mirror can be a front-coated plane mirror, and the target can be a retro-reflective circular target. The front-coated reflector reduces the error caused by the refraction of light due to the thickness of the plane mirror itself, and the image of the front-coated reflector is clearer. The retro-reflective circular target makes the positioning of the elliptical contour of its image more accurate, and improves the robustness of the spatial circular target positioning method.
[0031] It should be noted that, in addition to setting a circular target for retroreflection on the plane mirror, the present invention can also set a circular target for retroreflection on the light source at the same time, and poke a small hole in the center of the target to allow light to pass through the small hole in the center of the target, and use the principle of spatial circular target positioning to locate the position of the virtual image of the circular target on the plane mirror and the circular target of the light source in the plane mirror. Then, the plane equation of the plane mirror is solved, and the actual position of the light source is finally solved using the principle of mirror symmetry of the plane mirror.
[0032] Step S102, determining the camera field of view of the camera, and adjusting the plane mirror according to the camera field of view so that the virtual image of the light source of the light source appears on the plane mirror, wherein the camera is located between the light source and the plane mirror, and the adjusted plane mirror is within the camera field of view;
[0033] Specifically, the present invention aims to solve the positioning problem of the light source not being within the camera's field of view by using a plane mirror. Therefore, before calculating the position of the light source, the position of the plane mirror needs to be adjusted in order to accurately position the light source. First, the camera's field of view is determined, and the movement of the plane mirror is controlled by the background device so that all features of the adjusted plane mirror are within the camera's field of view. At the same time, the virtual image of the light source is also presented on the plane mirror. During the entire adjustment process, the camera is always located between the light source and the plane mirror, and the adjusted plane mirror is within the camera's field of view. Correspondingly, the light source is outside the camera's field of view.
[0034] Figure 2 A schematic diagram of the structure of light source positioning is shown. Figure 2As shown in the figure, the camera is located between the light source and the plane mirror, and the plane mirror is located in the direction of the camera's line of sight, that is, it is within the camera's field of view; the light source is located in the opposite direction of the camera's line of sight, that is, it is outside the camera's field of view. In particular, the imaging position of the image plane is determined by the position of the plane mirror, that is, the position is not fixed. Figure 2 The image plane position is only the imaging position of the plane mirror at this time; at the same time, the number of light sources is not unique and is determined by the actual application scenario. This embodiment can realize the positioning of multiple light sources on a single frame image without determining the relative position information between the light sources, thereby reducing the complexity of data processing and facilitating the rapid acquisition of the light source position. This figure is only for illustration of a specific scenario and does not limit the scope of protection of the present invention.
[0035] Preferably, before determining the camera field of view of the camera, the camera is calibrated to determine the intrinsic parameter matrix and distortion parameters of the camera.
[0036] The intrinsic parameters of a camera describe the inherent properties of the camera itself, which affect the quality of the captured image. They include parameters such as focal length and pixel pitch, and are usually represented by an intrinsic parameter matrix. These parameters determine the shape and size of the two-dimensional image that the camera obtains from the three-dimensional scene. The distortion parameter is the degree of distortion of the image formed by the optical system on the object relative to the object itself. It only causes the deformation of the image and has no effect on the clarity of the image.
[0037] Specifically, the camera calibration can be Zhang Zhengyou's calibration method or a conventional marking method, which is not specifically limited here. By calibrating the camera, a conversion relationship is established between the world coordinate system, the camera coordinate system and the image coordinate system, which facilitates the accurate positioning of the light source.
[0038] Step S103, photographing the plane mirror with the camera to obtain a detection image, and obtaining a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source in the detection image;
[0039] After the plane mirror is adjusted, the plane mirror is photographed by a camera to obtain a detection image. The detection image is an overall image consisting of all features that can be seen in the camera's field of view. Accordingly, it also includes a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source. The positioning image refers to the shape of objects on the plane mirror presented by the camera.
[0040] Step S104: calculating the actual position information of the light source according to the position information of all positioning images acquired on the detection image.
[0041] By extracting the position information of all positioning images on the detection image and performing integrated calculations, the actual position information of the light source is finally obtained.
[0042] Preferably, step S104 may include steps S1041 to S1043, wherein:
[0043] Step S1041, calculating the position information of the target and the position information of the virtual image of the light source through the position information of all the positioning images;
[0044] Each positioning image has a corresponding target or light source virtual image, so all positioning images are analyzed and calculated separately to obtain the position information of each target and the position information of the light source virtual image. The position information of each target and the position information of the light source virtual image can be obtained by Hough algorithm or by using the same type of recognition algorithm, which is not limited here.
[0045] Preferably, step S1041 may include steps A1 to A5, wherein:
[0046] Step A1, obtaining the point coordinates of all the positioning images in the image coordinate system and the camera coordinate system;
[0047] Among them, the corresponding features / positions of the point coordinates selected by the image coordinate system and the point coordinates selected by the camera coordinate system are consistent in the overall layout. The point coordinates of the image coordinate system and the point coordinates of the camera coordinate system can be selected arbitrarily, key points can be extracted, and other extraction methods can be used, which are not limited here.
[0048] Step A2, obtaining a calculation formula for the position of the target, wherein the calculation formula for the position of the target includes an initial ellipse general equation and an initial ellipse cone surface equation, the initial ellipse general equation and the initial ellipse cone surface equation both include a plurality of unknown coefficients, and the coefficients of the initial ellipse general equation and the coefficients of the initial ellipse cone surface equation are correlated;
[0049] Step A3, substituting the point coordinates of the image coordinate system into the general equation of the initial ellipse to obtain coefficients of the general equation of the initial ellipse;
[0050] Step A4, calculating the coefficients of the initial ellipse cone surface equation by using the coefficients of the initial ellipse general equation and the point coordinates of the camera coordinate system, and substituting the coefficients of the initial ellipse cone surface equation into the initial ellipse cone surface equation to obtain the ellipse cone surface equation;
[0051] Step A5: converting the elliptical cone surface equation into a first matrix, and solving the position information of the target and the position information of the virtual image of the light source through the first matrix.
[0052] In order to explain the technical solutions of the above steps A1 to A5 in detail, an example is cited for illustration, which does not limit the protection scope of the present invention.
[0053] Figure 3 A schematic diagram of the structure of a circular target imaging is shown in FIG. Figure 3 As shown, a circle is a common curve figure. The spatial circle curve is projected on the image plane by the camera as an ellipse. The center coordinates, rotation angle and radius of the spatial circle can correspond to an elliptical curve on the image plane.
[0054] On the imaging plane, the general equation of the initial ellipse obtained by projecting the circular target is:
[0055] a 2 +v 2 +uv+u+ev+=0, where (u, v) are the coordinates of the point in the image coordinate system, and a, b, c, d, e and f are the coefficients of any ellipse equation;
[0056] The initial elliptical cone equation is:
[0057] A 2 +y 2 +Cxy+Dxz+Eyz+Fz 2 =0, where (x, y, z) is the point coordinates in the world coordinate system, A = af0 2 , B=bf0 2 , C = cf0 2 , D=df0, E=ef0, F=0, A, B, C, D, E and F are the coefficients of any elliptical cone equation, and f0 is a constant.
[0058] The first matrix form is:
[0059]
[0060]
[0061] Among them, (λ1λ2λ3) represents the eigenvalue of matrix Q, and P is the eigenvector of Q. Matrix P can be written as:
[0062]
[0063] By coordinate system conversion, the three-dimensional coordinates of the target center are obtained as follows:
[0064]
[0065] Where R is the radius of the target. This algorithm will generate two solutions. When t is 1, a plus sign is added to the equation. When t is 2, a minus sign is added to the equation. Finally, the average of the two solutions can be taken as the final solution.
[0066] Step S1042, determining the plane equation of the plane mirror according to the position information of the target;
[0067] Since the targets are all located on the surface of the plane mirror, they can be used as positioning references for the plane mirror. The position information of the targets obtained through the above calculations can be used to calculate the plane equation of the plane mirror.
[0068] Preferably, step S1042 may include steps B1 to B3, wherein:
[0069] Step B1, obtaining the position information and the initial plane equation of the target, wherein the initial plane equation includes a plurality of unknown coefficients;
[0070] The position information of the target is the value solved in step A5, and the position information is the corresponding position of the target in the camera coordinate system.
[0071] Step B2, converting the initial plane equation into a second matrix;
[0072] Step B3, solving the coefficients of the initial plane equation through the second matrix, substituting the coefficients into the initial plane equation, and obtaining the plane equation of the plane mirror.
[0073] Continuing from the previous example, the technical solutions of step B1 to step B3 can be implemented as follows: first, define the initial plane equation as: Ax+By+Cz+D=0 (C≠0), let The equation can be changed to: z=0x+a1y+a2.
[0074] Written in the second matrix form: Ax = b, where:
[0075]
[0076]
[0077]
[0078] Therefore, we can solve the normal equations x=(A T A) -1 A T b, substitute the positions of three or more plane mirror circular targets (x i ,y i , z i ) and convert the coefficients to obtain the plane equation of the plane mirror.
[0079] Step S1043, calculating the actual position information of the light source according to the plane equation of the plane mirror and the position information of the virtual image of the light source.
[0080] Preferably, step S1043 may include steps C1 to C3, wherein:
[0081] Step C1, obtaining the plane equation of the plane mirror and the actual position of the virtual image of the light source;
[0082] Step C2, calculating the normal vector of the plane mirror by using the plane equation of the plane mirror;
[0083] Step C3, substituting the normal vector of the plane mirror plane equation and the actual position of the virtual image of the light source into a preset light source position calculation formula to obtain the actual position information of the light source, wherein the preset light source position calculation formula is:
[0084] x0 ′ The actual position information of the light source, x0 is the position information of the virtual image of the light source, w is the normal vector of the plane mirror, and D is the coefficient of the plane equation of the plane mirror.
[0085] Continuing from the previous example, the technical solution of step C1 to step C3 is implemented as follows: Obtain the plane equation of the plane mirror Ax+By+Cz+D=0 (C≠0) and the position of the virtual image of the light source x0 that have been solved above, and then, according to the reflection principle of the plane mirror, let the plane mirror plane normal vector w=[ABC] T , solve to get the actual position of the light source x0 ′ for:
[0086] Preferably, after obtaining the detection image by photographing the plane mirror with a camera, the method further includes steps D1 to D3:
[0087] Step D1, converting the image coordinate system of the detection image to the camera coordinate system through the intrinsic parameter matrix, and performing a dedistortion operation in the camera coordinate system;
[0088] Step D2, converting the camera coordinate system back to the image coordinate system, and interpolating the pixel points of the detection image after the dedistortion operation by the original pixel values of the detection image;
[0089] Step D3, performing preprocessing operations, morphological operations and binarization operations on the interpolated detection image, wherein the preprocessing operations include at least any one of the following: digitization, geometric transformation, normalization, smoothing, restoration and enhancement, and the morphological operations include at least any one of the following: erosion, expansion, opening operation, closing operation, morphological gradient, top hat operation, black hat operation.
[0090] Dedistortion, image preprocessing, morphological operations, and image binarization of the captured detection images can improve the visual quality of the images, ensure the accuracy of image feature recognition, and thus improve the accuracy of light source positioning. The above image processing operations can be randomly selected according to the actual application scenario and there is no restriction.
[0091] This embodiment uses the mirror reflection principle of a plane mirror and the spatial circular target positioning technology to realize the positioning of light sources that are not in the camera field of view, with accuracy and real-time performance. Multiple light sources can be positioned on a single frame image without determining the relative position information between the light sources, which reduces the complexity of data processing, reduces the influencing factors of light source positioning, and improves the robustness of light source positioning.
[0092] Embodiment 2
[0093] Embodiment 2 of the present invention further provides a light source positioning device based on a plane mirror, which corresponds to the light source positioning method based on a plane mirror provided in the above embodiment 1. The corresponding technical features and technical effects are not described in detail in this embodiment, and the relevant parts can refer to the above embodiment 1. Specifically, Figure 4 FIG. 4 shows a structural block diagram of the light source positioning device based on a plane mirror. Figure 4 As shown, the plane mirror-based light source positioning device 400 includes an acquisition module 401, an adjustment module 402, an identification module 403 and a calculation module 404, wherein:
[0094] An acquisition module 401 is used to acquire a fixed camera, a fixed light source, and a movable plane mirror, wherein the plane mirror is provided with no less than three non-collinear targets;
[0095] An adjustment module 402, connected to the acquisition module 401, is used to determine a camera field of view of the camera, and adjust the plane mirror according to the camera field of view so that a virtual image of the light source is presented on the plane mirror, wherein the camera is located between the light source and the plane mirror, and the adjusted plane mirror is within the camera field of view;
[0096] The recognition module 403 is connected to the adjustment module 402 and is used to obtain a detection image by photographing the plane mirror with a camera, and obtain a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source in the detection image;
[0097] The calculation module 404 is connected to the recognition module 403 and is used to calculate the actual position information of the light source according to the position information of all positioning images obtained on the detection image.
[0098] Optionally, the calculation module includes: a first calculation unit, used to calculate the position information of the target and the position information of the virtual image of the light source through the position information of all positioning images; a second calculation unit, used to determine the plane equation of the plane mirror according to the position information of the target; and a third calculation unit, used to calculate the actual position information of the light source according to the plane equation of the plane mirror and the position information of the virtual image of the light source.
[0099] Optionally, the first calculation unit is specifically used to: obtain the point coordinates of all positioning images in the image coordinate system and the point coordinates of the camera coordinate system; obtain the target position calculation formula, wherein the target position calculation formula includes an initial ellipse general equation and an initial ellipse cone equation, the initial ellipse general equation and the initial ellipse cone equation both include multiple unknown coefficients, and there is a correlation between the coefficients of the initial ellipse general equation and the coefficients of the initial ellipse cone equation; substitute the point coordinates of the image coordinate system into the initial ellipse general equation to obtain the coefficients of the initial ellipse general equation; calculate the coefficients of the initial ellipse cone equation by the coefficients of the initial ellipse general equation and the point coordinates of the camera coordinate system, and substitute the coefficients of the initial ellipse cone equation into the initial ellipse cone equation to obtain the ellipse cone equation; convert the ellipse cone equation into a first matrix, and solve the target position information and the position information of the virtual image of the light source by the first matrix.
[0100] Optionally, the second calculation unit is specifically used to: obtain the position information of the target and the initial plane equation, wherein the initial plane equation includes multiple unknown coefficients; convert the initial plane equation into a second matrix; solve the coefficients of the initial plane equation through the second matrix, substitute the coefficients into the initial plane equation, and obtain the plane equation of the plane mirror.
[0101] Optionally, the third calculation unit is specifically used to: obtain the plane equation of the plane mirror and the actual position of the virtual image of the light source; calculate the normal vector of the plane mirror through the plane equation of the plane mirror; substitute the normal vector of the plane equation of the plane mirror and the actual position of the virtual image of the light source into a preset light source position calculation formula to obtain the actual position information of the light source, wherein the preset light source position calculation formula is:
[0102] x0 ′ The actual position information of the light source, x0 is the position information of the virtual image of the light source, w is the normal vector of the plane mirror, and D is the coefficient of the plane equation of the plane mirror.
[0103] Optionally, the device further comprises a calibration module, which is used to calibrate the camera and determine the intrinsic parameter matrix and distortion parameters of the camera.
[0104] Optionally, the device also includes an image processing module, which is used to: convert the image coordinate system of the detection image to the camera coordinate system through the intrinsic parameter matrix, and perform a dedistortion operation in the camera coordinate system; convert the camera coordinate system back to the image coordinate system, and interpolate the pixel points of the detection image after the dedistortion operation through the original pixel values of the detection image; perform preprocessing operations, morphological operations and binarization operations on the interpolated detection image, wherein the preprocessing operations include at least any one of the following: digitization, geometric transformation, normalization, smoothing, restoration and enhancement, and the morphological operations include at least any one of the following: erosion, expansion, opening operation, closing operation, morphological gradient, top hat operation, black hat operation.
[0105] Embodiment 3
[0106] Figure 5 The block diagram of a computer device suitable for implementing the light source positioning method based on a plane mirror provided in the third embodiment of the present invention is shown. In this embodiment, the computer device 500 can be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. Figure 5 As shown, the computer device 500 of this embodiment includes at least but is not limited to: a memory 501, a processor 502, and a network interface 503 that can be interconnected through a system bus. It should be noted that Figure 5 Only computer device 500 is shown with components 501 - 503 , but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0107] In this embodiment, the memory 503 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 501 can be an internal storage unit of the computer device 500, such as a hard disk or memory of the computer device 500. In other embodiments, the memory 501 can also be an external storage device of the computer device 500, such as a plug-in hard disk equipped on the computer device 500, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 501 can also include both the internal storage unit of the computer device 500 and its external storage device. In this embodiment, the memory 501 is generally used to store an operating system and various application software installed in the computer device 500, such as program codes of a light source positioning method based on a plane mirror.
[0108] In some embodiments, the processor 502 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 502 is generally used to control the overall operation of the computer device 500. For example, the processor 502 performs control and processing related to data interaction or communication with the computer device 500. In this embodiment, the processor 502 is used to run the program code of the steps of the method for locating a light source based on a plane mirror stored in the memory 501.
[0109] In this embodiment, the plane mirror-based light source positioning method stored in the memory 501 may also be divided into one or more program modules and executed by one or more processors (processor 502 in this embodiment) to complete the present invention.
[0110] The network interface 503 may include a wireless network interface or a wired network interface, and the network interface 503 is generally used to establish a communication link between the computer device 500 and other computer devices. For example, the network interface 503 is used to connect the computer device 500 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 500 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0111] Embodiment 4
[0112] This embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., on which a computer program is stored, and when the computer program is executed by a processor, the steps of the light source positioning method based on a plane mirror are implemented.
[0113] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0114] It should be noted that the serial numbers of the embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0115] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0116] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for positioning a light source based on a plane mirror, characterized in that: The method comprises: Obtain a fixed camera, a fixed light source, and a movable plane mirror, wherein the plane mirror is provided with no less than three non-collinear targets; Determining a camera field of view of the camera, and adjusting the plane mirror according to the camera field of view so that a virtual image of the light source of the light source appears on the plane mirror, wherein the camera is located between the light source and the plane mirror, and the adjusted plane mirror is within the camera field of view; Photographing the plane mirror with the camera to obtain a detection image, and acquiring a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source in the detection image; The actual position information of the light source is calculated according to the position information of all positioning images obtained on the detection image, including: obtaining the point coordinates of all positioning images in the image coordinate system and the point coordinates of the camera coordinate system; obtaining the position calculation formula of the target, wherein the position calculation formula of the target includes an initial ellipse general equation and an initial ellipse cone equation, the initial ellipse general equation and the initial ellipse cone equation both include multiple unknown coefficients, and the coefficients of the initial ellipse general equation and the coefficients of the initial ellipse cone equation are associated with each other; substituting the point coordinates of the image coordinate system into the initial ellipse general equation to obtain the coefficients of the initial ellipse general equation; calculating the coefficients of the initial ellipse cone equation by the coefficients of the initial ellipse general equation and the point coordinates of the camera coordinate system, and substituting the coefficients of the initial ellipse cone equation into the initial ellipse cone equation to obtain the ellipse cone equation; converting the ellipse cone equation into a first matrix, and solving the position information of the target and the position information of the virtual image of the light source by the first matrix.
2. The method according to claim 1, characterized in that The calculating the actual position information of the light source according to the position information of all positioning images acquired on the detection image comprises: Calculate the position information of the target and the position information of the virtual image of the light source through the position information of all the positioning images; Determine the plane equation of the plane mirror according to the position information of the target; The actual position information of the light source is calculated according to the plane equation of the plane mirror and the position information of the virtual image of the light source.
3. The method according to claim 1, characterized in that Determining the plane equation of the plane mirror according to the position information of the target includes: Acquiring the position information and the initial plane equation of the target, wherein the initial plane equation includes a plurality of unknown coefficients; Converting the initial plane equation into a second matrix; The coefficients of the initial plane equation are solved by the second matrix, and the coefficients are substituted into the initial plane equation to obtain the plane equation of the plane mirror.
4. The method according to claim 3, characterized in that The calculating the actual position information of the light source according to the plane equation of the plane mirror and the position information of the virtual image of the light source comprises: Obtaining the plane equation of the plane mirror and the actual position of the virtual image of the light source; Calculating the normal vector of the plane mirror by using the plane equation of the plane mirror; Substitute the normal vector of the plane mirror plane equation and the actual position of the virtual image of the light source into the preset light source position calculation formula to obtain the actual position information of the light source, wherein the preset light source position calculation formula is: , The actual position information of the light source, is the position information of the virtual image of the light source, is the normal vector of the plane mirror, are the coefficients of the plane equation of the plane mirror.
5. The method according to claim 1, characterized in that Before determining the camera field of view of the camera, the method further includes: calibrating the camera to determine the intrinsic parameter matrix and distortion parameters of the camera.
6. The method according to claim 5, characterized in that After obtaining a detection image by photographing the plane mirror with the camera, the method further includes: The image coordinate system of the detection image is converted to the camera coordinate system through the intrinsic parameter matrix, and a dedistortion operation is performed in the camera coordinate system; The camera coordinate system is converted back to the image coordinate system, and the pixel points of the detection image after the dedistortion operation are interpolated by the original pixel values of the detection image; The interpolated detection image is subjected to preprocessing operations, morphological operations and binarization operations, wherein the preprocessing operations include at least any one of the following: digitization, geometric transformation, normalization, smoothing, restoration and enhancement, and the morphological operations include at least any one of the following: erosion, expansion, opening operation, closing operation, morphological gradient, top hat operation and black hat operation.
7. A light source positioning device based on a plane mirror, characterized in that: The device comprises: An acquisition module, used to acquire a fixed camera, a fixed light source, and a movable plane mirror, wherein the plane mirror is provided with no less than three non-collinear targets; an adjustment module, configured to determine a camera field of view of the camera, and adjust the plane mirror according to the camera field of view so that a virtual image of the light source of the light source appears on the plane mirror, wherein the camera is located between the light source and the plane mirror, and the adjusted plane mirror is within the camera field of view; An identification module, used for obtaining a detection image by photographing the plane mirror with the camera, and obtaining a positioning image corresponding to the target and a positioning image corresponding to the virtual image of the light source in the detection image; A calculation module is used to calculate the actual position information of the light source according to the position information of all positioning images obtained on the detection image, including: obtaining the point coordinates of all positioning images in the image coordinate system and the point coordinates of the camera coordinate system; obtaining the position calculation formula of the target, wherein the position calculation formula of the target includes an initial ellipse general equation and an initial ellipse cone equation, the initial ellipse general equation and the initial ellipse cone equation both include multiple unknown coefficients, and the coefficients of the initial ellipse general equation and the coefficients of the initial ellipse cone equation are associated with each other; substituting the point coordinates of the image coordinate system into the initial ellipse general equation to obtain the coefficients of the initial ellipse general equation; calculating the coefficients of the initial ellipse cone equation by the coefficients of the initial ellipse general equation and the point coordinates of the camera coordinate system, and substituting the coefficients of the initial ellipse cone equation into the initial ellipse cone equation to obtain the ellipse cone equation; converting the ellipse cone equation into a first matrix, and solving the position information of the target and the position information of the virtual image of the light source by the first matrix.
8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Mirror object measuring device and method based on binocular vision
CN104111036A
Kinect calibration method and device based on plane mirror
CN109255819A