Privacy mask processing method and device based on lens distortion and electronic equipment
By obtaining and analyzing the preset privacy mask in the lens screen and the distortion information after the change in the monitoring range, the target privacy mask is automatically adjusted, which solves the problem of privacy area leakage caused by lens distortion in the existing technology, and improves the security of the privacy area Sex and monitoring effects.
Patent Information
- Application Number
- CN202310802009.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
AI Technical Summary
In the existing video surveillance technology, 3D masks cause privacy areas to be leaked due to lens distortion, and cannot guarantee the security of privacy areas for a long time, especially when the lens field angle is large.
By obtaining the preset privacy mask in the lens screen and the distortion information after the monitoring range changes, the target privacy mask is automatically adjusted to ensure the security of the privacy area. The specific method includes obtaining the preset privacy mask in the lens screen, determining the target privacy mask based on the distortion information in different areas of the lens and the configuration information before and after the change in the monitoring range, and outputting the adjusted mask.
The target privacy mask is automatically adjusted as the monitoring range changes to avoid privacy areas, improve the security of the privacy areas, and does not affect the monitoring range and camera resource consumption.
Smart Images

Figure CN119232878A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video surveillance, and in particular to a privacy mask processing method, device and electronic equipment based on lens distortion. Background Art
[0002] Video surveillance is an important part of the security system. In video surveillance, in order to protect the privacy area, a privacy mask is generally set on the video image to cover the privacy area in the video image. 3D mask means that the position of the mask changes with the position of the camera pan / tilt.
[0003] For 3D masks, due to the optical distortion of the lens, the larger the field of view of the lens, the more serious the distortion, that is, the farther the mask is from the center of the lens, the more serious the deformation. The size of the privacy mask is fixed, resulting in the privacy area being farther from the center of the lens, and the greater the probability of privacy area leakage.
[0004] In the prior art, a privacy mask with a larger scope is generally used to cover the privacy area. However, setting a privacy mask with a larger scope results in poor monitoring effect within the current monitoring range. At the same time, as the position of the PTZ changes, the security of the privacy area cannot be guaranteed for a long time. Summary of the invention
[0005] The present invention provides a privacy mask processing method, device and electronic device based on lens distortion, which are used to solve the defect that the security of the privacy area cannot be guaranteed for a long time in the prior art, realize automatic adjustment of the target privacy mask as the monitoring range changes, and improve the security of the privacy area.
[0006] The present invention provides a privacy mask processing method based on lens distortion, comprising:
[0007] Get the preset privacy mask in the camera image;
[0008] Determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes;
[0009] The target privacy mask is output.
[0010] According to the privacy mask processing method based on lens distortion provided by the present invention, based on the distortion information of different areas of the lens picture and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, determining the target privacy mask after the monitoring range changes, includes:
[0011] Based on the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, determine the first position information of the first monitoring picture after the monitoring range changes in the monitoring panorama;
[0012] Matching the first position information with the second position information of the preset privacy mask in the monitoring panorama to determine a position matching result between the first monitoring screen and the preset privacy mask;
[0013] The target privacy mask is determined based on the position matching result and distortion information of different areas in the lens.
[0014] According to the privacy mask processing method based on lens distortion provided by the present invention,
[0015] The determining the target privacy mask based on the position matching result and the distortion information of different regions of the lens includes:
[0016] In a case where the position matching result includes that the preset privacy mask partially matches the first monitoring picture, determining an overlapping area between the preset privacy mask and the first monitoring picture;
[0017] Determining contour information corresponding to the overlapping area;
[0018] The target privacy mask is determined based on the contour information and distortion information of the contour information in the lens.
[0019] According to the privacy mask processing method based on lens distortion provided by the present invention, the target privacy mask is determined based on the position matching result and the distortion information of different areas of the lens, including:
[0020] When the position matching result includes that the preset privacy mask completely matches the first monitoring picture, determining a distorted privacy mask based on second position information corresponding to the preset privacy mask and distortion information in the lens where the preset privacy mask is located;
[0021] Based on matching the distorted position information corresponding to the distorted privacy mask and the first position information corresponding to the first monitoring picture, a target privacy mask after the monitoring range is changed is determined.
[0022] According to the privacy mask processing method based on lens distortion provided by the present invention, the distortion position information corresponding to the distortion privacy mask and the first position information corresponding to the first monitoring picture are matched to determine the target privacy mask after the monitoring range changes, including:
[0023] In a case where the distorted privacy mask and the first monitoring picture completely match, determining the distorted privacy mask as the target privacy mask;
[0024] When the distorted privacy mask and the first monitoring picture partially match, an overlapping area of the distorted privacy mask and the first monitoring picture is determined as the target privacy mask.
[0025] According to the privacy mask processing method based on lens distortion provided by the present invention, the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, and determining the first position information of the first monitoring picture in the monitoring panorama after the monitoring range changes, includes:
[0026] Determine the amount of position change of the monitoring screen based on the pan / tilt position change information before and after the monitoring range changes in the monitoring configuration information and / or the zoom information of the lens;
[0027] Based on the change in the position of the monitoring screen and the third position information in the monitoring configuration information, the first position information corresponding to the first monitoring screen after the monitoring range changes is determined, and the third position information is the position information of the second monitoring screen corresponding to the preset privacy mask before the monitoring range changes in the monitoring panoramic view.
[0028] According to the privacy mask processing method based on lens distortion provided by the present invention, the method further includes:
[0029] In a case where the monitoring configuration information includes the pan / tilt position change information before and after the monitoring range changes, the pan / tilt motor step length before and after the monitoring range changes is determined as the pan / tilt position change information.
[0030] The present invention also provides a privacy mask processing device based on lens distortion, comprising:
[0031] An acquisition module is used to acquire a preset privacy mask in the camera image;
[0032] A determination module, configured to determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes;
[0033] An output module is used to output the target privacy mask.
[0034] The present invention also 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 program, the privacy mask processing method based on lens distortion as described above is implemented.
[0035] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the privacy mask processing method based on lens distortion as described in any one of the above is implemented.
[0036] The privacy mask processing method, device and electronic device based on lens distortion provided by the present invention obtain a preset privacy mask in the lens picture. After the monitoring range of the lens changes, the position of the preset privacy mask within the monitoring range changes, that is, the distortion information of the preset privacy mask within the monitoring range changes. According to the monitoring configuration information of the preset privacy mask before and after the monitoring range changes, the area in the lens where the preset privacy mask is located after the monitoring range changes is determined, and the distortion information of the lens area is determined from the distortion information of different areas of the lens, and then the target privacy mask after the monitoring range changes is determined, so as to realize automatic adjustment of the target privacy mask with the change of the monitoring range, avoid leakage of the privacy area, and improve the security of the privacy area. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 is a flowchart of a privacy mask processing method based on lens distortion provided by an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of a monitoring coordinate system provided by an embodiment of the present invention;
[0040] Figure 3 is a schematic diagram of barrel distortion provided by an embodiment of the present invention;
[0041] Figure 4 is a schematic diagram of pincushion distortion provided by an embodiment of the present invention;
[0042] Figure 5 is a schematic diagram of a position matching result provided by an embodiment of the present invention;
[0043] Figure 6 is a structural schematic diagram of a privacy mask processing device based on lens distortion provided by an embodiment of the present invention;
[0044] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In view of the problem that the privacy mask range is fixed in the prior art and the security of the privacy area cannot be guaranteed for a long time, an embodiment of the present invention provides a privacy mask processing method based on lens distortion. Figure 1 is a flow chart of a privacy mask processing method based on lens distortion provided by an embodiment of the present invention, such as Figure 1 Said method comprises:
[0047] Step 110: Obtain a preset privacy mask in the camera image.
[0048] Specifically, after the user turns on the 3D privacy masking function of the camera, the user is required to draw a preset privacy mask in the monitoring screen before the monitoring range changes according to the privacy area. After the user draws the preset privacy mask, the camera records the configuration information corresponding to the preset privacy mask. The configuration information may include: the pan / tilt position information corresponding to the monitoring screen before the monitoring range changes, the zoom information corresponding to the lens, and the second position information corresponding to the preset privacy mask. The second position information may be at least two coordinate points determined according to the shape of the preset privacy mask. The shape of the preset privacy mask may be a regular polygon or an irregular shape. When determining the second position information corresponding to the preset privacy mask, that is, determining the number and coordinate positions of the coordinate points corresponding to the preset privacy mask, it is sufficient to ensure that the preset privacy mask is within the area formed by the coordinate points. Taking the shape of the preset privacy mask as a quadrilateral as an example, the two coordinate points of the lower left corner and the upper right corner of the preset privacy mask can be determined as the second position information corresponding to the preset privacy mask.
[0049] Optionally, the monitoring coordinate system corresponding to the above coordinate points is constructed based on the monitoring panorama corresponding to the camera, and the monitoring panorama is obtained by adjusting the camera's zoom ratio to the maximum ratio and rotating the lens based on the pan / tilt. For example, the lower left corner of the monitoring panorama is used as the origin of the monitoring coordinate system, the x-axis of the monitoring coordinate system is constructed along the length direction of the monitoring panorama, the y-axis of the monitoring coordinate system is constructed along the width direction of the monitoring panorama, and the z-axis of the monitoring coordinate system is constructed along the direction perpendicular to the monitoring panorama, and the monitoring screen is within the range of the monitoring panorama. By way of example, Figure 2 is a schematic diagram of a monitoring coordinate system provided by an embodiment of the present invention, such as Figure 2As shown, the monitoring coordinate system is constructed based on the monitoring panoramic image corresponding to the camera. The monitoring panoramic image is a quadrilateral, and the coordinates corresponding to the monitoring panoramic image are (0,0) and (150,100), and the maximum zoom ratio corresponding to the lens is 10. When the preset privacy mask is set, the shape of the monitoring screen is a quadrilateral, and the coordinates corresponding to the monitoring screen are (25,20) and (45,60), and the zoom ratio corresponding to the lens is 2. In the monitoring screen, the shape of the preset privacy mask is a quadrilateral, and the coordinates corresponding to the preset privacy mask are (28,25) and (42,55).
[0050] It should be noted that the privacy mask processing method based on lens distortion provided in the embodiment of the present invention is applicable to cameras that support 3D masking. For cameras that do not support 3D masking, the set privacy mask position will not change. Therefore, the privacy mask processing method based on lens distortion provided in the embodiment of the present invention is not applicable to cameras that do not support 3D masking.
[0051] Step 120: Determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes.
[0052] Specifically, the monitoring configuration information may include: the third position information corresponding to the second monitoring screen before the monitoring range changes, the second position information corresponding to the preset privacy mask, the pan / tilt position change information before and after the monitoring range changes, and the zoom information of the lens. The monitoring configuration information is determined based on the monitoring coordinate system. Due to the rotation of the camera pan / tilt, the lens rotates, causing the camera to switch from the second monitoring screen to the first monitoring screen, that is, the position information of the camera monitoring screen changes, which in turn causes the position information of the preset privacy mask in the first monitoring screen to change, that is, the position information of the preset privacy mask in the lens changes. Therefore, based on the monitoring configuration information, the position information of the preset privacy mask in the second monitoring screen after the monitoring range changes can be determined, and according to the distortion information in the lens where the position information is located, the target privacy mask that is automatically adjusted after the distortion can be further determined, that is, the position information corresponding to the target privacy mask is determined. In the embodiment of the present invention, whether the relevant adjustment is performed after the pan / tilt is rotated in place is not limited. For example, during the pan / tilt rotation process, the calculation of the coordinates of the first monitoring screen and the adjustment of the position and shape of the privacy mask can be performed once every 3 frames.
[0053] Optionally, the distortion information of different areas of the above-mentioned lens can be stored in a pre-calibrated distortion table, which can be obtained by calibrating the distortion of the lens by the lens manufacturer or the camera manufacturer. After obtaining the distortion table, the distortion table can be written into the memory of the camera to facilitate the subsequent determination of the distortion information in the lens where the position information of the preset privacy mask in the second monitoring screen is located after the monitoring range changes. The distortion information includes but is not limited to: distortion angle, tangent offset, sag offset, actual height, reference height and distortion value of different areas of the lens. Different lenses correspond to different distortion types, and the distortion types include but are not limited to: barrel distortion (Barrel Distortion) and pincushion distortion (Pincushion Distortion), where:
[0054] (1) Barrel distortion, also known as barrel distortion, is a distortion phenomenon caused by the physical properties of the lens and the structure of the lens group in the lens, resulting in the image appearing to be barrel-shaped and expanded. Figure 3 is a schematic diagram of barrel distortion provided by an embodiment of the present invention, such as Figure 3 As shown, after barrel distortion, the preset privacy mask will become closer to the edge, and the edges in the horizontal and vertical directions will become arc curves protruding outward.
[0055] (2) Pincushion distortion, also known as pincushion distortion, is a phenomenon caused by the lens where the image "shrinks" toward the center. Figure 4 is a schematic diagram of pincushion distortion provided by an embodiment of the present invention, such as Figure 4 As shown, after the pincushion distortion, the preset privacy mask will become closer to the edge, and the edges in the horizontal and vertical directions will become inwardly concave arc curves.
[0056] Optionally, the distortion type of the lens can be determined based on the distortion value of the lens. When the distortion value of the lens is negative, it is called barrel distortion, and when the distortion value of the lens is positive, it is called pincushion distortion. Assume that the coordinates of the center point of the lens are (x c ,y c ), the coordinates of the coordinate point when the lens does not consider distortion are (x u ,y u ), and the distortion value at this coordinate point is K, then the coordinate of the new coordinate point after lens distortion (x d ,y d ) can be calculated according to formula (1) and formula (2) respectively. Formula (1) is:
[0057] x d =(x u -x c )(1+K 1 r 2 +K 2 r 4 )+xc
[0058] Formula (2) is:
[0059] y d =(y u -y c )(1+K 1 r 2 +K 2 r 4 )+y c
[0060] Where: x u Indicates the horizontal coordinate of the coordinate point when distortion is not considered, y u Indicates the ordinate of the coordinate point when distortion is not considered, x d Indicates the new horizontal coordinate of the coordinate point after distortion, y d The new ordinate of the coordinate point after distortion, x c Indicates the horizontal coordinate of the center point of the lens, that is, the horizontal coordinate of the center point of the monitoring screen, y c represents the ordinate of the center point of the lens, that is, the ordinate of the center point of the monitoring screen, K represents the radial distortion coefficient, that is, the distortion value of the coordinate point when the lens does not consider distortion, and r represents the distance from the new coordinate point to the center point of the lens after distortion, that is
[0061]
[0062] Optionally, the determining the target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens picture and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, includes:
[0063] Based on the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, determine the first position information of the first monitoring picture after the monitoring range changes in the monitoring panorama;
[0064] Matching the first position information with the second position information of the preset privacy mask in the monitoring panorama to determine a position matching result between the first monitoring screen and the preset privacy mask;
[0065] The target privacy mask is determined based on the position matching result and distortion information of different areas in the lens.
[0066] Specifically, according to the pan / tilt position change information and / or lens zoom information before and after the monitoring range changes in the monitoring configuration information, and the third position information corresponding to the second monitoring screen before the monitoring range changes, the first position information corresponding to the first monitoring screen after the monitoring range changes can be determined. Since the privacy area to be blocked corresponding to the preset privacy mask is determined based on the second monitoring screen during the initial configuration, after the monitoring range is converted from the second monitoring screen to the first monitoring screen, the position of the preset privacy mask in the lens corresponding to the first monitoring screen changes. At this time, the second position information corresponding to the preset privacy mask can be matched with the first position information corresponding to the first monitoring screen to determine the position of the preset privacy mask in the lens corresponding to the first monitoring screen according to the position matching result, and then the target privacy mask is determined based on the position matching result and the distortion information corresponding to the position of the preset privacy mask in the lens corresponding to the first monitoring screen from the distortion information of different areas in the lens stored in the above-mentioned distortion table.
[0067] Optionally, the method further comprises:
[0068] In a case where the monitoring configuration information includes the pan / tilt position change information before and after the monitoring range changes, the pan / tilt motor step length before and after the monitoring range changes is determined as the pan / tilt position change information.
[0069] Specifically, when the pan-tilt rotation causes the monitoring range to change, the pan-tilt position change information can be determined by the pan-tilt motor step length during the process of switching from the second monitoring screen to the first monitoring screen, which is a process of the pan-tilt motor rotating in the horizontal direction or the vertical direction. For example, when the pan-tilt motor rotates in the horizontal direction, the pan-tilt motor step length during the process of switching from the second monitoring screen to the first monitoring screen is 2, that is, the pan-tilt position change information is 2. When the coordinate points corresponding to the second monitoring screen are (25, 20) and (45, 60), respectively, after the monitoring range changes, the coordinate points corresponding to the first monitoring screen can be (23, 20) and (43, 60), respectively.
[0070] Secondly, when the monitoring range changes due to the change in lens magnification, if the lens magnification increases, the monitoring range will be reduced, causing the first position information corresponding to the first monitoring screen to change compared to the third position information corresponding to the second monitoring screen after the monitoring range changes. Taking the example that both the first monitoring screen and the second monitoring screen are quadrilaterals, when the lens magnification increases, the four coordinate points corresponding to the third position information are all adjusted toward the center of the second monitoring screen, that is, the x values of the two coordinate points on the left side of the second monitoring screen will increase, and the x values of the two coordinate points on the right side will decrease. At the same time, the y values of the two upper coordinate points of the second monitoring screen will decrease, and the y values of the two lower coordinate points will increase. The specific change rules can be selected according to actual needs, and the embodiments of the present invention are not limited to this.
[0071] Optionally, the determining, based on the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, the first position information of the first monitoring picture in the monitoring panorama after the monitoring range changes, includes:
[0072] Determine the amount of position change of the monitoring screen based on the pan / tilt position change information before and after the monitoring range changes in the monitoring configuration information and / or the zoom information of the lens;
[0073] Based on the change in the position of the monitoring screen and the third position information in the monitoring configuration information, the first position information corresponding to the first monitoring screen after the monitoring range changes is determined, and the third position information is the position information corresponding to the second monitoring screen corresponding to the preset privacy mask before the monitoring range changes.
[0074] Specifically, after configuring the preset privacy mask, when the monitoring range changes due to the pan-tilt rotation, the pan-tilt position change information can be first determined by the pan-tilt motor step length. Based on the fact that the pan-tilt position change information is proportional to the image position change amount, and the ratio is fixed, the monitoring image position change amount can be determined by the pan-tilt position change information and the ratio. When the monitoring range changes due to the change in lens magnification, the monitoring image position change amount can be determined according to the specific change rule corresponding to the magnification information. When the pan-tilt rotation and the lens magnification change jointly cause the monitoring range to change, the monitoring image position change amount can be determined by combining the pan-tilt position change information determined by the pan-tilt motor step length and the specific change rule caused by the lens magnification information. When determining the monitoring image position change amount, the embodiment of the present invention does not restrict the order of the pan-tilt position change information and the lens magnification information. After determining the monitoring image position change amount, based on the third position information in the monitoring configuration information and the monitoring image position change amount, the first position information corresponding to the first monitoring image after the monitoring range changes can be determined, that is, the position information of the first monitoring image in the monitoring panorama after the monitoring range changes can be determined.
[0075] Optionally, the determining the target privacy mask based on the position matching result and the distortion information of different regions of the lens includes:
[0076] In a case where the position matching result includes that the preset privacy mask partially matches the first monitoring picture, determining an overlapping area between the preset privacy mask and the first monitoring picture;
[0077] Determining contour information corresponding to the overlapping area;
[0078] The target privacy mask is determined based on the contour information and distortion information of the contour information in the lens.
[0079] Specifically, Figure 5 is a schematic diagram of a position matching result provided by an embodiment of the present invention. After the monitoring range changes, if the preset privacy mask partially matches the first monitoring picture, the following is presented: Figure 5 When the preset privacy mask a shown is in an intersecting state with the first monitoring screen, the overlapping area a1 with the first monitoring screen can be determined from the preset privacy mask a. When the first monitoring screen and the preset privacy mask are both quadrilaterals, the overlapping area a1 is also a quadrilateral. After determining the overlapping area a1, the contour information corresponding to the overlapping area a1 is further determined. The contour information is the coordinate information of each pixel point on the border constituting the overlapping area a1 in the monitoring coordinate system. After determining the contour information, the area in the lens is distorted according to the contour information, that is, according to the coordinate information and distortion information corresponding to each pixel point in the contour information, the new coordinate information corresponding to each pixel point after distortion is determined. For example, when the lens distortion type is barrel distortion, the edge of the overlapping area a1 bulges from the center of the preset privacy mask to the edge, that is, the intersection point B1 of the outline information of the overlapping area a1 and the edge of the first monitoring screen bulges outward to point B2 after the barrel distortion of the lens, and the intersection point D1 bulges outward to point D2 after the barrel distortion of the lens, which means that the overlapping area a1 is adjusted to an irregular area consisting of point A, point B2, point C and point D2 after the barrel distortion of the lens, and the area is determined as the target privacy mask to avoid the overlapping area a1 after the lens distortion. The area beyond the overlapping area a1 is leaked due to the fixed size of the preset privacy mask. The size of the target privacy mask is automatically adjusted as the preset privacy mask is distorted in the lens, ensuring the security of the privacy area corresponding to the preset privacy mask. In addition, if the lens distortion type is pillow core distortion, the target privacy mask can be determined according to the above method, and the embodiment of the present invention is not repeated here. In the prior art, the distortion of the first monitoring image is corrected by starting the distortion correction function of the camera. However, starting the distortion correction function will increase the resource consumption of the camera and affect other functions of the camera. At the same time, when performing distortion correction, the field of view angle will be smaller, affecting the monitoring range. The embodiment of the present invention automatically adjusts the outline size of the preset privacy mask according to the distortion information corresponding to the lens area where the preset privacy mask is located. Compared with the above-mentioned distortion correction function, the resource consumption of the camera is smaller and the monitoring range is not affected.
[0080] In addition, since the preset privacy mask a and the first monitoring screen are in an intersecting state, that is, the area except the overlapping area a1 in the preset privacy mask a is outside the lens range and is not affected by the lens distortion. At the same time, the area is outside the first monitoring screen and is not monitored in the current state, which can ensure the privacy security of the area. Therefore, after the monitoring range changes, the area except the overlapping area a1 in the preset privacy mask a can be deleted, and the target privacy mask can be determined only based on the overlapping area a1.
[0081] Optionally, when determining the new coordinate information corresponding to each pixel point after distortion based on the coordinate information and distortion information corresponding to each pixel point in the contour information, in order to improve processing efficiency, multiple target pixel points can be selected from each pixel point at intervals, and the new coordinate information corresponding to each target pixel point after distortion can be determined using the coordinate information and distortion information corresponding to the target pixel points, and the target privacy mask can be determined based on the new coordinate information corresponding to each target pixel point.
[0082] Optionally, the determining the target privacy mask based on the position matching result and the distortion information of different regions of the lens includes:
[0083] When the position matching result includes that the preset privacy mask completely matches the first monitoring picture, determining a distorted privacy mask based on second position information corresponding to the preset privacy mask and distortion information in the lens where the preset privacy mask is located;
[0084] Based on matching the distorted position information corresponding to the distorted privacy mask and the first position information corresponding to the first monitoring picture, a target privacy mask after the monitoring range is changed is determined.
[0085] Optionally, the matching of the distorted position information corresponding to the distorted privacy mask and the first position information corresponding to the first monitoring picture to determine the target privacy mask after the monitoring range is changed includes:
[0086] In a case where the distorted privacy mask and the first monitoring picture completely match, determining the distorted privacy mask as the target privacy mask;
[0087] When the distorted privacy mask and the first monitoring picture partially match, an overlapping area of the distorted privacy mask and the first monitoring picture is determined as the target privacy mask.
[0088] Specifically, if the preset privacy mask completely matches the first monitoring picture, the following is presented: Figure 5When the preset privacy mask b1 or the preset privacy mask b2 shown completely falls within the first monitoring screen, the distortion information in the lens where the preset privacy mask is located can be determined from the distortion table according to the second position information corresponding to the preset privacy mask, thereby obtaining the distorted privacy mask. In addition, after the monitoring range changes, the farther the preset privacy mask is from the center of the first monitoring screen, the greater the deformation amount of the preset privacy mask. This means that if the preset privacy mask b1 is closer to the center of the first monitoring screen after the monitoring range changes, the obtained distorted privacy mask is still completely within the first monitoring screen. At this time, the distorted privacy mask can be determined as the target privacy mask. If after the monitoring range changes, the preset privacy mask b2 is far away from the center of the first monitoring screen and is at the edge of the first monitoring screen and the distortion type of the lens is barrel distortion, the distorted privacy mask and the first monitoring screen are in a crossed state, that is, the obtained distorted privacy mask will partially exceed the first monitoring screen. At this time, since the part exceeding the first monitoring screen is not within the monitoring range, privacy security can be guaranteed, and the overlapping area of the distorted privacy mask and the first monitoring screen can be determined as the target privacy mask.
[0089] In addition, if the preset privacy mask does not match the first monitoring image, the following Figure 5 When the preset privacy mask c shown falls completely outside the first monitoring screen, privacy security can be ensured because the privacy area corresponding to the preset privacy mask c is not within the monitoring range. At this time, there is no privacy area in the first monitoring screen and the preset privacy mask c can be removed.
[0090] Step 130: Output the target privacy mask.
[0091] Specifically, after the target privacy mask is determined, the target privacy mask is output to the encoding module of the camera to display the target privacy mask in the first monitoring picture.
[0092] The privacy mask processing method based on lens distortion provided in the embodiment of the present invention obtains a preset privacy mask in the lens picture, and after the monitoring range of the lens changes, the position of the preset privacy mask within the monitoring range changes, that is, the distortion information of the preset privacy mask within the monitoring range changes, and according to the monitoring configuration information of the preset privacy mask before and after the monitoring range changes, the area in the lens where the preset privacy mask is located after the monitoring range changes is determined, and the distortion information of the lens area is determined from the distortion information of different areas of the lens, and then the target privacy mask after the monitoring range changes is determined, so as to realize automatic adjustment of the target privacy mask as the monitoring range changes, avoid leakage of the privacy area, and improve the security of the privacy area.
[0093] The privacy mask processing device based on lens distortion provided by the present invention is described below. The privacy mask processing device based on lens distortion described below and the privacy mask processing method based on lens distortion described above can be referred to each other.
[0094] The embodiment of the present invention further provides a privacy mask processing device based on lens distortion. Figure 6 is a structural schematic diagram of a privacy mask processing device based on lens distortion provided by an embodiment of the present invention, such as Figure 6 As shown, the privacy mask processing device 600 based on lens distortion includes: an acquisition module 610, a determination module 620 and an output module 630, wherein:
[0095] An acquisition module 610 is used to acquire a preset privacy mask in the camera image;
[0096] A determination module 620, configured to determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes;
[0097] The output module 630 is configured to output the target privacy mask.
[0098] The privacy mask processing device based on lens distortion provided in the embodiment of the present invention obtains a preset privacy mask in the lens image. After the monitoring range of the lens changes, the position of the preset privacy mask within the monitoring range changes, that is, the distortion information of the preset privacy mask within the monitoring range changes. According to the monitoring configuration information of the preset privacy mask before and after the monitoring range changes, the area in the lens where the preset privacy mask is located after the monitoring range changes is determined, and the distortion information of the lens area is determined from the distortion information of different areas of the lens, and then the target privacy mask after the monitoring range changes is determined, so as to realize automatic adjustment of the target privacy mask as the monitoring range changes, avoid leakage of the privacy area, and improve the security of the privacy area.
[0099] Optionally, the determination module 620 is specifically configured to:
[0100] Based on the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, determine the first position information of the first monitoring picture after the monitoring range changes in the monitoring panorama;
[0101] Matching the first position information with the second position information of the preset privacy mask in the monitoring panorama to determine a position matching result between the first monitoring screen and the preset privacy mask;
[0102] The target privacy mask is determined based on the position matching result and distortion information of different areas in the lens.
[0103] Optionally, the determination module 620 is specifically configured to:
[0104] In a case where the position matching result includes that the preset privacy mask partially matches the first monitoring picture, determining an overlapping area between the preset privacy mask and the first monitoring picture;
[0105] Determining contour information corresponding to the overlapping area;
[0106] Based on the contour information and distortion information of the contour information in the lens, a target privacy mask after the monitoring range is changed is determined.
[0107] Optionally, the determination module 620 is specifically configured to:
[0108] In a case where the position matching result includes that the preset privacy mask completely matches the first monitoring picture, determining a distorted privacy mask based on second position information corresponding to the preset privacy mask and distortion information in the lens where the preset privacy mask is located;
[0109] Based on matching the distorted position information corresponding to the distorted privacy mask and the first position information corresponding to the first monitoring picture, a target privacy mask after the monitoring range is changed is determined.
[0110] Optionally, the determination module 620 is specifically configured to:
[0111] In a case where the distorted privacy mask and the first monitoring picture completely match, determining the distorted privacy mask as the target privacy mask;
[0112] When the distorted privacy mask and the first monitoring picture partially match, an overlapping area of the distorted privacy mask and the first monitoring picture is determined as the target privacy mask.
[0113] Optionally, the determination module 620 is specifically configured to:
[0114] Determine the amount of position change of the monitoring screen based on the pan / tilt position change information before and after the monitoring range changes in the monitoring configuration information and / or the zoom information of the lens;
[0115] Based on the change in the position of the monitoring screen and the third position information in the monitoring configuration information, the first position information corresponding to the first monitoring screen after the monitoring range changes is determined, and the third position information is the position information of the second monitoring screen corresponding to the preset privacy mask before the monitoring range changes in the monitoring panoramic view.
[0116] Optionally, the determination module 620 is specifically configured to:
[0117] In a case where the monitoring configuration information includes the pan / tilt position change information before and after the monitoring range changes, the pan / tilt motor step length before and after the monitoring range changes is determined as the pan / tilt position change information.
[0118] Figure 7 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the privacy mask processing method based on lens distortion, and the method includes:
[0119] Get the preset privacy mask in the camera image;
[0120] Determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes;
[0121] The target privacy mask is output.
[0122] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0123] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the privacy mask processing method based on lens distortion provided by the above methods, the method comprising:
[0124] Get the preset privacy mask in the camera image;
[0125] Determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes;
[0126] The target privacy mask is output.
[0127] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the privacy mask processing method based on lens distortion provided by the above methods is implemented, and the method includes:
[0128] Get the preset privacy mask in the camera image;
[0129] Determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes;
[0130] The target privacy mask is output.
[0131] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0132] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A privacy mask processing method based on lens distortion, characterized in that: include: Get the preset privacy mask in the camera image; Determine the target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes; The target privacy mask is output.
2. The privacy mask processing method based on lens distortion according to claim 1, characterized in that: The determining of the target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens picture and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes includes: Based on the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes, determine the first position information of the first monitoring picture after the monitoring range changes in the monitoring panorama; Matching the first position information with the second position information of the preset privacy mask in the monitoring panorama to determine a position matching result between the first monitoring screen and the preset privacy mask; The target privacy mask is determined based on the position matching result and distortion information of different areas in the lens.
3. The privacy mask processing method based on lens distortion according to claim 2, characterized in that: The determining the target privacy mask based on the position matching result and the distortion information of different regions of the lens includes: In a case where the position matching result includes that the preset privacy mask partially matches the first monitoring picture, determining an overlapping area between the preset privacy mask and the first monitoring picture; Determining contour information corresponding to the overlapping area; The target privacy mask is determined based on the contour information and distortion information of the contour information in the lens.
4. The privacy mask processing method based on lens distortion according to claim 2, characterized in that: The determining the target privacy mask based on the position matching result and the distortion information of different regions of the lens includes: In a case where the position matching result includes that the preset privacy mask completely matches the first monitoring picture, determining a distorted privacy mask based on second position information corresponding to the preset privacy mask and distortion information in the lens where the preset privacy mask is located; Based on matching the distorted position information corresponding to the distorted privacy mask and the first position information corresponding to the first monitoring picture, a target privacy mask after the monitoring range is changed is determined.
5. The privacy mask processing method based on lens distortion according to claim 4, characterized in that: The matching of the distorted position information corresponding to the distorted privacy mask and the first position information corresponding to the first monitoring picture to determine the target privacy mask after the monitoring range is changed includes: In a case where the distorted privacy mask and the first monitoring picture completely match, determining the distorted privacy mask as the target privacy mask; When the distorted privacy mask and the first monitoring picture partially match, an overlapping area of the distorted privacy mask and the first monitoring picture is determined as the target privacy mask.
6. The privacy mask processing method based on lens distortion according to any one of claims 2 to 5, characterized in that: The monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes is used to determine the first position information of the first monitoring picture in the monitoring panorama after the monitoring range changes, including: Determine the amount of position change of the monitoring screen based on the pan / tilt position change information before and after the monitoring range changes in the monitoring configuration information and / or the zoom information of the lens; Based on the change in the position of the monitoring screen and the third position information in the monitoring configuration information, the first position information corresponding to the first monitoring screen after the monitoring range changes is determined, and the third position information is the position information of the second monitoring screen corresponding to the preset privacy mask before the monitoring range changes in the monitoring panoramic view.
7. The privacy mask processing method based on lens distortion according to claim 6, characterized in that: The method further comprises: In a case where the monitoring configuration information includes the pan / tilt position change information before and after the monitoring range changes, the pan / tilt motor step length before and after the monitoring range changes is determined as the pan / tilt position change information.
8. A privacy mask processing device based on lens distortion, characterized in that: include: An acquisition module is used to acquire a preset privacy mask in the camera image; A determination module, configured to determine a target privacy mask after the monitoring range changes based on the distortion information of different areas of the lens image and the monitoring configuration information corresponding to the preset privacy mask before and after the monitoring range of the lens changes; An output module is used to output the target privacy mask.
9. 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 program, the privacy mask processing method based on lens distortion as described in any one of claims 1-7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the privacy mask processing method based on lens distortion as described in any one of claims 1 to 7 is implemented.
