Method and apparatus for shielding image region, electronic device and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FUZHOU ROCKCHIP SEMICON
- Filing Date
- 2024-03-04
- Publication Date
- 2026-08-07
AI Technical Summary
在遮挡图像上下左右的边界处理上尤其复杂,这将大大增加图像处理时间
[0008] According to the technical solution of the present invention, the target area and non-target area in the original layer corresponding to the image data are obtained, and a closed graphic occlusion layer and a closed graphic transparency layer are created according to the target area and non-target area respectively; the original layer is superimposed based on the two layers with different occlusion effects to obtain occlusion data. In the hardware module, the target area in the original layer is occluded by layer superposition processing, and the non-target area surrounding the target area is made transparent to achieve hollow occlusion of the specified area, while avoiding quantization of the specific number of pixels in the image to improve image processing efficiency.
Smart Images

Figure CN118365561B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to methods and apparatuses, electronic devices and storage media for occluding image regions. Background Technology
[0002] Most video image signal processing chips support multi-region privacy occlusion, which involves full occlusion of the entire calibrated area. For some special applications, it's necessary to implement hollow occlusion of specific regions, i.e., occluding only the border area. Currently, hardware processing to achieve this requires quantizing the specific number of pixels in the video image and calculating the occlusion border area before occlusion can be performed. Handling the top, bottom, left, and right boundaries of the occluded image is particularly complex, significantly increasing image processing time. Summary of the Invention
[0003] The present invention provides a method, apparatus, electronic device, and storage medium for occluding image regions, which can occlude the boundary portion of a specified region in image data based on hardware modules, so as to achieve hollow occlusion of the specified region and improve image processing efficiency.
[0004] In one aspect of the present invention, a method for occluding an image region is provided. The method includes: acquiring image data, wherein an original layer corresponding to the image data includes a target region corresponding to a position to be occluded and a non-target region corresponding to a non-occluded position, the target region surrounding the non-target region; creating a closed graphic occlusion layer based on the target region; creating a closed graphic transparency layer based on the non-target region; and overlaying the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer to obtain a target layer, the target layer including an occluded region corresponding to the target region and an unoccluded region corresponding to the non-target region, the occluded region surrounding the unoccluded region.
[0005] In another aspect of the present invention, an apparatus for occluding an image region is provided. The apparatus includes: a region acquisition module configured to acquire image data, wherein an original layer corresponding to the image data includes a target region corresponding to a position to be occluded and a non-target region corresponding to a non-occluded position, the target region surrounding the non-target region; a layer creation module configured to create a closed graphic occlusion layer based on the target region and a closed graphic transparency layer based on the non-target region; and a layer overlay module configured to overlay the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer to obtain a target layer, the target layer including an occluded region corresponding to the target region and an unoccluded region corresponding to the non-target region, the occluded region surrounding the unoccluded region.
[0006] In another aspect of the invention, an electronic device is provided. The electronic device includes a memory configured to store a computer program; and a processor configured to execute the computer program to perform the aforementioned method of occluding an image region.
[0007] In another aspect of the invention, a computer-readable storage medium is provided. This medium stores a computer program that is executed by a processor to implement the above-described method for occluding an image region.
[0008] According to the technical solution of the present invention, the target area and non-target area in the original layer corresponding to the image data are obtained, and a closed graphic occlusion layer and a closed graphic transparency layer are created according to the target area and non-target area respectively; the original layer is superimposed based on the two layers with different occlusion effects to obtain occlusion data. In the hardware module, the target area in the original layer is occluded by layer superposition processing, and the non-target area surrounding the target area is made transparent to achieve hollow occlusion of the specified area, while avoiding quantization of the specific number of pixels in the image to improve image processing efficiency. Attached Figure Description
[0009] Figure 1 This is a flowchart of a method for occluding an image region according to an embodiment of the present invention;
[0010] Figure 2 This is a flowchart of a method for occluding an image region according to an embodiment of the present invention;
[0011] Figure 3 This is a schematic diagram illustrating the method for occluding an image region according to an embodiment of the present invention, which achieves border occlusion.
[0012] Figure 4 This is an actual effect diagram of the border occlusion achieved in an embodiment of the present invention;
[0013] Figure 5 This is a schematic diagram of the module of the device for occluding an image region according to an embodiment of the present invention;
[0014] Figure 6 This is a schematic diagram of the module of the device for occluding an image region according to an embodiment of the present invention;
[0015] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0016] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0017] In existing technologies, most video image signal processing chips support multi-region privacy occlusion, which involves full occlusion of the entire designated area. For example, a news report might display a person but blur their face, resulting in a large-area full occlusion. For some special applications, it's necessary to achieve hollow occlusion of specific areas, i.e., occluding only the border area. For example, blurring a face but not the eyes is a large-area hollow occlusion. Currently, hardware processing to achieve this requires quantizing the specific number of pixels in the video image and calculating the occlusion border area before occlusion can be performed. Handling the top, bottom, left, and right boundaries of the occluded image is particularly complex, significantly increasing image processing time.
[0018] To address at least the aforementioned technical problems, this disclosure provides a method for occluding image regions. According to embodiments of this disclosure, a target region and a non-target region of the original layer corresponding to the image data are obtained. A closed graphic occlusion layer and a closed graphic transparency layer are created based on the target region and the non-target region, respectively. The original layer is then overlaid based on the two layers with different occlusion effects to obtain occlusion data. In this way, in the hardware module, the target region in the original layer is occluded by layer overlay processing, and the non-target region surrounding the target region is made transparent, thereby achieving hollow occlusion of the specified region while avoiding the quantization of the specific pixel count of the image to improve image processing efficiency.
[0019] According to embodiments of this disclosure, on the basis of hardware with regional privacy occlusion function, a privacy occlusion area and a hollow transparent area that serves as another occlusion area are overlapped together. By performing alpha superposition on the hollow transparent area, the effect of the middle part of the occlusion area being hollow and transparent is achieved, thereby enabling hollow occlusion of any area achieved by privacy occlusion.
[0020] In the following, the technical solutions according to this disclosure will be described with reference to specific embodiments and in conjunction with the accompanying drawings.
[0021] Figure 1 This is a flowchart illustrating a method 100 for occluding an image region according to an embodiment of the present disclosure. (Refer to...) Figure 1 The method 100 includes the following steps 102 to 108.
[0022] In step 102, image data is acquired. The original layer corresponding to the image data includes a target region corresponding to the position to be occluded and a non-target region corresponding to the position not occluded. The target region surrounds the non-target region.
[0023] In some embodiments, before acquiring image data, the method further includes: locating the target object to be occluded in the image data using a preset target recognition algorithm, marking the location of the target object as the occlusion location, and marking the region in the image data containing the target object as the target region based on the occlusion location and a preset first range. In this way, target object recognition is performed based on the preset target recognition algorithm in the hardware module, thereby determining the target region that needs to be selected and achieving occlusion processing of the specified target object.
[0024] In some embodiments, before acquiring image data, the method further includes: acquiring a preset target area in the image data and marking a preset position in the target area as a position to be occluded.
[0025] In some embodiments, before acquiring image data, the method further includes: determining a non-occluded position surrounded by a target region based on the position to be occluded, and marking a non-target region in the target region based on the non-occluded position and a preset second range.
[0026] In step 104, a closed graphic occlusion layer is created based on the target area.
[0027] In step 106, a closed graphic transparency layer is created based on the non-target area.
[0028] In some embodiments, creating a closed graphic occlusion layer based on a target region includes: creating a closed graphic occlusion layer covering the target region using a preset region occlusion algorithm. Creating a transparent layer based on a non-target region includes: creating a closed graphic transparent layer covering the non-target region using a region occlusion algorithm. The layer priority of the closed graphic transparent layer is higher than that of the closed graphic occlusion layer. In this way, based on the preset region occlusion algorithm in the hardware module, closed graphic occlusion layers and closed graphic transparent layers are created separately for different regions. The superposition of the closed graphic occlusion layers and the closed graphic transparent layers achieves an occlusion effect, while the closed image transparent layer surrounded by the occlusion layer has no occlusion effect. This occlusion method can achieve hollow occlusion without requiring algorithm design and modification to the hardware module that already has region occlusion functionality, simplifying the hardware design process. Furthermore, it eliminates the need to quantize the specific number of pixels in the image, effectively improving image processing efficiency.
[0029] In step 108, the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer are overlaid to obtain the target layer. The target layer includes the occluded area corresponding to the target area and the unoccluded area corresponding to the non-target area, with the occluded area surrounding the unoccluded area.
[0030] In some embodiments, overlaying the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer to obtain the target layer includes: using the original layer as the background layer, and overlaying the background layer, the closed graphic occlusion layer, and the closed graphic transparency layer using an Alpha overlay algorithm to obtain the target layer; the background layer has the lowest overlay priority, and the closed graphic transparency layer has the highest overlay priority. In this way, after the Alpha overlay algorithm overlays layers with different transparency, the layer with lower transparency will show through the layer with higher transparency, thus forming a new image; using the background layer as the lowest overlay priority layer, overlaying the closed graphic occlusion layer and the closed graphic transparency layer on the background layer achieves different display effects, that is, hollow occlusion is achieved through the combination of overlaying the closed graphic occlusion layer and the closed graphic transparency layer.
[0031] In some embodiments, the method may further include: setting the transparency of the closed graphic transparency layer to a fully transparent state using an Alpha overlay algorithm. In this way, since layers with low transparency will show through layers with high transparency in the Alpha overlay algorithm, setting the transparency of the transparency layer to a fully transparent state is equivalent to the transparency layer overlaid on the background layer not existing, thus achieving the display of non-target areas in the background layer.
[0032] In some embodiments, the method may further include: configuring the display priorities of the closed graphic occlusion layer and the closed graphic transparency layer respectively, wherein the display priority of the closed graphic transparency layer is higher than that of the closed graphic occlusion layer. In this way, during the hardware module's implementation of image display, when multiple closed graphic occlusion layers overlap, the display priority of each closed graphic occlusion layer needs to be pre-configured to avoid display errors.
[0033] In some embodiments, the method may further include: performing display processing on the target layer according to display priority. In this way, if the display priority is the highest, then during display processing, only the occlusion effect of the layer with the highest priority is displayed, and the occlusion effects of the other layers are all disabled without making any changes to the original layers. Thus, by configuring the display priority of each layer, different occlusion effects can be achieved without redesigning or modifying the hardware module.
[0034] In some embodiments, the closed graphic transparent layer has the highest display priority. In this way, if the closed graphic transparent layer has the highest display priority, when the closed graphic transparent layer and the closed graphic occlusion layer are superimposed in the same area, the image will prioritize displaying the occlusion effect of the closed graphic transparent layer, that is, directly displaying the background layer, and not displaying the occlusion effect of the closed graphic occlusion layer. Thus, a hollow occlusion effect can be achieved when the areas of the occlusion layer and the transparent layer are different.
[0035] Figure 2 This is a flowchart of method 200 for occluding an image region. (See attached flowchart.) Figure 2 The method 200 includes the following steps 202 to 210.
[0036] In step 202, image data is received.
[0037] In some embodiments, image data includes video data or graphic data.
[0038] In step 204, the target object to be occluded in the image data is found based on the preset target recognition algorithm, and the position of the target object is marked as the occlusion position.
[0039] In step 206, a first range is configured using preset parameters. The target area is marked in the image data with the location to be occluded as the center and the first range as the boundary. At the same time, the non-occluded location is searched in the target area.
[0040] In some embodiments, the target area includes at least one complete target object.
[0041] In some embodiments, if multiple target objects overlap, contour boundary data of multiple target objects can be determined, and a first range can be configured based on the contour boundary data of multiple target objects, thereby enabling multiple target objects in the image data to simultaneously correspond to a target region.
[0042] In step 208, a second range is configured using preset parameters. The non-target area is marked in the target area with the unobstructed position as the center and the second range as the boundary. The target area surrounds the non-target area.
[0043] In some embodiments, the position to be occluded and the position not occluded may be set to overlap, and the second range is smaller than the first range.
[0044] In step 210, a closed graphic occlusion layer covering the target area is created, and the stacking priority of the closed graphic occlusion layer is set to the middle layer, wherein the stacking priority is: lowest layer < middle layer < highest layer.
[0045] In some embodiments, the shape of the closed graphic occlusion layer depends on the boundary shape of the target area.
[0046] In step 212, a closed graphic transparency layer is created to cover the non-target area, and the overlay priority of the closed graphic transparency layer is set to the highest level, and its display priority is set to the highest level.
[0047] In step 214, the original layer is used as the background layer, and the overlay priority of the background layer is set to the lowest level.
[0048] In step 216, after setting the transparency of the closed graphic transparent layer to full transparency using the Alpha overlay algorithm, the background layer, the closed graphic occlusion layer, and the set closed graphic transparent layer are overlaid to obtain the target layer, in which the occluded area surrounds the unoccluded area.
[0049] In some embodiments, the corresponding alpha superposition formula can be selected according to the needs of the actual application scenario. Taking a 4-bit alpha width as an example, for the Y component in a YCbCr image (a color space where Y represents the luminance component, Cb represents the blue chromaticity component, and Cr represents the red chromaticity component), the superposition formula can be expressed as:
[0050] Y'=((Y*Alpha)+((16-Alpha)*Y))>>4;
[0051] Here, Y represents the pixel value in the image data, and Y' represents the pixel value output after Alpha overlay. Alpha is used to adjust the overlay transparency. When the value of Alpha is set to 0, it means that the transparency layer is set to a fully transparent state, and Y' = Y. In the overlay formula, >>4 means shifting right by four bits. Since Alpha is 4 bits wide, Y is amplified after multiplying Y and Alpha. Therefore, it is necessary to shift right by four bits at the end to complete the normalization operation and restore the value range of Y.
[0052] It should be noted that the overlay transparency can be adjusted from 0% to 100% using the Alpha parameter.
[0053] In step 218, the target layer is processed for display according to the display priority and then input into the display device.
[0054] In some embodiments, the method of occluding the image area described above can be used to achieve scenarios such as border marking of moving objects in video data.
[0055] In some embodiments, step 204 in the above-described method 200 for occluding an image region can be replaced by: the image data includes a preset target region, the preset target region in the image data is obtained, and a preset position in the target region is marked as a position to be occluded. In this case, the above-described method 200 for occluding data can be used to occlude sensitive words around video subtitles and billboards. Specifically, the display position of the subtitles / billboards in the video data is fixed, so the display position of the subtitles in the video data can be determined as the target region. Simultaneously, the area around the subtitles or billboards is marked as a position to be occluded, and the entire subtitle is occluded using a closed graphic occlusion layer. Based on the position to be occluded, the subtitles or billboards are marked as non-occluded positions. Based on the non-occluded positions and the size range of the subtitle font / billboard, the subtitles / billboards are determined as non-target regions. The subtitles / billboards are displayed using a closed graphic transparency layer, effectively occluding sensitive words around the subtitles / billboards.
[0056] Figure 3 This is a schematic diagram illustrating method 200 for occluding image regions, specifically border occlusion. (See reference...) Figure 3 In the diagram, L0 represents the background layer, L1 represents the closed shape occlusion layer, and L2 represents the closed shape transparency layer. L0 is the bottom layer, L1 is the middle layer, and L2 is the top layer.
[0057] In some embodiments, if a border occlusion is to be applied to a target object, the first range can be set to a rectangle using preset parameter software, so that the boundary shape of the target area is a rectangle, and the shape of the closed graphic occlusion layer L1 corresponding to the target area is also a rectangle.
[0058] In some embodiments, the second range is set to a rectangle by a preset parameter software, so that the boundary shape of the target area is a rectangle, and the shape of the closed graphic transparent layer L2 corresponding to the non-target area is also a rectangle.
[0059] Because the second range is smaller than the first range, the area of the closed graphic transparent layer L2 is smaller than the area of the closed graphic occlusion layer L1, resulting in a difference in the areas covered by L1 and L2. Simultaneously, due to the difference in transparency between L1 and L2, a portion of the area covered by L1 cannot be displayed through L2; therefore, this portion is occluded by L1, creating a border occlusion effect. That is, the border occlusion area = closed graphic occlusion layer L1 - closed graphic transparent layer L2.
[0060] Figure 4 This image shows the actual effect of achieving border occlusion. Figure 4 Point A in the middle is the area obscured by the border.
[0061] According to another aspect of the invention, Figure 5This is a schematic diagram of a module illustrating a device 300 for occluding an image region according to an embodiment of the present invention. (Refer to...) Figure 5 The device 300 includes a region acquisition module 302, a layer creation module 304, and a layer overlay module 306. The region acquisition module 302 is configured to acquire image data. The original layer corresponding to the image data includes a target region at the location to be occluded and a non-target region within the target region that is not occluded, with the target region surrounding the non-target region. The layer creation module 304 is configured to create a closed graphic occlusion layer based on the target region and a closed graphic transparency layer based on the non-target region. The layer overlay module 306 is configured to overlay the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer to obtain a target layer. The target layer includes an occluded region corresponding to the target region and an unoccluded region corresponding to the non-target region, with the occluded region surrounding the unoccluded region.
[0062] Figure 6 This is a schematic diagram of a module illustrating a device 300 for occluding an image region according to an embodiment of the present invention. (Refer to...) Figure 6 In some embodiments, the device 300 further includes a display processing module 308. The display processing module 308 is configured to configure the display priorities of the closed graphic occlusion layer and the closed graphic transparency layer, respectively. Further, the display processing module 308 is also configured to perform display processing on the target layer according to the display priority.
[0063] According to another aspect of the invention, Figure 7 This is a schematic diagram illustrating an electronic device 400 according to an embodiment of the present invention. (Refer to...) Figure 7 The electronic device 400 includes a memory 402, a processor 404, and a computer program stored in the memory 402 and executable on the processor. When the processor 404 executes the computer program, it implements the various steps of the method for occluding an image region as described above.
[0064] According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program that is executed by a processor to implement the method for filtering unwanted information as described above.
[0065] In summary, the method, apparatus, electronic device, and storage medium for occluding image regions provided by this invention are based on a hardware module that supports region occlusion. They create a low-transparency closed graphic occlusion layer and a high-transparency closed graphic transparency layer based on the target region and non-target region in the original layer corresponding to the image data, respectively. Then, an Alpha overlay algorithm is used to overlay the closed graphic occlusion layer and the closed graphic transparency layer on the original layer, allowing the original layer within the closed graphic transparency layer to be displayed within the closed graphic occlusion layer. This eliminates the need to update the original design algorithm of the hardware module; only a corresponding Alpha overlay algorithm needs to be designed to achieve hollow occlusion of image data. The implementation is simple, fast, and low-cost. If the hardware module supports multi-region occlusion and the Alpha overlay algorithm, no modification to the hardware module is required to directly implement the hollow occlusion function, saving on the hardware module's production and design process.
[0066] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for occluding an image region, applied to a hardware module with regional privacy occlusion functionality, characterized in that, include: Image data is acquired, and the original layer corresponding to the image data includes a target region corresponding to the position to be occluded and a non-target region corresponding to the position not occluded, wherein the target region surrounds the non-target region; A closed graphic occlusion layer covering the target area is created using a preset region occlusion algorithm. The region occlusion algorithm is used to create a closed, transparent graphic layer that covers the non-target area. as well as The target layer is obtained by overlaying the original layer, the closed shape occlusion layer, and the closed shape transparency layer. The layer priority of the closed shape transparency layer is higher than that of the closed shape occlusion layer. The target layer includes an occluded area corresponding to the target area and an unoccluded area corresponding to the non-target area. The occluded area surrounds the unoccluded area. The process of overlaying the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer to obtain the target layer includes: using the original layer as the background layer, and overlaying the background layer, the closed graphic occlusion layer, and the closed graphic transparency layer using an Alpha overlay algorithm to obtain the target layer, wherein the background layer has the lowest overlay priority, the closed graphic transparency layer has the highest overlay priority, and the transparency of the closed graphic transparency layer is set to a fully transparent state.
2. The method according to claim 1, characterized in that, Before acquiring the image data, the process also includes: The image data is searched for the target object to be occluded using a preset target recognition algorithm, and the location of the target object is marked as the occlusion location; and The region in the image data that includes the target object is marked as the target region based on the position to be occluded and the preset first range.
3. The method according to claim 1, characterized in that, Before acquiring the image data, the process also includes: The preset target region in the image data is obtained and the preset position in the target region is marked as the position to be occluded.
4. The method according to claim 2 or 3, characterized in that, Before acquiring the image data, the process also includes: Determine the unobstructed position surrounded by the target area based on the position to be obstructed; The non-target area is marked according to the unobstructed position and the preset second range.
5. The method according to claim 1, characterized in that, Also includes: Configure the display priorities of the closed graphic occlusion layer and the closed graphic transparency layer respectively, with the display priority of the closed graphic transparency layer being higher than that of the closed graphic occlusion layer.
6. The method according to claim 5, characterized in that, Also includes: The target layer is displayed according to the display priority.
7. The method according to claim 5, characterized in that, The display priority of the closed graphic transparent layer is the highest.
8. A device for occluding an image region, characterized in that, include: The region acquisition module is configured to acquire image data, and the original layer corresponding to the image data includes a target region corresponding to the position to be occluded and a non-target region corresponding to the position not occluded, wherein the target region surrounds the non-target region; The layer creation module is configured to create a closed graphic occlusion layer covering the target area using a preset area occlusion algorithm, and to create a closed graphic transparent layer covering the non-target area using the same area occlusion algorithm. as well as The layer overlay module is configured to overlay the original layer, the closed graphic occlusion layer, and the closed graphic transparency layer to obtain a target layer. The layer priority of the closed graphic transparency layer is higher than that of the closed graphic occlusion layer. The target layer includes an occluded area corresponding to the target area and an unoccluded area corresponding to the non-target area, with the occluded area surrounding the unoccluded area. The layer overlay module is configured to use the original layer as the background layer, and to overlay the background layer, the closed graphic occlusion layer, and the closed graphic transparency layer using an Alpha overlay algorithm to obtain the target layer. The background layer has the lowest overlay priority, the closed graphic transparency layer has the highest overlay priority, and the transparency of the closed graphic transparency layer is set to full transparency.
9. The apparatus according to claim 8, characterized in that, Also includes: The display processing module is configured to configure the display priorities of the closed graphic occlusion layer and the closed graphic transparency layer, respectively.
10. The apparatus according to claim 9, characterized in that, The display processing module is further configured to perform display processing on the target layer according to the display priority.
11. An electronic device, characterized in that, include: The memory is configured to store executable programs; as well as A processor is configured to execute the program to perform the method according to any one of claims 1 to 7.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
User interface display method and device, equipment and medium
CN110928464A