Method, device, medium and electronic device for shielding camera lens under distortion
By determining and updating the occlusion point in the camera, the image distortion and occlusion loss caused by lens distortion are solved, and accurate positioning and dynamic occlusion are achieved in the case of lens distortion.
Patent Information
- Application Number
- CN202011589908.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-29
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2040-12-29
AI Technical Summary
The camera lens distortion causes image distortion, making it difficult to accurately locate and perform occlusion operations.
By determining the occlusion object in the current image and drawing the occlusion point, the preset relationship is used to calculate the point coordinates before distortion, and the point coordinates are updated when the camera angle is adjusted to achieve dynamic occlusion.
In the case of lens distortion, the position of the occlusion object in the image can be accurately determined and dynamically blocked, solving the problem of occlusion loss caused by lens distortion.
Smart Images

Figure CN114697518B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a method, device, medium and electronic device for shielding a camera under lens distortion. Background Art
[0002] In the field of camera manufacturing, lens distortion is often introduced due to the manufacturing precision of the lens and the deviation of the assembly process, which will cause the original image to be distorted. Lens distortion can be divided into radial distortion and tangential distortion. The lens of the pan-tilt camera often has radial distortion.
[0003] Radial distortion is the distortion distributed along the radius of the lens. It is caused by the light being more bent at the edge of the lens than near the center, which causes the center of the image to be outward and the degree of distortion to become greater and greater. This distortion is more obvious in short-focus lenses. Radial distortion mainly includes pincushion distortion and barrel distortion. Regardless of the type of radial distortion, the position of the object to be blocked in the image will be offset, which makes it difficult to accurately locate the blocked object in the image, resulting in the problem of occlusion. Summary of the invention
[0004] The embodiments of the present application provide a method, device, medium and electronic device for occluding objects under lens distortion of a camera, which can accurately determine the position of an occluding object in an image and perform dynamic occlusion when the camera has lens distortion.
[0005] In a first aspect, an embodiment of the present application provides a method for shielding a camera under lens distortion, the method comprising:
[0006] Determine an occluded object in the current image, and determine an occluded point position drawn for the occluded object;
[0007] Determine the coordinates of the occluded points in the current image before distortion according to a preset relationship;
[0008] If the camera angle adjustment event is detected, the updated coordinates of the point after the angle adjustment are obtained;
[0009] The target point of the occluded object in the image after the angle adjustment is determined according to the point update coordinates, and the occlusion drawing is performed according to the target point.
[0010] Furthermore, after determining the coordinates of the occluded points in the current image before distortion according to the preset relationship, the method further includes:
[0011] Determine the longitude and latitude coordinates of the occluded object in the camera coordinate system according to the point coordinates before the distortion; wherein the camera coordinate system is used to control the movement and / or rotation of the camera;
[0012] Correspondingly, if an angle adjustment event of the camera is detected, the updated coordinates of the point after the angle adjustment are obtained, including:
[0013] If an angle adjustment event of the camera is detected, the longitude and latitude adjustment values of the camera are determined;
[0014] According to the longitude and latitude adjustment values, the updated coordinates of the point of the occluding object in the image after the angle adjustment are determined.
[0015] Furthermore, the preset relationship is as follows:
[0016]
[0017]
[0018] Among them, (x0, y0) is the point coordinate before distortion, (x, y) is the point coordinate after distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the picture.
[0019] Furthermore, before determining the coordinates of the occluded points in the current image before distortion according to the preset relationship, the method further includes:
[0020] Determine the lens distortion description formula of the camera according to the test data;
[0021] A preset relationship is determined according to the lens distortion description formula.
[0022] Further, according to the test data, the lens distortion description formula of the camera is determined, including:
[0023] If the degree of lens distortion of the camera is less than a set threshold, the first description formula is used as the description formula of the lens distortion of the camera;
[0024] If the degree of lens distortion of the camera is greater than or equal to the set threshold, the second description formula is used as the description formula of the lens distortion of the camera.
[0025] Furthermore, the first description formula includes:
[0026] f(r)=k1r 2 +k2r 4 ;
[0027] Among them, f(r) is the degree of distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the picture.
[0028] Furthermore, the second description formula includes:
[0029] f(r)=k1r 2+k2r 4 +k3r 6 +k4r 8 ;
[0030] Among them, f(r) is the degree of distortion, k1, k2, k3 and k4 are distortion coefficients, and r is the radius from the center of the picture.
[0031] In a second aspect, an embodiment of the present application provides a shielding device under lens distortion of a camera, the device comprising:
[0032] An occlusion point determination module is used to determine an occlusion object in the current image and determine the occlusion points drawn for the occlusion object;
[0033] A point coordinate determination module, used to determine the point coordinates of the occluded point in the current image before distortion according to a preset relationship;
[0034] A point update coordinate determination module is used to obtain the point update coordinates after the angle adjustment if an angle adjustment event of the camera is detected;
[0035] The occlusion drawing update module is used to determine the target point of the occlusion object in the image after the angle adjustment according to the point update coordinates, and perform occlusion drawing according to the target point.
[0036] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for blocking the camera under lens distortion as described in the embodiment of the present application.
[0037] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for shielding a camera under lens distortion as described in the embodiment of the present application is implemented.
[0038] The technical solution provided by the embodiment of the present application determines the occlusion object in the current image, determines the occlusion point drawn for the occlusion object; determines the point coordinates of the occlusion point in the current image before distortion according to a preset relationship; if an angle adjustment event of the camera is detected, obtains the updated coordinates of the point after the angle adjustment; determines the target point of the occlusion object in the image after the angle adjustment according to the updated coordinates of the point, and performs occlusion drawing according to the target point. The technical solution provided by the present application can accurately determine the position of the occlusion object in the image even when the camera has lens distortion, and can perform dynamic occlusion. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1It is a flow chart of a method for shielding a camera under lens distortion provided by an embodiment of the present application;
[0040] Figure 2 is a schematic diagram of the imaging effect of radial distortion provided in an embodiment of the present application;
[0041] Figure 3 Schematic diagram of the imaging effect of barrel distortion provided by an embodiment of the present application;
[0042] Figure 4 is a side view schematic diagram of an image captured by a camera provided in an embodiment of the present application;
[0043] Figure 5 is a schematic top view of an image captured by a camera provided in an embodiment of the present application;
[0044] Figure 6 is a schematic diagram of the degree of distortion of different radii in the same image provided by an embodiment of the present application;
[0045] Figure 7 It is a structural schematic diagram of a shielding device under lens distortion of a camera provided in an embodiment of the present application;
[0046] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0048] It should be mentioned before discussing the exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0049] Figure 1 It is a flow chart of the occlusion method under the lens distortion of the camera provided in the embodiment of the present application. This embodiment is applicable to the dynamic occlusion of the pan-tilt camera. The method can be executed by the occlusion device under the lens distortion of the camera provided in the embodiment of the present application. The device can be implemented by software and / or hardware and can be integrated in the electronic device for displaying the image of the pan-tilt camera.
[0050] like Figure 1 As shown, the shielding method under the lens distortion of the camera includes:
[0051] S110: Determine an occluding object in the current image, and determine an occluding point position drawn for the occluding object.
[0052] Among them, the occluded object in the image may be related to the person in the image and needs to be processed for privacy, such as not showing the person's face image, or related to the position where the person in the image enters the password when withdrawing money. In this case, occlusion processing is often required. In this solution, the occluded object in the image can be determined by image recognition or user selection operation.
[0053] The occlusion point may be the position where the occlusion block is drawn, which may be virtualized as a pixel coordinate. The point may be the center position of the occlusion block, or the following calculation may be performed on each pixel of the occlusion block to accurately obtain the occlusion position.
[0054] This solution deals with the situation where the image has radial distortion. Figure 2 Schematic diagram of the imaging effect of radial distortion provided by the embodiment of the present application. Figure 2 As shown in the figure, the left side is pincushion distortion and the right side is barrel distortion. Taking barrel distortion as an example, Figure 3 Schematic diagram of the imaging effect of barrel distortion provided by the embodiment of the present application. Figure 3 As shown in the figure, the black solid line represents the imaging effect of the network camera, and the gray solid line represents the imaging effect when there is no distortion. It can be seen that in the actual scene, that is, in the scene without distortion, the position to be blocked is the cell in the second row and second column. After distortion, the cell in the second row and second column corresponds to the position of the cell in the first row and first column after distortion. The distance between the two and the center of the image will also change.
[0055] S120: Determine the coordinates of the occluded points in the current image before distortion according to a preset relationship.
[0056] In this solution, the preset relationship formula may be predetermined, and the preset relationship formula may be different for different cameras. The parameters of the preset relationship formula may be determined through distortion experiments, thereby determining the preset relationship formula of the current camera.
[0057] After obtaining the preset relationship, the coordinates of the occluded point in the current image before distortion can be determined according to the preset relationship. In this solution, the coordinates of the point before distortion can be similar to Figure 3By transforming the occlusion points in the current image, the actual coordinates of the occluded object can be obtained, and dynamic occlusion can be performed based on this.
[0058] S130: If an angle adjustment event of the camera is detected, the updated coordinates of the point after the angle adjustment are obtained.
[0059] In this solution, when the camera has an angle adjustment event or a position change event, the dynamic occlusion operation can be triggered, that is, the updated coordinates of the point after the angle adjustment are obtained.
[0060] The point update coordinates may be changes in the potential of the occluding object before distortion after the camera angle is adjusted, that is, changes from the original point coordinates before distortion to the point update coordinates.
[0061] In this solution, specifically, after determining the coordinates of the occluded points in the current image before distortion according to the preset relationship, the method further includes:
[0062] Determine the longitude and latitude coordinates of the occluded object in the camera coordinate system according to the point coordinates before the distortion; wherein the camera coordinate system is used to control the movement and / or rotation of the camera;
[0063] Correspondingly, if an angle adjustment event of the camera is detected, the updated coordinates of the point after the angle adjustment are obtained, including:
[0064] If an angle adjustment event of the camera is detected, the longitude and latitude adjustment values of the camera are determined;
[0065] According to the longitude and latitude adjustment values, the updated coordinates of the point of the occluding object in the image after the angle adjustment are determined.
[0066] Figure 4 It is a side view schematic diagram of an image captured by a camera provided in an embodiment of the present application. Figure 5 is a schematic top view of an image captured by a camera according to an embodiment of the present application. Figure 4 and Figure 5 As shown, HA and VA are the horizontal and vertical viewing angles of the camera, W and H are the length and width of the plane image, respectively, F is a certain plane point, and x and y are the coordinates of the point on the plane. It can be understood that Figure 4 and Figure 5 The unclear parts are irrelevant to the content of this case and can be ignored.
[0067] The following formula can be used to calculate longitude and latitude:
[0068] XO = W·tan(HA / 2) / 2;
[0069] FS = W / 2-x2;
[0070] FR = H / 2-y2;
[0071]
[0072]
[0073] Through the calculation of the above formula, the longitude and latitude of each point in the camera coordinate system can be calculated, and the longitude and latitude in the camera coordinate system can be converted into the point coordinates before distortion, so that the point coordinates of the occluded object can be dynamically located, and dynamic occlusion can be performed based on the positioning results.
[0074] In this solution, since the PTZ camera is controlled by longitude and latitude, the point coordinates can be converted into longitude and latitude, and after obtaining the longitude and latitude adjusted by the PTZ camera, the position of the occluded object in the image before distortion can be directly determined. In this way, the distortion conversion formula can be used to obtain the occluded point position after distortion, and dynamic occlusion can be completed.
[0075] S140, determining a target point of the occluded object in the image after the angle adjustment according to the point update coordinates, and performing occlusion drawing according to the target point.
[0076] After obtaining the updated coordinates of the points, the target points of the occluded object can be determined according to the updated coordinates, wherein the target points are the potentials that actually need to be occluded after distortion. After obtaining the target points, the target points can be occluded and drawn to realize a dynamic occlusion process.
[0077] In a feasible embodiment, optionally, the preset relationship is the following relationship:
[0078] x0=x·(1+k1r 2 +k2r 4 );
[0079] y0=y·(1+k1r 2 +k2r 4 );
[0080] Among them, (x0, y0) is the point coordinate before distortion, (x, y) is the point coordinate after distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the picture.
[0081] The preset relationship is determined based on the relationship describing the degree of distortion of the camera, and the relationship describing the camera with different degrees of distortion may be different. The two distortion coefficients k1 and k2 may be determined based on experiments.
[0082] In this solution, optionally, before determining the coordinates of the occluded point in the current image before distortion according to the preset relationship, the method further includes:
[0083] Determine the lens distortion description formula of the camera according to the test data;
[0084] A preset relationship is determined according to the lens distortion description formula.
[0085] The lens distortion description formula can be used to express the relationship between the distance between each pixel in the image and the image center and the degree of distortion, for example, f(r) = k1r 2 +k2r 4 ;
[0086] The larger r is, the greater the degree of distortion.
[0087] In a feasible embodiment, optionally, determining the lens distortion description formula of the camera according to the test data includes:
[0088] If the degree of lens distortion of the camera is less than a set threshold, the first description formula is used as the description formula of the lens distortion of the camera;
[0089] If the degree of lens distortion of the camera is greater than or equal to a set threshold, the second description formula is used as the description formula of the lens distortion of the camera.
[0090] Specifically, the first description formula includes:
[0091] f(r)=k1r 2 +k2r 4 ;
[0092] Among them, f(r) is the degree of distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the picture.
[0093] The second description formula includes:
[0094] f(r)=k1r 2 +k2r 4 +k3r 6 +k4r 8 ;
[0095] Among them, f(r) is the degree of distortion, k1, k2, k3 and k4 are distortion coefficients, and r is the radius from the center of the picture.
[0096] in, Figure 6 Schematic diagram of the degree of distortion of different radii in the same image provided by the embodiment of the present application. Figure 6 As shown, the farther away from the center of the image, the greater the degree of image distortion.
[0097] The degree of distortion is 0 near the center of the image, and increases with the radius r. The Taylor series expansion is used to describe it:
[0098] f(r)=a0+a1r+a2r 2 +a3r 3 +a4r 4 +a5r 5 +a6r 6 +...;
[0099] It is known that f(r=0)=0, so a0=0, and the function must be symmetric in r, so only the even-power coefficients of r are non-zero, so the even-power coefficients of r are retained for description, and the general degree of distortion is only described by r. 2 、r 4 It can be described. If there is a greater degree of distortion to be described, r can be used 6 、r 8 or higher powers are added to the calculation.
[0100] The technical solution provided in the embodiment of the present application determines the occluded object in the current image, determines the occluded point drawn for the occluded object; determines the point coordinates of the occluded point in the current image before distortion according to a preset relationship; if an angle adjustment event of the camera is detected, obtains the updated coordinates of the point after the angle adjustment; determines the target point of the occluded object in the image after the angle adjustment according to the updated coordinates of the point, and performs occlusion drawing according to the target point. The technical solution provided in the present application can still accurately determine the position of the occluded object in the image when the camera has lens distortion, and can perform dynamic occlusion.
[0101] The specific conversion process of this solution is shown below. For example, a coordinate system can be established on the live screen, and point O at the center of the screen is set as the origin of the coordinate system, with coordinates O(0, 0);
[0102] First, the user draws a mask at point F1 in the screen with coordinates F1(x1, y1) and saves the user configuration;
[0103] Secondly, the distortion pre-masking position F2(x2, y2) is calculated by the distortion formula;
[0104] From the circle formula we know that:
[0105]
[0106] Calculate the F2 position using the distortion formula:
[0107] x2=x1·(1+k1(x1 2 +y1 2 )+k2(x12 +y1 2 )2);
[0108] y2=y1·(1+k1(x1 2 +y1 2 )+k2(x1 2 +y1 2 ) 2 );
[0109] Again, the F2 coordinates are converted to the gimbal longitude and latitude coordinates using the 3D masking formula:
[0110] XO = W·tan(HA / 2) / 2;
[0111] FS = W / 2-x2;
[0112] FR = H / 2-y2;
[0113]
[0114]
[0115] Then, the gimbal coordinates and field of view angle are updated after the gimbal camera rotates, and the F3 coordinates (x3, y3) are calculated in reverse by the above formula;
[0116] Finally, the F3 coordinates are imported into the distortion formula for reverse calculation to obtain the distorted coordinate F4, and the F4 position is superimposed and masked:
[0117] x3=x4·(1+k1(x4 2 +y4 2 )+k2(x4 2 +y4 2 ) 2 );
[0118] y3=y4·(1+k1(x4 2 +y4 2 )+k2(x4 2 +y4 2 ) 2 );
[0119] Solve the equation to get the coordinates of F4 (x4, y4) and overlay them on the screen.
[0120] This solution realizes dynamic occlusion of occluded objects under lens distortion through the use of lenses with dynamic image acquisition functions such as pan-tilt cameras, thereby achieving the purpose of accurately dynamically occluding occluded objects.
[0121] Figure 7 is a schematic diagram of the structure of the shielding device under the lens distortion of the camera provided in the embodiment of the present application, such as Figure 7 As shown, the device may include:
[0122] The occlusion point determination module 710 is used to determine the occlusion object in the current image and determine the occlusion point drawn for the occlusion object;
[0123] The point coordinate determination module 720 is used to determine the point coordinates of the occluded point in the current image before distortion according to a preset relationship;
[0124] The point update coordinate determination module 730 is used to obtain the point update coordinates after the angle adjustment if an angle adjustment event of the camera is detected;
[0125] The occlusion drawing update module 740 is used to determine the target point of the occlusion object in the image after the angle adjustment according to the point update coordinates, and perform occlusion drawing according to the target point.
[0126] A shielding device under lens distortion of a camera provided in an embodiment of the present invention can execute a shielding method under lens distortion of a camera provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing a shielding method under lens distortion of a camera.
[0127] The embodiment of the present application further provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a method for blocking a camera under lens distortion when executed by a computer processor, the method comprising:
[0128] Determine an occluded object in the current image, and determine an occluded point position drawn for the occluded object;
[0129] Determine the coordinates of the occluded points in the current image before distortion according to a preset relationship;
[0130] If the camera angle adjustment event is detected, the updated coordinates of the point after the angle adjustment are obtained;
[0131] The target point of the occluded object in the image after the angle adjustment is determined according to the point update coordinates, and the occlusion drawing is performed according to the target point.
[0132] Storage media refers to any of various types of memory electronic devices or storage electronic devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the computer system in which the program is executed, or may be located in a different second computer system, which is connected to the computer system via a network (such as the Internet). The second computer system can provide program instructions to the computer for execution. The term "storage medium" may include two or more storage media that may reside in different unknowns (for example, in different computer systems connected via a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.
[0133] Of course, the storage medium containing computer executable instructions provided in an embodiment of the present application, whose computer executable instructions are not limited to the operation of the occlusion method under the lens distortion of the camera as described above, can also execute related operations in the occlusion method under the lens distortion of the camera provided in any embodiment of the present application.
[0134] An embodiment of the present application provides an electronic device, in which the shielding device under lens distortion of the camera provided in the embodiment of the present application can be integrated. The electronic device can be configured in a system, or can be a device that executes part or all of the functions in the system. Figure 8 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, this embodiment provides an electronic device 800, which includes: one or more processors 820; a storage device 810, which is used to store one or more programs. When the one or more programs are executed by the one or more processors 820, the one or more processors 820 implement the occlusion method under lens distortion of the camera provided in the embodiment of the present application. The method includes:
[0135] Determine an occluded object in the current image, and determine an occluded point position drawn for the occluded object;
[0136] Determine the coordinates of the occluded points in the current image before distortion according to a preset relationship;
[0137] If the camera angle adjustment event is detected, the updated coordinates of the point after the angle adjustment are obtained;
[0138] The target point of the occluded object in the image after the angle adjustment is determined according to the point update coordinates, and the occlusion drawing is performed according to the target point.
[0139] Of course, those skilled in the art can understand that the processor 820 also implements the technical solution of the occlusion method under the lens distortion of the camera provided in any embodiment of the present application.
[0140] Figure 8 The electronic device 800 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0141] like Figure 8 As shown, the electronic device 800 includes a processor 820, a storage device 810, an input device 830, and an output device 840; the number of the processor 820 in the electronic device can be one or more. Figure 8 A processor 820 is taken as an example; the processor 820, the storage device 810, the input device 830 and the output device 840 in the electronic device can be connected via a bus or other means. Figure 8 The connection via bus 850 is taken as an example.
[0142] The storage device 810, as a computer-readable storage medium, can be used to store software programs, computer executable programs and module units, such as program instructions corresponding to the occlusion method under lens distortion of the camera in the embodiment of the present application.
[0143] The storage device 810 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the storage device 810 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 810 may further include a memory remotely arranged relative to the processor 820, and these remote memories may be connected via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0144] The input device 830 may be used to receive input numbers, character information or voice information, and generate key signal input related to user settings and function control of the electronic device. The output device 840 may include electronic devices such as a display screen and a speaker.
[0145] The electronic device provided in the embodiment of the present application can accurately determine the position of the occluded object in the image and perform dynamic occlusion even when the camera has lens distortion.
[0146] The shielding device, medium, and electronic device under the lens distortion of the camera provided in the above embodiments can execute the shielding method under the lens distortion of the camera provided in any embodiment of the present application, and have the corresponding functional modules and beneficial effects of executing the method. For technical details not described in detail in the above embodiments, please refer to the shielding method under the lens distortion of the camera provided in any embodiment of the present application.
[0147] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for shielding a camera under lens distortion, characterized in that: The method comprises: Determine an occluded object in the current image, and determine an occluded point position drawn for the occluded object; Determine the coordinates of the occluded points in the current image before distortion according to a preset relationship; Determine the longitude and latitude coordinates of the occluded object in the camera coordinate system according to the point coordinates before the distortion; wherein the camera coordinate system is used to control the movement and / or rotation of the camera; If an angle adjustment event of the camera is detected, the longitude and latitude adjustment values of the camera are determined; Determine, according to the latitude and longitude adjustment values, the updated coordinates of the point position of the occluded object in the image after the angle adjustment; Determine the target point of the occluded object in the image after the angle adjustment according to the point update coordinates, and perform occlusion drawing according to the target point; wherein the coordinates corresponding to the target point are obtained by reverse calculation by importing the point update coordinates into a preset relationship; The preset relationship is as follows: x0=x·(1+k1r 2 +k2r 4 ); y0=y·(1+k1r 2 +k2r 4 ); Where (x0, y0) is the point coordinate before distortion, (x, y) is the point coordinate after distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the image. Before determining the coordinates of the occluded points in the current image before distortion according to the preset relationship, the method further includes: Determine the lens distortion description formula of the camera according to the test data; Determine the preset relationship according to the lens distortion description formula; Determining the lens distortion description of the camera according to the test data includes: If the degree of lens distortion of the camera is less than a set threshold, the first description formula is used as the description formula of the lens distortion of the camera; If the degree of lens distortion of the camera is greater than or equal to the set threshold, the second description formula is used as the description formula of the lens distortion of the camera; The first description formula includes: f(r)=k1r 2 +k2r 4 ; Among them, f(r) is the degree of distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the picture; The second description formula includes: f(r)=k1r 2 +k2r 4 +k3r 6 +k4r 8 ; Among them, f(r) is the degree of distortion, k1, k2, k3 and k4 are distortion coefficients, and r is the radius from the center of the picture.
2. A shielding device for a camera lens under distortion, characterized in that: The device comprises: An occlusion point determination module is used to determine an occlusion object in the current image and determine the occlusion points drawn for the occlusion object; A point coordinate determination module, used to determine the point coordinates of the occluded point in the current image before distortion according to a preset relationship; The preset relationship is as follows: x0=x·(1+k1r 2 +k2r 4 ); y0=y·(1+k1r 2 +k2r 4 ); Where (x0, y0) is the point coordinate before distortion, (x, y) is the point coordinate after distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the image. A latitude and longitude coordinate determination module, used to determine the latitude and longitude coordinates of the occluding object in the camera coordinate system according to the point coordinates before the distortion; wherein the camera coordinate system is used to control the movement and / or rotation of the camera; A point update coordinate determination module is used to determine the longitude and latitude adjustment values of the camera if an angle adjustment event of the camera is detected; and determine the point update coordinates of the occluded object in the image after the angle adjustment according to the longitude and latitude adjustment values; An occlusion drawing update module is used to determine the target point of the occlusion object in the image after the angle adjustment according to the point update coordinates, and perform occlusion drawing according to the target point; wherein the coordinates corresponding to the target point are obtained by reverse calculation by importing the point update coordinates into a preset relationship; A lens distortion description formula determination module, used to determine the lens distortion description formula of the camera according to the test data; A preset relationship determination module, used to determine the preset relationship according to the lens distortion description formula; The lens distortion description formula determination module is specifically used for: If the degree of lens distortion of the camera is less than a set threshold, the first description formula is used as the description formula of the lens distortion of the camera; If the degree of lens distortion of the camera is greater than or equal to the set threshold, the second description formula is used as the description formula of the lens distortion of the camera; The first description formula includes: f(r)=k1r 2 +k2r 4 ; Among them, f(r) is the degree of distortion, k1 and k2 are distortion coefficients, and r is the radius from the center of the picture; The second description formula includes: f(r)=k1r 2 +k2r 4 +k3r 6 +k4r 8 ; Among them, f(r) is the degree of distortion, k1, k2, k3 and k4 are distortion coefficients, and r is the radius from the center of the picture.
3. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the shielding method under lens distortion of a camera as claimed in claim 1 is implemented.
4. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the shielding method under the lens distortion of the camera as described in claim 1 is implemented.
Citation Information
Patent Citations
Monitoring picture covering method and device and network camera
CN106559656A
Image processing device, image processing method, and program
JP2019047204A
Image correction method and terminal
WO2020014881A1
Camera parameter estimation device, camera parameter estimation method, and computer-readable recording medium
WO2020144757A1