Image anonymization method and device, image de-anonymization method and device and electronic equipment
By dividing the sub-region to be anonymous in the image processing and performing pixel value exchange, combined with recording and exchanging operation information, the problem of difficult image anonymization processing in the prior art is solved, and efficient anonymization processing and restoration effects are achieved.
Patent Information
- Application Number
- CN202411863741.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-17
AI Technical Summary
While implementing image anonymization processing, it is difficult to accurately restore the anonymized image, and the time-consuming and effective of the anonymization processing are difficult to balance.
By determining the rectangular image area to be anonymous in the original image, dividing the anonymous area according to the rectangular grid of the size to be used, selecting the anonymous sub-region for pixel value exchange, and recording the exchange operation information to achieve deanonymization.
While anonymizing images, the anonymized image can be accurately restored, and the time-consuming and effect of the anonymized process is effectively balanced.
Smart Images

Figure CN119862601A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image anonymization method, an image de-anonymization method, a device and an electronic device. Background Art
[0002] In order to effectively protect privacy, it is often necessary to anonymize designated objects in an image (such as a person's face or a license plate). For example, traditional anonymization methods (such as mosaic or Gaussian blur) can be used for anonymization. In this way, the information of the anonymized image area is completely lost and cannot be restored. Alternatively, deep learning-based anonymization methods (such as generative adversarial networks and diffusion models) can be used for anonymization. In this way, the anonymized image area can be restored to a certain extent, but there is still information loss, and the restored image is still different from the original image. Therefore, how to achieve image anonymization while ensuring that the anonymized image can be accurately restored has become an urgent problem to be solved. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide an image anonymization method, an image de-anonymization method, a device and an electronic device, so as to realize image anonymization processing while ensuring that the anonymized image can be accurately restored later, and can effectively balance the time consumption of anonymization processing and the effect of anonymization processing. The specific technical solution is as follows:
[0004] In a first aspect of an embodiment of the present application, a method for anonymizing an image is provided, the method comprising:
[0005] Determine a rectangular image region to be anonymized in the original image to obtain the region to be anonymized;
[0006] According to the rectangular grid of the current size to be used, the current area to be divided including the area to be anonymized is divided to obtain a plurality of sub-areas to be anonymized with the same size; at least one group of sub-areas to be anonymized is selected from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative positions are exchanged to obtain an anonymized image; wherein a group of sub-areas to be anonymized includes two sub-areas to be anonymized; and the current size to be used is positively correlated with the size of the area to be anonymized;
[0007] Recording exchange operation information for de-anonymizing the anonymized image; wherein the exchange operation information includes: a correspondence between two sub-regions to be anonymized for pixel value exchange.
[0008] Optionally, the current size to be used is calculated based on the current reference grid size;
[0009] The method includes dividing the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used to obtain a plurality of sub-areas to be anonymized with the same size; selecting at least one group of sub-areas to be anonymized from the current sub-areas to be anonymized; and for each group of sub-areas to be anonymized currently selected, exchanging the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group that have the same relative positions, to obtain an anonymized image, including:
[0010] Dividing the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used, to obtain a plurality of sub-areas to be anonymized with the same size;
[0011] Select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, exchange the current pixel values at the pixel positions with the same relative positions in two sub-regions to be anonymized in the group, so as to complete this round of anonymization processing;
[0012] The size of the current reference grid is adjusted, and the step of returning to executing the step of dividing the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used to obtain a plurality of sub-areas to be anonymized of the same size is obtained; until the number of rounds of anonymization processing reaches a first number, an anonymized image is obtained; the exchange operation information also includes the area to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing.
[0013] Optionally, the step of selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; and for each group of sub-regions to be anonymized currently selected, exchanging current pixel values at pixel positions of two sub-regions to be anonymized in the group that have the same relative position, comprises:
[0014] Select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized;
[0015] For each currently selected group of sub-regions to be anonymized, the current pixel values at the pixel positions with the same relative position in two sub-regions to be anonymized in the group are exchanged to complete the current pixel value exchange; and the step of selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized is returned to be executed until the number of pixel value exchanges reaches the second number;
[0016] For each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the anonymization process, and the order of each pixel value exchange during the anonymization process.
[0017] Optionally, the current size to be used is the product of the coefficient to be used and the current reference grid size; the coefficient to be used is the ratio of the smaller value of the width and the height of the area to be anonymized to the number of reference grids.
[0018] Optionally, determining a rectangular image region to be anonymized in the original image to obtain the region to be anonymized includes:
[0019] Detecting the object to be anonymized in the original image, and obtaining a rectangular image area where the object to be anonymized is located as the area to be processed;
[0020] In the case that there is a portion that does not belong to the original image in the area to be processed, the portion of the area to be processed that belongs to the original image is determined as the area to be anonymized.
[0021] Optionally, when the width of the to-be-anonymized area is divisible by the width of the current rectangular grid of the size to be used, and the height of the to-be-anonymized area is divisible by the height of the current rectangular grid of the size to be used, the current to-be-divided area is the to-be-anonymized area;
[0022] In the case where the width of the region to be anonymized cannot be divided by the width of the current rectangular grid of the size to be used, the current region to be divided is obtained by expanding the region to be anonymized in the direction where the width of the region to be anonymized is located according to the remainder of the width of the region to be anonymized divided by the width of the current rectangular grid of the size to be used;
[0023] In the case where the height of the area to be anonymized cannot be divided by the height of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height of the current rectangular grid of the size to be used.
[0024] According to a second aspect of the embodiments of the present application, a method for de-anonymizing an image is provided, the method comprising:
[0025] Acquire an anonymized image and corresponding exchange operation information; wherein the anonymized image and the corresponding exchange operation information are obtained by performing anonymization processing on the original image based on any method described in the first aspect above;
[0026] The current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship and are recorded in the exchange operation information are exchanged to de-anonymize the anonymized image to obtain the original image.
[0027] Optionally, the anonymized image is obtained by performing multiple rounds of anonymization processing on the original image; the exchange operation information further includes: the sub-regions to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing;
[0028] Exchanging the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information to de-anonymize the anonymized image to obtain the original image, including:
[0029] According to the reverse order of the order between each round of anonymization processing recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that are involved in each round of anonymization processing recorded in the exchange operation information and have a corresponding relationship are exchanged in sequence, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image.
[0030] Optionally, each round of anonymization processing includes multiple pixel value exchanges; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order of each pixel value exchange during the round of anonymization processing;
[0031] Each round of de-anonymization process includes:
[0032] According to the reverse order of the order of each pixel value exchange in the anonymization process corresponding to the round of de-anonymization process recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized and having a corresponding relationship involved in each pixel value exchange in the anonymization process are exchanged in sequence.
[0033] Optionally, the anonymized image is obtained by performing a round of anonymization processing on the original image, and the round of anonymization processing includes multiple pixel value exchanges; the exchange operation information also includes the sub-region to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order of each pixel value exchange during the round of anonymization processing;
[0034] Exchanging the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information to de-anonymize the anonymized image to obtain the original image, including:
[0035] In the reverse order of the order between each pixel value exchange recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that are involved in each pixel value exchange recorded in the exchange operation information and have a corresponding relationship are exchanged in sequence to de-anonymize the anonymized image to obtain the original image.
[0036] According to a third aspect of the embodiments of the present application, there is also provided an image anonymization device, the device comprising:
[0037] A region determination module is used to determine a rectangular image region to be anonymized in the original image to obtain the region to be anonymized;
[0038] The anonymization processing module is used to divide the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used, so as to obtain a plurality of sub-areas to be anonymized with the same size; select at least one group of sub-areas to be anonymized from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, exchange the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative position, so as to obtain an anonymized image; wherein a group of sub-areas to be anonymized includes two sub-areas to be anonymized; and the current size to be used is positively correlated with the size of the area to be anonymized;
[0039] The information recording module is used to record the exchange operation information used to de-anonymize the anonymized image; wherein the exchange operation information includes: the correspondence between the two sub-regions to be anonymized for pixel value exchange.
[0040] Optionally, the current size to be used is calculated based on the current reference grid size;
[0041] The anonymization processing module includes:
[0042] A region division submodule, used for dividing the current region to be divided including the region to be anonymized according to the rectangular grid of the current size to be used, to obtain a plurality of sub-regions to be anonymized with the same size;
[0043] The anonymization processing submodule is used to select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, the current pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent are exchanged to complete this round of anonymization processing;
[0044] The size adjustment module is used to adjust the size of the current reference grid and trigger the area division submodule; until the number of rounds of anonymization processing reaches a first number, an anonymized image is obtained; the exchange operation information also includes the to-be-anonymized area involved in each round of anonymization processing, and the order between each round of anonymization processing.
[0045] Optionally, the anonymization processing submodule is specifically used to select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each currently selected group of sub-regions to be anonymized, exchange the current pixel values at the pixel positions with the same relative positions between two sub-regions to be anonymized in the group to complete this pixel value exchange; and return to execute the step of selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized until the number of pixel value exchanges reaches a second number; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing.
[0046] Optionally, the current size to be used is the product of the coefficient to be used and the current reference grid size; the coefficient to be used is the ratio of the smaller value of the width and the height of the area to be anonymized to the number of reference grids.
[0047] Optionally, the region determination module is specifically used to detect the object to be anonymized in the original image, and obtain the rectangular image region where the object to be anonymized is located as the region to be processed; when there is a part that does not belong to the original image in the region to be processed, the part of the region to be processed that belongs to the original image is determined as the region to be anonymized.
[0048] Optionally, when the width of the to-be-anonymized area is divisible by the width of the current rectangular grid of the size to be used, and the height of the to-be-anonymized area is divisible by the height of the current rectangular grid of the size to be used, the current to-be-divided area is the to-be-anonymized area;
[0049] In the case where the width of the region to be anonymized cannot be divided by the width of the current rectangular grid of the size to be used, the current region to be divided is obtained by expanding the region to be anonymized in the direction where the width of the region to be anonymized is located according to the remainder of the width of the region to be anonymized divided by the width of the current rectangular grid of the size to be used;
[0050] In the case where the height of the area to be anonymized cannot be divided by the height of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height of the current rectangular grid of the size to be used.
[0051] According to a fourth aspect of the embodiments of the present application, there is further provided an image de-anonymization device, the device comprising:
[0052] A data acquisition module, used to acquire an anonymized image and corresponding exchange operation information; wherein the anonymized image and the corresponding exchange operation information are obtained by anonymizing the original image based on any method described in the first aspect above;
[0053] The de-anonymization processing module is used to exchange the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
[0054] Optionally, the anonymized image is obtained by performing multiple rounds of anonymization processing on the original image; the exchange operation information further includes: the sub-regions to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing;
[0055] The de-anonymization processing module is specifically used to exchange the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that are involved in each round of anonymization processing recorded in the exchange operation information and have a corresponding relationship in reverse order of the order between the rounds of anonymization processing recorded in the exchange operation information, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image.
[0056] Optionally, each round of anonymization processing includes multiple pixel value exchanges; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order of each pixel value exchange during the round of anonymization processing;
[0057] Each round of de-anonymization process includes:
[0058] According to the reverse order of the order of each pixel value exchange in the anonymization process corresponding to the round of de-anonymization process recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized and having a corresponding relationship involved in each pixel value exchange in the anonymization process are exchanged in sequence.
[0059] Optionally, the anonymized image is obtained by performing a round of anonymization processing on the original image, and the round of anonymization processing includes multiple pixel value exchanges; the exchange operation information also includes the sub-region to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order of each pixel value exchange during the round of anonymization processing;
[0060] The de-anonymization processing module is specifically used to sequentially exchange the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized that are involved in each pixel value exchange recorded in the exchange operation information and have a corresponding relationship, in the reverse order of the order between the pixel value exchanges recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
[0061] In another aspect of the embodiments of the present application, an electronic device is provided, including:
[0062] Memory, used to store computer programs;
[0063] The processor is used to implement any method described in the first aspect or any method described in the second aspect when executing a program stored in the memory.
[0064] In another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, it implements any method described in the first aspect or any method described in the second aspect.
[0065] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect or any of the methods described in the second aspect.
[0066] Beneficial effects of the embodiments of the present application:
[0067] An image anonymization method provided by an embodiment of the present application can determine a rectangular image area to be anonymized in an original image to obtain the area to be anonymized; divide the current area to be divided including the area to be anonymized according to a rectangular grid of a current size to be used to obtain a plurality of sub-areas to be anonymized with the same size; select at least one group of sub-areas to be anonymized from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, exchange the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative position to obtain an anonymized image; wherein a group of sub-areas to be anonymized includes two sub-areas to be anonymized; the current size to be used is positively correlated with the size of the area to be anonymized; and record exchange operation information for de-anonymizing the anonymized image; wherein the exchange operation information includes: the corresponding relationship between the two sub-areas to be anonymized for the pixel value exchange.
[0068] Based on the above processing, the rectangular image area to be anonymized in the original image can be determined to obtain the area to be anonymized. The size to be used can be calculated according to the size of the area to be anonymized, so as to divide the area to be divided containing the area to be anonymized according to the rectangular grid of the size to be used, and obtain multiple sub-areas to be anonymized. And the pixel values of each group of sub-areas to be anonymized selected from the sub-areas to be anonymized can be exchanged to disrupt the position of the pixel values in the area to be anonymized, so that the image information in the area to be anonymized cannot be identified, that is, the anonymization processing of the image to be anonymized is realized to obtain the anonymized image. Furthermore, the corresponding relationship between the two sub-areas to be anonymized for the pixel value exchange (that is, the exchange operation information) can be recorded, and the position of the pixel value in the anonymized image can be restored later according to the recorded exchange operation information, so as to realize the de-anonymization of the anonymized image and obtain the original image.
[0069] Since exchanging pixel values in the sub-region to be anonymized only changes the position of the pixel values in the region to be anonymized, it will not cause the loss of pixel values, nor will it cause the loss of image information. Therefore, the position of the pixel values in the anonymized image is restored according to the recorded exchange operation information, so that the lossless restoration of the anonymized image can be achieved. And the size to be used is positively correlated with the size of the region to be anonymized, and correspondingly, the size of the sub-region to be anonymized is also positively correlated with the size of the region to be anonymized. That is, the size of the sub-region to be anonymized obtained by adaptively adjusting the size of the region to be anonymized can avoid the size of the sub-region to be anonymized being too small when the region to be anonymized is large, resulting in an increase in the time spent on the anonymization process, and avoid the size of the sub-region to be anonymized being too large when the region to be anonymized is small, resulting in a poor anonymization process. In this way, while realizing the anonymization process of the image, it can be ensured that the anonymized image can be accurately restored later, and the time spent on the anonymization process and the effect of the anonymization process can be effectively balanced.
[0070] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0072] Figure 1 A schematic diagram of a first process flow of the image anonymization method provided in an embodiment of the present application;
[0073] Figure 2 A second flow chart of the image anonymization method provided in the embodiment of the present application;
[0074] Figure 3 A third flow chart of the image anonymization method provided in the embodiment of the present application;
[0075] Figure 4 A fourth flow chart of the image anonymization method provided in the embodiment of the present application;
[0076] Figure 5 A schematic diagram of a first process of the image de-anonymization method provided in an embodiment of the present application;
[0077] Figure 6 A second flow chart of the image de-anonymization method provided in an embodiment of the present application;
[0078] Figure 7 A schematic diagram of the structure of an image anonymization device provided in an embodiment of the present application;
[0079] Figure 8 A schematic diagram of the structure of an image de-anonymization device provided in an embodiment of the present application;
[0080] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0082] In order to effectively protect privacy, it is often necessary to anonymize designated objects in an image (such as a person's face or a license plate). For example, traditional anonymization methods (such as mosaic or Gaussian blur) can be used for anonymization. In this way, the information of the anonymized image area is completely lost and cannot be restored. Alternatively, deep learning-based anonymization methods (such as generative adversarial networks and diffusion models) can be used for anonymization. In this way, the anonymized image area can be restored to a certain extent, but there is still information loss, and the restored image is still different from the original image.
[0083] In order to achieve image anonymization processing and ensure that the anonymized image can be accurately restored later, the embodiment of the present application provides an image anonymization method, see Figure 1 , Figure 1 The first flow chart of the image anonymization method provided in the embodiment of the present application. The image anonymization method provided in the embodiment of the present application is applicable to all algorithms that require anonymization of specified objects in the image as a prerequisite. The image anonymization method provided in the embodiment of the present application can be applied to a smart door lock end or an IPC (Internet Protocol Camera) end to anonymize the collected image containing a specified object (such as a person's face). The image anonymization method may include:
[0084] Step S101: determining a rectangular image region to be anonymized in an original image to obtain the region to be anonymized.
[0085] Step S102: Divide the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used to obtain a plurality of sub-areas to be anonymized with the same size; select at least one group of sub-areas to be anonymized from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, exchange the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative positions, to obtain an anonymized image.
[0086] Among them, a group of sub-regions to be anonymized includes two sub-regions to be anonymized; and the current size to be utilized is positively correlated with the size of the region to be anonymized.
[0087] Step S103: recording exchange operation information for de-anonymizing the anonymized image.
[0088] The exchange operation information includes: the corresponding relationship between the two sub-regions to be anonymized for pixel value exchange.
[0089] Based on the above processing, the rectangular image area to be anonymized in the original image can be determined to obtain the area to be anonymized. The size to be used can be calculated according to the size of the area to be anonymized, so as to divide the area to be divided containing the area to be anonymized according to the rectangular grid of the size to be used, and obtain multiple sub-areas to be anonymized. And the pixel values of each group of sub-areas to be anonymized selected from the sub-areas to be anonymized can be exchanged to disrupt the position of the pixel values in the area to be anonymized, so that the image information in the area to be anonymized cannot be identified, that is, the anonymization processing of the image to be anonymized is realized to obtain the anonymized image. Furthermore, the corresponding relationship between the two sub-areas to be anonymized for the pixel value exchange (that is, the exchange operation information) can be recorded, and the position of the pixel value in the anonymized image can be restored later according to the recorded exchange operation information, so as to realize the de-anonymization of the anonymized image and obtain the original image.
[0090] Since exchanging pixel values in the sub-region to be anonymized only changes the position of the pixel values in the region to be anonymized, it will not cause the loss of pixel values, nor will it cause the loss of image information. Therefore, the position of the pixel values in the anonymized image is restored according to the recorded exchange operation information, so that the lossless restoration of the anonymized image can be achieved. And the size to be used is positively correlated with the size of the region to be anonymized, and correspondingly, the size of the sub-region to be anonymized is also positively correlated with the size of the region to be anonymized. That is, the size of the sub-region to be anonymized obtained by adaptively adjusting the size of the region to be anonymized can avoid the size of the sub-region to be anonymized being too small when the region to be anonymized is large, resulting in an increase in the time spent on the anonymization process, and avoid the size of the sub-region to be anonymized being too large when the region to be anonymized is small, resulting in a poor anonymization process. In this way, while realizing the anonymization process of the image, it can be ensured that the anonymized image can be accurately restored later, and the time spent on the anonymization process and the effect of the anonymization process can be effectively balanced.
[0091] It can be seen that the embodiment of the present application provides a restorable image anonymization method that can meet real-time requirements and has low resource consumption, and has high feasibility of implementation.
[0092] For step S101, the original image may be an image that currently needs to be anonymized. For example, the original image may contain a designated object that needs to be anonymized (also referred to as an object to be anonymized), such as a person's face or a license plate. The type of the original image may be set as needed and is not specifically limited. For example, the original image may be an RGB (Red Green Blue) image or a NIR (Near Infrared) image. A rectangular image area to be anonymized in the original image may be determined, such as a rectangular image area where a designated object is located. Further, based on the determined rectangular image area, the area to be anonymized may be obtained.
[0093] In one embodiment, see Figure 2 , Figure 2 A second flow chart of the image anonymization method provided in the embodiment of the present application. Step S101 includes:
[0094] Step S1011: Detect the object to be anonymized in the original image, and obtain a rectangular image area where the object to be anonymized is located as the area to be processed.
[0095] Step S1012: when there is a portion that does not belong to the original image in the area to be processed, the portion of the area to be processed that belongs to the original image is determined as the area to be anonymized.
[0096] In an embodiment of the present application, the object to be anonymized in the original image can be detected to determine the ROI (Region of Interest) in the original image, that is, the rectangular image area where the object to be anonymized is located (i.e., the area to be processed). For example, the target detection algorithm for the object to be anonymized can be used to perform target detection on the original image to obtain the coordinate information of the area to be processed. For example, the coordinate information may include the pixel coordinates of the upper left corner vertex and the pixel coordinates of the lower right corner vertex of the area to be processed, and the target detection algorithm may be R-CNN (Region-based Convolutional Neural Networks) or YOLO (a target detection algorithm). For example, the original image is an image containing a person's face. The target detection algorithm for the person's face can obtain the coordinate information of the rectangular image area where the person's face is located, and obtain the person's face ROI, that is, the area to be processed.
[0097] Since the object to be anonymized in the original image is incomplete, the rectangular image area where the complete object to be anonymized is located will be predicted during detection as the area to be processed. Therefore, the area to be processed obtained in this case will exceed the original image. For example, the pixel coordinates of the vertices of the detected area to be processed are negative or greater than the image resolution. That is, there are parts in the area to be processed that do not belong to the original image. And since only the object to be anonymized in the original image needs to be anonymized, only the part of the area to be processed that belongs to the original image can be determined as the area to be anonymized. When the areas to be processed all belong to the original image, the area to be anonymized is the area to be processed.
[0098] In one implementation, the pixel coordinates of the vertices of the area to be processed may be processed for effective values to obtain the pixel coordinates of the vertices of the area to be anonymized. For example, the pixel coordinates of the top left corner vertex of the area to be processed are , the pixel coordinates of the lower right vertex are , the effective value can be processed according to the following formula to obtain the pixel coordinates of the upper left corner vertex of the area to be anonymized and the pixel coordinates of the lower right vertex :
[0099]
[0100]
[0101]
[0102]
[0103] in, Indicates the width of the original image. Indicates the height of the original image.
[0104] Based on the above processing, it can be ensured that the area to be anonymized belongs to the original image, that is, the validity of the area to be anonymized can be guaranteed. Accordingly, the validity of the subsequent anonymization processing based on the area to be anonymized can be guaranteed. In this way, it can be further ensured that while the image anonymization processing can be achieved, the anonymized image can be accurately restored later.
[0105] For step S102 and step S103, the size to be used can be calculated according to the size of the area to be anonymized, and the size to be used can be positively correlated with the size of the area to be anonymized. In this way, the size of the sub-area to be anonymized obtained by the division can be adaptively adjusted according to the size of the area to be anonymized. It is also possible to avoid the situation where the size of the sub-area to be anonymized is too small when the area to be anonymized is large, resulting in an increase in the time spent on the anonymization process, and to avoid the situation where the size of the sub-area to be anonymized is too large when the area to be anonymized is small, resulting in a poor anonymization process. It is possible to effectively balance the time spent on the anonymization process and the effect of the anonymization process. That is, while achieving effective image anonymization processing, the time spent on the anonymization process can be reduced and the efficiency of the anonymization process can be improved.
[0106] For example, the size to be used may include a width to be used and a height to be used. The width to be used may be calculated based on the width of the area to be anonymized and the width to be used is positively correlated with the width of the area to be anonymized. The height to be used may be calculated based on the height of the area to be anonymized and the height to be used may be positively correlated with the height of the area to be anonymized. For example, the ratio of the width of the area to be anonymized to the number of reference grids may be calculated, and the product of the ratio obtained and the width of the reference grid may be calculated to obtain the width to be used. The ratio of the height of the area to be anonymized to the number of reference grids may be calculated, and the product of the ratio obtained and the height of the reference grid may be calculated to obtain the height to be used. The number of reference grids and the height and width of the reference grids may be set as needed, for example, the number of reference grids may be 16 or 25, the height of the reference grids may be 4 or 6, and the width of the reference grids may be 4 or 5.
[0107] The rectangular grid used for division can also be a square grid, then the width to be used and the height to be used are equal. In this case, the size to be used can be calculated according to either the width or the height of the area to be anonymized, or the size to be used can be calculated according to the smaller value of the width or the height of the area to be anonymized. For example, the ratio of the smaller value of the width or the height of the area to be anonymized to the number of reference grids can be calculated, and the product of the obtained ratio and the reference grid size can be calculated to obtain the size to be used. That is, the size to be used can be calculated by the following formula:
[0108]
[0109] in, Indicates the size to be used. represents the reference grid size, represents the number of reference grids, represents the width of the area to be anonymized, High represents the area to be anonymized. and It can be calculated by the following formula:
[0110]
[0111]
[0112] in, Represents the pixel coordinates of the upper left corner of the area to be anonymized; Indicates the pixel coordinates of the lower right corner of the area to be anonymized.
[0113] After the size to be used is calculated, the area to be divided including the area to be anonymized can be divided according to the rectangular grid of the size to be used to obtain a plurality of sub-areas to be anonymized with the same size.
[0114] In one embodiment, when the width of the to-be-anonymized region is divisible by the width of the current rectangular grid of the size to be used, and the height of the to-be-anonymized region is divisible by the height of the current rectangular grid of the size to be used, the current to-be-divided region is the to-be-anonymized region.
[0115] When the width of the area to be anonymized cannot be divided by the width of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the width of the area to be anonymized according to the remainder of the width of the area to be anonymized divided by the width of the current rectangular grid of the size to be used.
[0116] When the height of the area to be anonymized cannot be divided by the height of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height of the current rectangular grid of the size to be used.
[0117] In the embodiment of the present application, in order to ensure that a plurality of sub-areas to be anonymized of the same size can be obtained by dividing the rectangular grid of the size to be used, after calculating the size to be used, it can be determined whether the width of the area to be anonymized is divisible by the width of the rectangular grid of the size to be used (i.e., the width to be used), and whether the height of the area to be anonymized is divisible by the height of the rectangular grid of the size to be used (i.e., the height to be used).
[0118] If the width of the area to be anonymized is divisible by the width to be used and the height of the area to be anonymized is divisible by the height to be used, it means that the area to be anonymized can be evenly divided according to the rectangular grid of the size to be used. In this case, the area to be anonymized can be used as the area to be divided.
[0119] If the width of the area to be anonymized cannot be divided by the width to be used, it means that the area to be anonymized cannot be evenly divided according to the width to be used in the direction where the width of the area to be anonymized is located. In this case, the area to be anonymized can be expanded in the direction where the width of the area to be anonymized is located according to the remainder of the width of the area to be anonymized divided by the width to be used, so that the width of the area to be anonymized after expansion can be divided by the width to be used. The specific expansion method is not specifically limited, as long as the width of the area to be anonymized after expansion can be divided by the width to be used. For example, the area to be anonymized can be expanded to the left and / or right in the original image.
[0120] If the height of the area to be anonymized cannot be divided by the height to be used, it means that the area to be anonymized cannot be evenly divided in the direction of the height of the area to be anonymized according to the height to be used. In this case, the area to be anonymized can be expanded in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height to be used, so that the height of the area to be anonymized after expansion can be divided by the height to be used. The specific expansion method is not specifically limited, as long as the height of the area to be anonymized after expansion can be divided by the height to be used. For example, the area to be anonymized can be expanded upward and / or downward in the original image.
[0121] In this way, it can be ensured that the area to be divided meets the following requirements:
[0122]
[0123]
[0124] in, represents the width of the area to be divided, Indicates the height of the area to be divided. Indicates the size to be used. Represents calculation of remainder.
[0125] Based on the above processing, the area to be anonymized can be adaptively expanded to obtain the area to be divided, so as to ensure that a plurality of sub-areas to be anonymized with the same size can be obtained according to the rectangular grid division of the size to be used. In this way, it can be further ensured that the anonymized image can be accurately restored later while the image anonymization processing is realized.
[0126] After obtaining each sub-region to be anonymized, at least one group of sub-regions to be anonymized can be selected from each sub-region to be anonymized. The number of groups of sub-regions to be anonymized can be set as needed and is not specifically limited. Pixel values are exchanged for each selected group of sub-regions to be anonymized to disrupt the positions of pixel values in the region to be anonymized so that the image information in the region to be anonymized cannot be identified, that is, anonymization processing of the image to be anonymized is achieved to obtain an anonymized image. Exchanging pixel values can also be called shuffle processing, that is, anonymization processing can be achieved according to a preset shuffle method (also called a password). For example, for each group of sub-regions to be anonymized, shuffle processing can be performed according to the following formula:
[0127]
[0128] in, Indicates a storage space for temporarily storing the latest pixel value of each pixel position in a sub-region to be anonymized in the group; Indicates the latest pixel value of each pixel position in a sub-region to be anonymized in the group; Indicates the latest pixel value of each pixel position in another sub-region to be anonymized in the group.
[0129] Furthermore, the correspondence between the two sub-regions to be anonymized that exchange pixel values (i.e., exchange operation information) can be recorded. Later, for users with authority (which can be called authorized users), the positions of the pixel values in the anonymized image can be restored according to the recorded exchange operation information to achieve de-anonymization of the anonymized image and obtain the original image. That is, the anonymized image can be shuffled in reverse order according to the preset shuffle method to obtain the original image. For example, the latest pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information can be exchanged later to de-anonymize the anonymized image and obtain the original image.
[0130] In one embodiment, the exchange operation information can be stored in a different storage space from the anonymized image. In this way, the risk of the anonymized image being stolen and restored can be reduced, and the risk of the anonymized image information being cracked is low, which can effectively protect privacy.
[0131] In the present application, the number of rounds of anonymization processing can be set, as well as the number of times pixel values are exchanged during each round of anonymization processing. That is, multiple shuffle processes can be performed to achieve multiple encryptions to enhance the security of privacy information in the original image. The more rounds of anonymization processing and the more times pixel values are exchanged during each round of anonymization processing, the better the effect of anonymization processing, but the time consumption of anonymization processing increases. Therefore, the time consumption of anonymization processing and the effect of anonymization processing can be comprehensively considered, the number of rounds of anonymization processing can be set, as well as the number of times pixel values are exchanged during each round of anonymization processing to obtain an anonymized image. Specifically, pixel value exchange can be performed in the following manner.
[0132] In the first approach, multiple rounds of anonymization may be performed, and each round of anonymization may include one or more pixel value exchanges. Figure 3 , Figure 3 The third flow chart of the image anonymization method provided in the embodiment of the present application. The current size to be used is calculated based on the current reference grid size. Step S102 includes:
[0133] Step S1021: Divide the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used, to obtain a plurality of sub-areas to be anonymized of the same size.
[0134] Step S1022: selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each currently selected group of sub-regions to be anonymized, exchanging the current pixel values at the pixel positions of two sub-regions to be anonymized in the group that have the same relative positions, so as to complete this round of anonymization processing.
[0135] Step S1023: adjusting the current reference grid size, and returning to step S1021; until the number of rounds of anonymization processing reaches a first number, an anonymized image is obtained.
[0136] The exchange operation information also includes the to-be-anonymized area involved in each round of anonymization processing, and the order between each round of anonymization processing.
[0137] In an embodiment of the present application, the current latest size to be used can be calculated based on the current latest reference grid size and the size of the area to be anonymized. According to the rectangular grid of the latest size to be used, the latest area to be divided containing the area to be anonymized is divided to obtain a plurality of sub-areas to be anonymized with the same size. After the plurality of sub-areas to be anonymized are divided, at least one group of sub-areas to be anonymized can be selected from the sub-areas to be anonymized obtained by the latest division. For each group of sub-areas to be anonymized that is newly selected, the current latest pixel values at the pixel positions of the two sub-areas to be anonymized in the group that are in the same relative position are exchanged to complete this round of anonymization processing.
[0138] After completing a round of anonymization processing, the size of the reference grid size can be adjusted to calculate a new size to be used based on the new reference grid size. For example, a grid size set containing multiple reference grid sizes can be pre-set, and each time the reference grid size is adjusted, a reference grid size that has not been selected can be selected from the grid size set as the new reference grid size. According to the latest rectangular grid of the size to be used, the latest area to be divided containing the area to be anonymized is divided to obtain multiple newly divided sub-areas to be anonymized with the same size. At least one group of sub-areas to be anonymized can be selected from each sub-area to be anonymized obtained by the latest division. For each group of sub-areas to be anonymized that is newly selected, the latest pixel values at the pixel positions with the same relative positions in the two sub-areas to be anonymized in the group are exchanged to complete a new round of anonymization processing. And so on, until the number of rounds of anonymization processing reaches the first number.
[0139] The first number can be set by comprehensively considering the time consumption of the anonymization process and the effect of the anonymization process, without specific limitation. The number of groups of sub-regions to be anonymized selected in each round of anonymization process can be the same or different. Accordingly, the exchange operation information can also include the areas to be anonymized involved in each round of anonymization process, and the order between the rounds of anonymization process.
[0140] Based on the above processing, the original image can be subjected to multiple rounds of anonymization processing to obtain an anonymized image, and the sizes of the sub-regions to be anonymized for pixel value exchange in different rounds of anonymization processing are different, which can further ensure that the positions of the pixel values in the region to be anonymized can be effectively disrupted, so that the image information in the region to be anonymized cannot be identified, that is, the effect of the anonymization processing can be further guaranteed.
[0141] In one implementation, each round of anonymization processing may include multiple pixel value exchanges. Step S1022 includes:
[0142] Step 1: Select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized.
[0143] Step 2: For each group of sub-regions to be anonymized currently selected, the current pixel values at the pixel positions with the same relative positions in two sub-regions to be anonymized in the group are exchanged to complete the pixel value exchange; and the process returns to step 1 until the number of pixel value exchanges reaches the second number.
[0144] For each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the anonymization process, and the order of each pixel value exchange during the anonymization process.
[0145] In this implementation, for each pixel value exchange, at least one group of sub-regions to be anonymized can be selected from each sub-region to be anonymized obtained by the current latest division. The selected sub-regions to be anonymized can be one group or multiple groups. For each selected group of sub-regions to be anonymized, the latest pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent are exchanged to complete this pixel value exchange. After completing a pixel value exchange, at least one group of sub-regions to be anonymized can be reselected to exchange the latest pixel values at the pixel positions of the two sub-regions to be anonymized in each selected group of sub-regions to be anonymized that are relatively consistent, to complete a new pixel value exchange. And so on, until the number of pixel value exchanges reaches the second number. The time-consuming anonymization process and the effect of the anonymization process can be considered comprehensively, and the first number is set without specific limitation. The number of groups of sub-regions to be anonymized selected during each pixel value exchange can be the same or different. The sub-regions to be anonymized involved in each pixel value exchange can be the same or different.
[0146] Correspondingly, the exchange operation information includes: the correspondence between the two sub-regions to be anonymized for pixel value exchange. For each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the anonymization process, and the order between each pixel value exchange during the anonymization process.
[0147] In this way, each round of anonymization processing can include multiple pixel value exchanges, which can further ensure that the positions of pixel values in the area to be anonymized can be effectively disrupted, making the image information in the area to be anonymized unrecognizable, that is, the effect of the anonymization processing can be further guaranteed.
[0148] In another implementation, each round of anonymization processing may include only one pixel value exchange. For the specific pixel value exchange, reference may be made to the relevant description of each pixel value exchange in the above implementation. Accordingly, the exchange operation information includes: the correspondence between the two sub-regions to be anonymized for pixel value exchange, the sub-regions to be anonymized involved in each round of anonymization processing, and the order between each round of anonymization processing.
[0149] In one embodiment, the current size to be used is the product of the coefficient to be used and the current reference grid size; the coefficient to be used is the ratio of the smaller value of the width and height of the area to be anonymized to the number of reference grids.
[0150] In the embodiment of the present application, the ratio of the smaller value of the width and height of the area to be anonymized to the number of reference grids can be calculated to obtain the coefficient to be used. For example, the coefficient to be used can be expressed as:
[0151]
[0152] in, represents the number of reference grids, represents the width of the area to be anonymized, High represents the area to be anonymized.
[0153] The latest size to be used can be obtained by calculating the product of the coefficient to be used and the latest reference grid size. Accordingly, the sub-regions to be anonymized of new sizes can be divided according to the latest rectangular grid of the size to be used. In this way, the sizes of the sub-regions to be anonymized that exchange pixel values in different rounds of anonymization processing are different, which can further ensure that the positions of the pixel values in the region to be anonymized can be effectively disrupted, so that the image information in the region to be anonymized cannot be identified, that is, the effect of the anonymization processing can be further guaranteed.
[0154] In the second method, only one round of anonymization processing may be performed, and the round of anonymization processing may include one or more pixel value exchanges. For each pixel value exchange, please refer to the relevant description of one pixel value exchange in step 1-step 2 in the above embodiment. When a round of anonymization processing includes only one pixel value exchange, the exchange operation information includes the corresponding relationship between the two sub-areas to be anonymized for pixel value exchange. When a round of anonymization processing includes multiple pixel value exchanges, the exchange operation information includes: the corresponding relationship between the two sub-areas to be anonymized for pixel value exchange, the sub-areas to be anonymized involved in each pixel value exchange, and the order between each pixel value exchange.
[0155] In one embodiment, see Figure 4 , Figure 4A fourth flow chart of the image anonymization method provided in the embodiment of the present application. The image anonymization method may include:
[0156] Step S401: Start.
[0157] Step S402: Whether the target is detected. If the target is detected, step S403 is executed; if the target is not detected, step S405 is executed. That is, the original image is detected for the object to be anonymized to determine whether there is an object to be anonymized. If there is an anonymized object, the rectangular image area (i.e., the area to be processed) where the object to be anonymized is located can be obtained. This part can be called target area detection.
[0158] Step S403: Adaptive expansion and block processing according to the target ROI area. That is, step S1012 in the above embodiment, and adaptive expansion of the area to be anonymized, and dividing the area to be divided including the area to be anonymized according to the rectangular grid of the size to be used, to obtain multiple sub-areas to be anonymized of the same size. This part can be called adaptive block of the target area.
[0159] Step S404: reversible anonymization is performed, and the coordinate information of the ROI region and the shuffle (position change) method are retained. That is, in step S102 in the above embodiment, at least one group of sub-regions to be anonymized is selected from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, the current pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent are exchanged to obtain an anonymized image, and step S103. This part can be called target region anonymization processing.
[0160] Step S405: End.
[0161] Based on the same inventive concept, the present application also provides an image de-anonymization method, see Figure 5 , Figure 5 A first flow chart of the image de-anonymization method provided in the embodiment of the present application. The image de-anonymization method comprises:
[0162] Step S501: Acquire an anonymized image and corresponding exchange operation information.
[0163] The anonymized image and the corresponding exchange operation information are obtained by performing anonymization processing on the original image based on any of the above-mentioned image anonymization methods.
[0164] Step S502: exchanging the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
[0165] In the embodiment of the present application, an anonymized image that needs to be de-anonymized and exchange operation information corresponding to the anonymized image can be obtained. The current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information are exchanged to restore the positions of the pixel values in the anonymized image, thereby achieving de-anonymization of the anonymized image and obtaining the original image.
[0166] Based on the above processing, since in the process of anonymizing the original image, exchanging the pixel values of the sub-region to be anonymized only changes the position of the pixel values in the region to be anonymized, and does not cause the loss of pixel values, and does not cause the loss of image information, the position of the pixel values in the anonymized image is restored according to the recorded exchange operation information, and the lossless restoration of the anonymized image can be achieved. In addition, in the process of anonymizing the original image, the size to be used is positively correlated with the size of the region to be anonymized, and correspondingly, the size of the sub-region to be anonymized is also positively correlated with the size of the region to be anonymized. That is, the size of the sub-region to be anonymized obtained by the division can be adaptively adjusted according to the size of the region to be anonymized, which can avoid the size of the sub-region to be anonymized being too small when the region to be anonymized is large, resulting in an increase in the time consumption of the anonymization process, and avoid the size of the sub-region to be anonymized being too large when the region to be anonymized is small, resulting in a poor anonymization effect, which can effectively balance the time consumption of the anonymization process and the effect of the anonymization process. In this way, while ensuring that the anonymized image can be accurately and losslessly restored, the time consumption of the de-anonymization process can be reduced and the efficiency of the de-anonymization process can be improved.
[0167] In one embodiment, see Figure 6 , Figure 6 A second flow chart of the image deanonymization method provided in the embodiment of the present application. This part may also be referred to as deanonymization processing. The image deanonymization method may include:
[0168] Step S601: Start.
[0169] Step S602: Acquire the anonymized image, anonymous region coordinate information and shuffle information, that is, step S501 in the above embodiment.
[0170] Step S603: Perform de-anonymization processing, that is, step S502 in the above embodiment.
[0171] Step S604: Obtain the de-anonymized image, that is, obtain the original image.
[0172] Step S605: End.
[0173] In one embodiment, the anonymized image is obtained by performing multiple rounds of anonymization processing on the original image; the exchange operation information also includes: the sub-regions to be anonymized involved in each round of anonymization processing, and the order between each round of anonymization processing.
[0174] Step S502 includes: exchanging the current pixel values at the pixel positions with the same relative position in the corresponding sub-regions to be anonymized involved in each round of anonymization processing recorded in the exchange operation information in reverse order of the order between the rounds of anonymization processing recorded in the exchange operation information, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image.
[0175] In the embodiment of the present application, the anonymized image can be obtained by performing multiple rounds of anonymization processing on the original image. The specific method of performing multiple rounds of anonymization processing can refer to the relevant description of method 1 in the above-mentioned image anonymization method embodiment. Accordingly, the positions of the pixel values in the sub-region to be anonymized involved in each round of anonymization processing recorded in the exchange operation information can be restored in sequence in the reverse order of the order between the rounds of anonymization processing recorded in the exchange operation information, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image. In this way, it can be ensured that the anonymized image can be restored without loss.
[0176] In one embodiment, each round of anonymization processing includes multiple pixel value exchanges; for each round of anonymization processing, the exchange operation information also includes the sub-areas to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing.
[0177] Each round of de-anonymization process includes:
[0178] According to the reverse order of the order of each pixel value exchange in the anonymization process corresponding to the round of de-anonymization process recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized and having a corresponding relationship involved in each pixel value exchange in the anonymization process are exchanged in sequence.
[0179] In an embodiment of the present application, the anonymized image can be obtained by performing multiple rounds of anonymization processing on the original image, and each round of anonymization processing includes multiple pixel value exchanges. The specific method of performing multiple rounds of anonymization processing can refer to the relevant description of method 1 in the above-mentioned image anonymization method embodiment, and the specific method of multiple pixel value exchanges included in each round of anonymization processing can refer to the relevant description of step 1 and step 2 in the above-mentioned image anonymization method embodiment. Accordingly, the positions of the pixel values in the sub-region to be anonymized involved in each round of anonymization processing recorded in the exchange operation information can be restored in sequence according to the reverse order of the order between the rounds of anonymization processing recorded in the exchange operation information, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image. And in the process of each round of de-anonymization processing, the positions of the pixel values in the sub-region to be anonymized involved in each pixel value exchange in the anonymization processing process corresponding to the round of de-anonymization processing recorded in the exchange operation information can be restored in sequence. In this way, it can be ensured that the anonymized image can be restored without loss.
[0180] For ease of understanding, take the example of performing three rounds of anonymization processing on the original image, each round of anonymization processing includes two pixel value exchanges. The sub-regions to be anonymized may include sub-regions 1 to 9. During the first round of anonymization processing, the sub-regions to be anonymized involved in the first pixel value exchange may be sub-regions 1 and 2, and the sub-regions to be anonymized involved in the second pixel value exchange may be sub-regions 4 and 6. During the second round of anonymization processing, the sub-regions to be anonymized involved in the first pixel value exchange may be sub-regions 3 and 5, and the sub-regions to be anonymized involved in the second pixel value exchange may be sub-regions 4 and 7. During the third round of anonymization processing, the sub-regions to be anonymized involved in the first pixel value exchange may be sub-regions 1 and 8, and the sub-regions to be anonymized involved in the second pixel value exchange may be sub-regions 6 and 9.
[0181] Accordingly, during the first round of de-anonymization, the pixel values of the sub-regions to be anonymized involved in the second pixel value exchange during the third round of anonymization can be exchanged first, that is, the current pixel values of the pixel positions with the same relative position in sub-region 6 and sub-region 9 are exchanged. Then, the pixel values of the sub-regions to be anonymized involved in the first pixel value exchange during the third round of anonymization are exchanged, that is, the current pixel values of the pixel positions with the same relative position in sub-region 1 and sub-region 8 are exchanged. The first round of de-anonymization is completed.
[0182] During the second round of de-anonymization, the pixel values of the sub-regions to be anonymized involved in the second pixel value exchange during the second round of anonymization can be exchanged first, that is, the current pixel values of the pixel positions with the same relative position in sub-region 4 and sub-region 7 are exchanged. Then, the pixel values of the sub-regions to be anonymized involved in the first pixel value exchange during the second round of anonymization are exchanged, that is, the current pixel values of the pixel positions with the same relative position in sub-region 3 and sub-region 5 are exchanged. The second round of de-anonymization is completed.
[0183] In the process of the third round of de-anonymization, the pixel values of the sub-regions to be anonymized involved in the second pixel value exchange in the process of the first round of anonymization can be exchanged first, that is, the current pixel values of the pixel positions with the same relative position in sub-region 4 and sub-region 6 are exchanged. Then, the pixel values of the sub-regions to be anonymized involved in the first pixel value exchange in the process of the first round of anonymization are exchanged, that is, the current pixel values of the pixel positions with the same relative position in sub-region 1 and sub-region 2 are exchanged. The third round of de-anonymization is completed to obtain the original image.
[0184] In one embodiment, the anonymized image is obtained by performing a round of anonymization processing on the original image, and the round of anonymization processing includes multiple pixel value exchanges; the exchange operation information also includes the sub-areas to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing.
[0185] Step S502 includes: exchanging the current pixel values at the pixel positions with the same relative position in the corresponding sub-regions to be anonymized involved in each pixel value exchange recorded in the exchange operation information in reverse order of the order between the pixel value exchanges recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
[0186] For details, please refer to the relevant description of the process of each round of de-anonymization processing in the above embodiment.
[0187] Based on the same inventive concept, the present application also provides an image anonymization device, see Figure 7 , Figure 7 A schematic diagram of the structure of an image anonymization device provided in an embodiment of the present application. The device comprises:
[0188] The region determination module 701 is used to determine the rectangular image region to be anonymized in the original image, and obtain the region to be anonymized;
[0189] The anonymization processing module 702 is used to divide the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used, to obtain multiple sub-areas to be anonymized with the same size; select at least one group of sub-areas to be anonymized from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, exchange the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative positions, to obtain an anonymized image; wherein a group of sub-areas to be anonymized includes two sub-areas to be anonymized; and the current size to be used is positively correlated with the size of the area to be anonymized;
[0190] The information recording module 703 is used to record the exchange operation information for de-anonymizing the anonymized image; wherein the exchange operation information includes: the correspondence between the two sub-regions to be anonymized for pixel value exchange.
[0191] Based on the image anonymization device provided in the embodiment of the present application, the rectangular image area that needs to be anonymized in the original image can be determined to obtain the area to be anonymized. The size to be used can be calculated according to the size of the area to be anonymized, so as to divide the area to be divided containing the area to be anonymized according to the rectangular grid of the size to be used, and obtain multiple sub-areas to be anonymized. And the pixel values of each group of sub-areas to be anonymized selected from each sub-area to be anonymized can be exchanged to disrupt the position of the pixel values in the area to be anonymized, so that the image information in the area to be anonymized cannot be identified, that is, to achieve anonymization processing of the image to be anonymized and obtain an anonymized image. Furthermore, the corresponding relationship between the two sub-areas to be anonymized that exchange pixel values (that is, the exchange operation information) can be recorded, and the position of the pixel values in the anonymized image can be restored later according to the recorded exchange operation information, so as to achieve de-anonymization of the anonymized image and obtain the original image.
[0192] Since exchanging pixel values in the sub-region to be anonymized only changes the position of the pixel values in the region to be anonymized, it will not cause the loss of pixel values, nor will it cause the loss of image information. Therefore, the position of the pixel values in the anonymized image is restored according to the recorded exchange operation information, so that the lossless restoration of the anonymized image can be achieved. And the size to be used is positively correlated with the size of the region to be anonymized, and correspondingly, the size of the sub-region to be anonymized is also positively correlated with the size of the region to be anonymized. That is, the size of the sub-region to be anonymized obtained by adaptively adjusting the size of the region to be anonymized can avoid the size of the sub-region to be anonymized being too small when the region to be anonymized is large, resulting in an increase in the time spent on the anonymization process, and avoid the size of the sub-region to be anonymized being too large when the region to be anonymized is small, resulting in a poor anonymization process. In this way, while realizing the anonymization process of the image, it can be ensured that the anonymized image can be accurately restored later, and the time spent on the anonymization process and the effect of the anonymization process can be effectively balanced.
[0193] In one embodiment, the current size to be used is calculated based on the current reference grid size;
[0194] The anonymization processing module 702 includes:
[0195] A region division submodule, used for dividing the current region to be divided including the region to be anonymized according to the rectangular grid of the current size to be used, to obtain a plurality of sub-regions to be anonymized with the same size;
[0196] The anonymization processing submodule is used to select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, the current pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent are exchanged to complete this round of anonymization processing;
[0197] The size adjustment module is used to adjust the size of the current reference grid and trigger the area division submodule; until the number of rounds of anonymization processing reaches a first number, an anonymized image is obtained; the exchange operation information also includes the to-be-anonymized area involved in each round of anonymization processing, and the order between each round of anonymization processing.
[0198] In one embodiment, the anonymization processing submodule is specifically used to select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each currently selected group of sub-regions to be anonymized, exchange the current pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent, so as to complete the current pixel value exchange; and return to execute the step of selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized until the number of pixel value exchanges reaches a second number; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing.
[0199] In one embodiment, the current size to be used is the product of the coefficient to be used and the current reference grid size; the coefficient to be used is the ratio of the smaller value of the width and height of the area to be anonymized to the number of reference grids.
[0200] In one embodiment, the region determination module 701 is specifically used to detect the object to be anonymized in the original image, and obtain the rectangular image region where the object to be anonymized is located as the region to be processed; when there is a part that does not belong to the original image in the region to be processed, the part of the region to be processed that belongs to the original image is determined as the region to be anonymized.
[0201] In one embodiment, when the width of the to-be-anonymized area is divisible by the width of the current rectangular grid of the size to be used, and the height of the to-be-anonymized area is divisible by the height of the current rectangular grid of the size to be used, the current to-be-divided area is the to-be-anonymized area;
[0202] In the case where the width of the region to be anonymized cannot be divided by the width of the current rectangular grid of the size to be used, the current region to be divided is obtained by expanding the region to be anonymized in the direction where the width of the region to be anonymized is located according to the remainder of the width of the region to be anonymized divided by the width of the current rectangular grid of the size to be used;
[0203] In the case where the height of the area to be anonymized cannot be divided by the height of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height of the current rectangular grid of the size to be used.
[0204] Based on the same inventive concept, the present application also provides an image de-anonymization device, see Figure 8 , Figure 8A schematic diagram of the structure of an image de-anonymization device provided in an embodiment of the present application, the device comprising:
[0205] The data acquisition module 801 is used to acquire an anonymized image and corresponding exchange operation information; wherein the anonymized image and the corresponding exchange operation information are obtained by anonymizing the original image using any of the above-mentioned image anonymization methods;
[0206] The de-anonymization processing module 802 is used to exchange the current pixel values at the pixel positions with the same relative positions in the corresponding sub-regions to be anonymized recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
[0207] Based on the image de-anonymization device provided by the embodiment of the present application, since in the process of anonymizing the original image, exchanging the pixel values of the sub-region to be anonymized only changes the position of the pixel values in the region to be anonymized, and does not cause the loss of pixel values, and does not cause the loss of image information, therefore, the position of the pixel values in the anonymized image is restored according to the recorded exchange operation information, and the lossless restoration of the anonymized image can be achieved. In addition, in the process of anonymizing the original image, the size to be used is positively correlated with the size of the region to be anonymized, and correspondingly, the size of the sub-region to be anonymized is also positively correlated with the size of the region to be anonymized. That is, the size of the sub-region to be anonymized obtained by the division can be adaptively adjusted according to the size of the region to be anonymized, which can avoid the size of the sub-region to be anonymized being too small when the region to be anonymized is large, resulting in an increase in the time spent on the anonymization process, and avoid the size of the sub-region to be anonymized being too large when the region to be anonymized is small, resulting in a poor anonymization effect, and can effectively balance the time spent on the anonymization process and the effect of the anonymization process. In this way, while ensuring that the anonymized image can be accurately and losslessly restored, the time consumption of the de-anonymization process can be reduced and the efficiency of the de-anonymization process can be improved.
[0208] In one embodiment, the anonymized image is obtained by performing multiple rounds of anonymization processing on the original image; the exchange operation information also includes: the sub-regions to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing;
[0209] The de-anonymization processing module 802 is specifically configured to exchange the current pixel values at the pixel positions with the same relative position in the corresponding sub-regions to be anonymized involved in each round of anonymization processing recorded in the exchange operation information in reverse order of the order between the rounds of anonymization processing recorded in the exchange operation information, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image.
[0210] In one embodiment, each round of anonymization processing includes multiple pixel value exchanges; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing;
[0211] Each round of de-anonymization process includes:
[0212] According to the reverse order of the order of each pixel value exchange in the anonymization process corresponding to the round of de-anonymization process recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized and having a corresponding relationship involved in each pixel value exchange in the anonymization process are exchanged in sequence.
[0213] In one embodiment, the anonymized image is obtained by performing a round of anonymization processing on the original image, and the round of anonymization processing includes multiple pixel value exchanges; the exchange operation information also includes the sub-region to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing;
[0214] The de-anonymization processing module 802 is specifically used to exchange the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized that are involved in each pixel value exchange recorded in the exchange operation information and have a corresponding relationship in reverse order of the order between the pixel value exchanges recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
[0215] The present application also provides an electronic device, such as Fig. 9 As shown, including:
[0216] Memory 901, used for storing computer programs;
[0217] The processor 902 is configured to implement any of the above-mentioned image anonymization methods or any of the above-mentioned image de-anonymization methods when executing the program stored in the memory 901 .
[0218] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 902, the communication interface, and the memory 901 communicate with each other via the communication bus.
[0219] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0220] The communication interface is used for communication between the above electronic device and other devices.
[0221] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0222] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0223] In another embodiment provided by the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned image anonymization methods or any of the image de-anonymization methods are implemented.
[0224] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any image anonymization method or any image de-anonymization method in the above embodiments.
[0225] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0226] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0227] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the image de-anonymization method, device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the image anonymization method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0228] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for anonymizing an image, characterized in that: The method comprises: Determine a rectangular image region to be anonymized in the original image to obtain the region to be anonymized; According to the rectangular grid of the current size to be used, the current area to be divided including the area to be anonymized is divided to obtain a plurality of sub-areas to be anonymized with the same size; at least one group of sub-areas to be anonymized is selected from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative positions are exchanged to obtain an anonymized image; wherein a group of sub-areas to be anonymized includes two sub-areas to be anonymized; and the current size to be used is positively correlated with the size of the area to be anonymized; Recording exchange operation information for de-anonymizing the anonymized image; wherein the exchange operation information includes: a correspondence between two sub-regions to be anonymized for pixel value exchange.
2. The method according to claim 1, characterized in that: The current size to be used is calculated based on the current reference grid size; The current area to be divided including the area to be anonymized is divided according to the rectangular grid of the current size to be used to obtain a plurality of sub-areas to be anonymized with the same size; and at least one group of sub-areas to be anonymized is selected from the current sub-areas to be anonymized; For each group of sub-regions to be anonymized currently selected, the current pixel values at the pixel positions with the same relative positions in two sub-regions to be anonymized in the group are exchanged to obtain an anonymized image, including: Dividing the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used, to obtain a plurality of sub-areas to be anonymized with the same size; Select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, exchange the current pixel values at the pixel positions with the same relative positions in two sub-regions to be anonymized in the group, so as to complete this round of anonymization processing; The size of the current reference grid is adjusted, and the step of returning to executing the step of dividing the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used to obtain a plurality of sub-areas to be anonymized of the same size is obtained; until the number of rounds of anonymization processing reaches a first number, an anonymized image is obtained; the exchange operation information also includes the area to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing.
3. The method according to claim 1 or 2, characterized in that: The method comprises: selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; and exchanging the current pixel values at the pixel positions of two sub-regions to be anonymized in the group that are relatively consistent with each other for each group of sub-regions to be anonymized currently selected. Select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; For each currently selected group of sub-regions to be anonymized, the current pixel values at the pixel positions with the same relative position in two sub-regions to be anonymized in the group are exchanged to complete the current pixel value exchange; and the step of selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized is returned to be executed until the number of pixel value exchanges reaches the second number; For each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the anonymization process, and the order of each pixel value exchange during the anonymization process.
4. The method according to claim 2, characterized in that: The current size to be used is the product of the coefficient to be used and the current reference grid size; the coefficient to be used is the ratio of the smaller value of the width and the height of the area to be anonymized to the number of reference grids.
5. The method according to claim 1, characterized in that The step of determining a rectangular image region to be anonymized in the original image to obtain the region to be anonymized includes: Detecting the object to be anonymized in the original image, and obtaining a rectangular image area where the object to be anonymized is located as the area to be processed; In the case that there is a portion that does not belong to the original image in the area to be processed, the portion of the area to be processed that belongs to the original image is determined as the area to be anonymized.
6. The method according to claim 1, characterized in that In the case where the width of the to-be-anonymized area is divisible by the width of the current rectangular grid of the size to be used, and the height of the to-be-anonymized area is divisible by the height of the current rectangular grid of the size to be used, the current to-be-divided area is the to-be-anonymized area; In the case where the width of the region to be anonymized cannot be divided by the width of the current rectangular grid of the size to be used, the current region to be divided is obtained by expanding the region to be anonymized in the direction where the width of the region to be anonymized is located according to the remainder of the width of the region to be anonymized divided by the width of the current rectangular grid of the size to be used; In the case where the height of the area to be anonymized cannot be divided by the height of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height of the current rectangular grid of the size to be used.
7. A method for deanonymizing an image, characterized in that: The method comprises: Acquire an anonymized image and corresponding exchange operation information; wherein the anonymized image and the corresponding exchange operation information are obtained by anonymizing the original image based on the method according to any one of claims 1 to 6; The current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship and are recorded in the exchange operation information are exchanged to de-anonymize the anonymized image to obtain the original image.
8. The method according to claim 7, characterized in that The anonymized image is obtained by performing multiple rounds of anonymization processing on the original image; the exchange operation information also includes: the sub-regions to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing; Exchanging the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information to de-anonymize the anonymized image to obtain the original image, including: According to the reverse order of the order between each round of anonymization processing recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that are involved in each round of anonymization processing recorded in the exchange operation information and have a corresponding relationship are exchanged in sequence, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image.
9. The method according to claim 8, characterized in that Each round of anonymization processing includes multiple pixel value exchanges; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the anonymization process, and the order between the pixel value exchanges during the anonymization process; Each round of de-anonymization process includes: According to the reverse order of the order of each pixel value exchange in the anonymization process corresponding to the round of de-anonymization process recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized and having a corresponding relationship involved in each pixel value exchange in the anonymization process are exchanged in sequence.
10. The method according to claim 7, characterized in that The anonymized image is obtained by performing a round of anonymization processing on the original image, and the round of anonymization processing includes multiple pixel value exchanges; the exchange operation information also includes the sub-region to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing; Exchanging the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information to de-anonymize the anonymized image to obtain the original image, including: In the reverse order of the order between each pixel value exchange recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative position in the sub-regions to be anonymized that are involved in each pixel value exchange recorded in the exchange operation information and have a corresponding relationship are exchanged in sequence to de-anonymize the anonymized image to obtain the original image.
11. An image anonymization device, characterized in that: The device comprises: A region determination module is used to determine a rectangular image region to be anonymized in the original image to obtain the region to be anonymized; The anonymization processing module is used to divide the current area to be divided including the area to be anonymized according to the rectangular grid of the current size to be used, so as to obtain a plurality of sub-areas to be anonymized with the same size; select at least one group of sub-areas to be anonymized from the current sub-areas to be anonymized; for each group of sub-areas to be anonymized currently selected, exchange the current pixel values at the pixel positions of the two sub-areas to be anonymized in the group with the same relative position, so as to obtain an anonymized image; wherein a group of sub-areas to be anonymized includes two sub-areas to be anonymized; and the current size to be used is positively correlated with the size of the area to be anonymized; The information recording module is used to record the exchange operation information used to de-anonymize the anonymized image; wherein the exchange operation information includes: the correspondence between the two sub-regions to be anonymized for pixel value exchange.
12. The device according to claim 11, characterized in that The current size to be used is calculated based on the current reference grid size; The anonymization processing module includes: A region division submodule, used for dividing the current region to be divided including the region to be anonymized according to the rectangular grid of the current size to be used, to obtain a plurality of sub-regions to be anonymized with the same size; The anonymization processing submodule is used to select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, the current pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent are exchanged to complete this round of anonymization processing; A size adjustment module, used for adjusting the size of the current reference grid and triggering the region division submodule; until the number of rounds of anonymization processing reaches a first number, an anonymized image is obtained; the exchange operation information also includes the to-be-anonymized area involved in each round of anonymization processing, and the order between each round of anonymization processing; and / or, The anonymization processing submodule is specifically used to select at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized; for each group of sub-regions to be anonymized currently selected, exchange the current pixel values at the pixel positions of the two sub-regions to be anonymized in the group that are relatively consistent, so as to complete the current pixel value exchange; and return to execute the step of selecting at least one group of sub-regions to be anonymized from the current sub-regions to be anonymized until the number of pixel value exchanges reaches a second number; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing; and / or, The current size to be used is the product of the coefficient to be used and the current reference grid size; the coefficient to be used is the ratio of the smaller value of the width and the height of the area to be anonymized to the number of reference grids; and / or, The region determination module is specifically used to detect the object to be anonymized in the original image, and obtain the rectangular image region where the object to be anonymized is located as the region to be processed; if there is a part that does not belong to the original image in the region to be processed, the part of the region to be processed that belongs to the original image is determined as the region to be anonymized; and / or, In the case where the width of the to-be-anonymized area is divisible by the width of the current rectangular grid of the size to be used, and the height of the to-be-anonymized area is divisible by the height of the current rectangular grid of the size to be used, the current to-be-divided area is the to-be-anonymized area; In the case where the width of the region to be anonymized cannot be divided by the width of the current rectangular grid of the size to be used, the current region to be divided is obtained by expanding the region to be anonymized in the direction where the width of the region to be anonymized is located according to the remainder of the width of the region to be anonymized divided by the width of the current rectangular grid of the size to be used; In the case where the height of the area to be anonymized cannot be divided by the height of the current rectangular grid of the size to be used, the current area to be divided is obtained by expanding the area to be anonymized in the direction of the height of the area to be anonymized according to the remainder of the height of the area to be anonymized divided by the height of the current rectangular grid of the size to be used.
13. An image de-anonymization device, characterized in that: The device comprises: A data acquisition module, used to acquire an anonymized image and corresponding exchange operation information; wherein the anonymized image and the corresponding exchange operation information are obtained by anonymizing the original image based on the method according to any one of claims 1 to 6; The de-anonymization processing module is used to exchange the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized that have a corresponding relationship recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
14. The device according to claim 13, characterized in that The anonymized image is obtained by performing multiple rounds of anonymization processing on the original image; the exchange operation information also includes: the sub-regions to be anonymized involved in each round of anonymization processing, and the order between the rounds of anonymization processing; The de-anonymization processing module is specifically configured to sequentially exchange the current pixel values at the pixel positions with the same relative position in the corresponding sub-regions to be anonymized involved in each round of anonymization processing recorded in the exchange operation information in the reverse order of the order between the rounds of anonymization processing recorded in the exchange operation information, so as to perform multiple rounds of de-anonymization processing on the anonymized image to obtain the original image; and / or, Each round of anonymization processing includes multiple pixel value exchanges; for each round of anonymization processing, the exchange operation information also includes the sub-regions to be anonymized involved in each pixel value exchange during the anonymization process, and the order between the pixel value exchanges during the anonymization process; Each round of de-anonymization process includes: According to the reverse order of the order of the pixel value exchanges during the anonymization process corresponding to the round of de-anonymization recorded in the exchange operation information, the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized and having a corresponding relationship involved in the pixel value exchanges during the anonymization process are exchanged in sequence; and / or, The anonymized image is obtained by performing a round of anonymization processing on the original image, and the round of anonymization processing includes multiple pixel value exchanges; the exchange operation information also includes the sub-region to be anonymized involved in each pixel value exchange during the round of anonymization processing, and the order between the pixel value exchanges during the round of anonymization processing; The de-anonymization processing module is specifically used to sequentially exchange the current pixel values at the pixel positions with the same relative positions in the sub-regions to be anonymized that are involved in each pixel value exchange recorded in the exchange operation information and have a corresponding relationship, in the reverse order of the order between the pixel value exchanges recorded in the exchange operation information, so as to de-anonymize the anonymized image and obtain the original image.
15. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-6 or any of the methods described in claims 7-10 when executing a program stored in a memory.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 6 or any one of claims 7 to 10 is implemented.
17. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6 or any one of claims 7 to 10.
Citation Information
Patent Citations
PRNU anonymous method and device based on image segmentation
CN114881897A
Image anonymization method
CN117710497A
Method and apparatus for providing image data
CN117892334A
A method and a system for anonymizing image data in medical images
EP3188058A1
Image anonymization apparatus, image anonymization method, and program
JP2021064089A