A transmission method and related device carrying an image of sensitive information
Patent Information
- Application Number
- CN202411722186.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2044-11-28
AI Technical Summary
[0002]在互联网的高速发展过程中,图像以其直观易懂的特性成为了信息交互的主要工具之一,在办公等领域的交流过程中常对文件截图或拍照来传递信息,文件的截图或照片可能会被广泛流传,进而造成敏感信息泄露,造成重大损失
[0069]本申请提供一种携带敏感信息图像的传输方法及相关设备,包括:获取待传输的图像;使用预设的识别模型对图像进行处理,获取图像的各个文本识别信息,文本识别信息中包含在图像中识别出的文本图像区域以及文本图像区域中的文本内容;基于预设的敏感词库,将存在敏感词的文本识别信息确定为敏感信息;将图像中每个敏感信息所对应的文本图像区域加密,得到与图像对应的加密图像;生成与加密图像对应的加密信息,将加密图像和加密图像的加密信息向图像接收方传输。本方案对图像中的部分区域进行加密,无需使用大量的资源对图像进行全图加密,由此所需传输的数据量少,进而减少传输时所应用的资源,避免资源浪费。
Smart Images

Figure CN119544880B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image transmission technology, and in particular to a method and related equipment for transmitting images carrying sensitive information. Background Technology
[0002] In the rapid development of the Internet, images have become one of the main tools for information exchange due to their intuitive and easy-to-understand characteristics. In the process of communication in the office and other fields, screenshots or photos of documents are often used to transmit information. However, screenshots or photos of documents may be widely circulated, which may lead to the leakage of sensitive information and cause significant losses.
[0003] The inventors discovered that, currently, to prevent sensitive information from being leaked during image transmission, images are usually fully encrypted before transmission. Full image encryption requires a lot of processing resources, and transmitting fully encrypted images also consumes additional resources, resulting in resource waste. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method and related device for transmitting images carrying sensitive information. By applying the solution provided in this application, areas in an image containing sensitive information can be encrypted, resulting in a partially encrypted image. The encryption process uses fewer resources, and the encrypted image also consumes fewer resources during transmission, thereby avoiding resource waste and preventing the leakage of sensitive information in the image, thus improving the security of image transmission.
[0005] To achieve the above objectives, the embodiments of this application provide the following technical solutions:
[0006] A method for transmitting an image carrying sensitive information, comprising:
[0007] Acquire the image to be transmitted;
[0008] The image is processed using a preset recognition model to obtain various text recognition information of the image. The text recognition information includes the text image region recognized in the image and the text content in the text image region.
[0009] Based on a pre-defined sensitive word database, text containing sensitive words is identified as sensitive information.
[0010] Encrypt the text image region corresponding to each of the sensitive information in the image to obtain an encrypted image corresponding to the image;
[0011] Generate encrypted information corresponding to the encrypted image, and transmit the encrypted image and the encrypted information of the encrypted image to the image receiver.
[0012] Optionally, in the above method, the step of identifying text containing sensitive words as sensitive information based on a preset sensitive word database includes:
[0013] For each piece of text recognition information, based on the sensitive word database, it is determined whether there are sensitive words in the text recognition information. When there are sensitive words in the text recognition information, the text recognition information is identified as sensitive information.
[0014] Optionally, in the above method, encrypting the text image region corresponding to each piece of sensitive information in the image to obtain an encrypted image corresponding to the image includes:
[0015] Obtain a numeric key with an even number of digits;
[0016] For each piece of sensitive information, the text image region in the image corresponding to the sensitive information is determined as the target image region, and the pixel sorting order of the target image region is shuffled using the digital key to encrypt the target image region;
[0017] After each of the sensitive information's corresponding text image regions in the image is encrypted, an encrypted image corresponding to the image is obtained.
[0018] Optionally, in the above method, the step of scrambling the pixel sorting order of the target image region using the digital key to encrypt the target image region includes:
[0019] Determine the pixel processing strategy corresponding to each number in the digital key;
[0020] Determine the number of pixels in the target image region, and determine the sort number of each pixel in the target image region;
[0021] The first digit in the digital key is determined as the target digit;
[0022] The first pixel in the target image region is determined as the target pixel.
[0023] Based on the sorting number of the target pixel and the pixel processing strategy of the target number, the pixel values in the target pixel are processed;
[0024] Determine whether the target pixel is the last pixel in the target image region;
[0025] If the target pixel is not the last pixel in the target image region, then the pixel in the target image region that is after the target pixel is determined as the new target pixel, and then the process returns to the step of processing the pixel value in the target pixel based on the sorting number of the target pixel and the target number.
[0026] If the target pixel is the last pixel in the target image region, then determine whether the target number is the last number in the digital key;
[0027] If the target number is not the last number in the digital key, then the number following the target number in the digital key is determined as the new target number, and the process returns to the step of determining the first pixel in the target image region as the target pixel.
[0028] If the target number is the last number in the digital key, then the encryption of the target image region is complete.
[0029] Optionally, in the above method, processing the pixel values in the target pixel based on the sorting number of the target pixel and the pixel processing strategy of the target number includes:
[0030] Determine whether the numeric type of the sorting number of the target pixel matches the numeric type in the pixel processing strategy of the target number;
[0031] When the number type of the sorting number of the target pixel matches the number type in the pixel processing strategy, based on the target number, the number of pixels, and the sorting number of the target pixel, it is determined whether the target pixel satisfies the exchange condition in the pixel processing strategy of the target number.
[0032] When the target pixel meets the swapping condition in the pixel processing strategy of the target number, a first pixel is determined in the target image region based on the target number and the sorting number of the target pixel, and the pixel value in the target pixel is swapped with the pixel value of the first pixel;
[0033] When the target pixel does not meet the exchange condition in the pixel processing strategy of the target number, or when the number type of the sorting number of the target pixel does not match the number type in the pixel processing strategy of the target number, the processing of the pixel value of the target pixel ends.
[0034] The above methods may also include:
[0035] When the image receiver receives the encrypted image and the encrypted information, it decrypts the encrypted information and the encrypted image to obtain the image.
[0036] A transmission device carrying sensitive information images, comprising:
[0037] The first acquisition unit is used to acquire the image to be transmitted;
[0038] The second acquisition unit is used to process the image using a preset recognition model to acquire various text recognition information of the image. The text recognition information includes the text image region recognized in the image and the text content in the text image region.
[0039] The determining unit is used to identify text containing sensitive words as sensitive information based on a preset sensitive word database.
[0040] An encryption unit is used to encrypt the text image region corresponding to each piece of sensitive information in the image, so as to obtain an encrypted image corresponding to the image;
[0041] The generation unit is used to generate encrypted information corresponding to the encrypted image and transmit the encrypted image and the encrypted information of the encrypted image to the image receiver.
[0042] Optionally, in the aforementioned apparatus, the determining unit performs a process of determining text recognition information containing sensitive words as sensitive information based on a preset sensitive word database, including:
[0043] For each piece of text recognition information, based on the sensitive word database, it is determined whether there are sensitive words in the text recognition information. When there are sensitive words in the text recognition information, the text recognition information is identified as sensitive information.
[0044] Optionally, in the aforementioned apparatus, the encryption unit performs the process of encrypting the text image region corresponding to each piece of sensitive information in the image to obtain an encrypted image corresponding to the image, including:
[0045] Obtain a numeric key with an even number of digits;
[0046] For each piece of sensitive information, the text image region in the image corresponding to the sensitive information is determined as the target image region, and the pixel sorting order of the target image region is shuffled using the digital key to encrypt the target image region;
[0047] After each of the sensitive information's corresponding text image regions in the image is encrypted, an encrypted image corresponding to the image is obtained.
[0048] Optionally, in the aforementioned apparatus, the encryption unit performs a process of scrambling the pixel sorting order of the target image region using the digital key to encrypt the target image region, including:
[0049] Determine the pixel processing strategy corresponding to each number in the digital key;
[0050] Determine the number of pixels in the target image region, and determine the sort number of each pixel in the target image region;
[0051] The first digit in the digital key is determined as the target digit;
[0052] The first pixel in the target image region is determined as the target pixel.
[0053] Based on the sorting number of the target pixel and the pixel processing strategy of the target number, the pixel values in the target pixel are processed;
[0054] Determine whether the target pixel is the last pixel in the target image region;
[0055] If the target pixel is not the last pixel in the target image region, then the pixel in the target image region that is after the target pixel is determined as the new target pixel, and then the process returns to the step of processing the pixel value in the target pixel based on the sorting number of the target pixel and the target number.
[0056] If the target pixel is the last pixel in the target image region, then determine whether the target number is the last number in the digital key;
[0057] If the target number is not the last number in the digital key, then the number following the target number in the digital key is determined as the new target number, and the process returns to the step of determining the first pixel in the target image region as the target pixel.
[0058] If the target number is the last number in the digital key, then the encryption of the target image region is complete.
[0059] Optionally, in the aforementioned apparatus, the encryption unit performs a pixel processing strategy based on the sorting number of the target pixel and the target number to process the pixel value in the target pixel, including:
[0060] Determine whether the numeric type of the sorting number of the target pixel matches the numeric type in the pixel processing strategy of the target number;
[0061] When the number type of the sorting number of the target pixel matches the number type in the pixel processing strategy, based on the target number, the number of pixels, and the sorting number of the target pixel, it is determined whether the target pixel satisfies the exchange condition in the pixel processing strategy of the target number.
[0062] When the target pixel meets the swapping condition in the pixel processing strategy of the target number, a first pixel is determined in the target image region based on the target number and the sorting number of the target pixel, and the pixel value in the target pixel is swapped with the pixel value of the first pixel;
[0063] When the target pixel does not meet the exchange condition in the pixel processing strategy of the target number, or when the number type of the sorting number of the target pixel does not match the number type in the pixel processing strategy of the target number, the processing of the pixel value of the target pixel ends.
[0064] The aforementioned apparatus may optionally further include:
[0065] The decryption unit is used to decrypt the encrypted information and the encrypted image after the image receiver receives the encrypted image and the encrypted information to obtain the image.
[0066] A storage medium comprising stored instructions, wherein, when the instructions are executed, the device containing the storage medium is controlled to perform the transmission method for carrying sensitive information images as described above.
[0067] An electronic device includes a memory and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors as described above for transmitting an image carrying sensitive information.
[0068] Compared with the prior art, this application has the following advantages:
[0069] This application provides a method and related equipment for transmitting images carrying sensitive information, including: acquiring an image to be transmitted; processing the image using a preset recognition model to obtain various text recognition information of the image, wherein the text recognition information includes text image regions identified in the image and text content within the text image regions; determining text recognition information containing sensitive words as sensitive information based on a preset sensitive word library; encrypting the text image regions corresponding to each sensitive information in the image to obtain an encrypted image corresponding to the image; generating encrypted information corresponding to the encrypted image; and transmitting the encrypted image and the encrypted information of the encrypted image to an image receiver. This solution encrypts only a portion of the image, eliminating the need for extensive full-image encryption, thus reducing the amount of data transmitted and minimizing resource waste during transmission. Attached Figure Description
[0070] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0071] Figure 1 A flowchart illustrating a method for transmitting an image carrying sensitive information, provided as an embodiment of this application;
[0072] Figure 2 A flowchart illustrating how to encrypt a target image region by scrambling the pixel sorting order using a digital key, as provided in an embodiment of this application.
[0073] Figure 3 The present application provides a flowchart of a pixel processing strategy based on the sorting number and target number of target pixels, which processes the pixel values in the target pixels.
[0074] Figure 4 An image processing flowchart provided in this application embodiment;
[0075] Figure 5 A schematic diagram of the structure of a transmission device carrying sensitive information images provided in an embodiment of this application;
[0076] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0077] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0078] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0079] Terminology Explanation:
[0080] Sensitive information: Information involving national security, corporate privacy, personal privacy, etc.
[0081] Key: A string used to encrypt or decrypt the image.
[0082] Natural scene text detection and recognition models: These models can detect the location of text in an image and recognize the content of the text. The two tasks of detection and recognition can be completed by a single model, such as SwinTextSpotter; or multiple models can work together to complete the task, such as text detection and text recognition in PaddleOCR.
[0083] In the rapid development of the Internet, images have become one of the main tools for information exchange due to their intuitive and easy-to-understand characteristics. In the process of communication in the office and other fields, screenshots or photos of documents are often used to transmit information. However, screenshots or photos of documents may be widely circulated, which may lead to the leakage of sensitive information and cause significant losses.
[0084] Current chat software lacks the function of identifying and protecting sensitive image information. Existing image encryption and decryption algorithms generally encrypt and decrypt the entire image, failing to automatically identify sensitive information in the scene for local encryption and decryption, resulting in additional resource consumption during transmission.
[0085] To address the aforementioned problems and those in the background art, this application provides a transmission scheme for images carrying sensitive information. This scheme uses a recognition model to process the image, obtaining text recognition information for each text within the image, and identifying sensitive information within each text recognition information. The text image region corresponding to each piece of sensitive information in the image is then encrypted to obtain an encrypted image. Encrypted information corresponding to the encrypted image is generated, and the encrypted image and its encrypted information are transmitted to the image receiver. Therefore, by applying the scheme provided in this application, only a portion of an image is encrypted, eliminating the need for extensive full-image encryption and reducing the resources used during transmission, thus avoiding resource waste.
[0086] This application can be used in a wide variety of general-purpose or special-purpose computing device environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor devices, distributed computing environments including any of the above devices, etc. The method provided in this application can be applied to processors or servers.
[0087] Reference Figure 1 The flowchart below illustrates a method for transmitting images carrying sensitive information, as provided in an embodiment of this application.
[0088] S101. Obtain the image to be transmitted.
[0089] The image to be transmitted here is an image carrying sensitive information.
[0090] This image can be an image uploaded by the user.
[0091] S102. Process the image using a preset recognition model to obtain various text recognition information of the image. The text recognition information includes the text image region recognized in the image and the text content in the text image region.
[0092] The recognition model provided in this application is an AI model. Preferably, the AI model can be a natural scene text detection and recognition model such as SwinTextSpotter or PaddleOCR. The recognition model used in this application can recognize the text content in an image and can also identify the text regions.
[0093] Preferably, there may be multiple places containing text in the image. Therefore, multiple text recognition information can be identified. The text recognition information includes the text content identified in the image, as well as the text image region in the image where the text content is located.
[0094] Preferably, the text content in the text recognition information can be represented by "Text", and the text image region can be represented by "Area".
[0095] S103. Based on a preset sensitive word database, identify text containing sensitive words as sensitive information.
[0096] The sensitive word database is a pre-set database that contains multiple sensitive words.
[0097] For each text recognition information, based on the sensitive word database, it is determined whether there are sensitive words in the text recognition information. When there are sensitive words in the text recognition information, the text recognition information is identified as sensitive information. When there are no sensitive words in the text recognition information, the text recognition information is not sensitive information.
[0098] For example, for each text recognition information, the text content in the text recognition information is segmented to obtain each segment of the text recognition information. When there is a sensitive word in the sensitive word library that is the same as any segment, it is determined that there is a sensitive word in the text recognition information, and thus the text recognition information is determined to be sensitive information; otherwise, it is determined that there is no sensitive word in the text recognition information.
[0099] S104. Encrypt the text image region corresponding to each sensitive information in the image to obtain an encrypted image corresponding to the image.
[0100] Preferably, the text image region corresponding to each sensitive information in the image is encrypted sequentially from front to back.
[0101] The process of obtaining the encrypted image corresponding to the image is as follows: obtain a digital key with an even number of digits; for each piece of sensitive information, determine the text image region in the image corresponding to the sensitive information as the target image region, and use the digital key to shuffle the pixel order of the target image region in order to encrypt the target image region; after all the text image regions corresponding to each piece of sensitive information in the image are encrypted, the encrypted image corresponding to the image is obtained.
[0102] For example, a digital key contains multiple digits, and the total number of digits is even, such as 4, 6, 8, etc.
[0103] The pixel order of the text image region corresponding to each piece of sensitive information in the image is shuffled, thereby encrypting the text image region corresponding to each piece of sensitive information in the image, and thus obtaining an encrypted image corresponding to the image.
[0104] S105. Generate encrypted information corresponding to the encrypted image, and transmit the encrypted image and the encrypted information of the encrypted image to the image receiver.
[0105] The digital key and information of each encrypted region in the image are encrypted using a preset encryption algorithm to generate encrypted information corresponding to the encrypted image. That is, the encrypted information contains the digital key and information about each encrypted region in the image. For example, the encryption algorithm could be the SM4 algorithm.
[0106] The encrypted image and encrypted information are transmitted to the image receiver. Preferably, when the image receiver sets a decryption algorithm corresponding to the encryption algorithm described above, the image receiver decrypts the encrypted information and encrypted image after receiving the encrypted image and encrypted information to obtain the image. Preferably, the decryption algorithm is used to decrypt the encrypted information to obtain the digital key and various sensitive information. The pixels of each sensitive information in the text image area corresponding to the encrypted image are sorted and restored to obtain the image carrying the sensitive information.
[0107] Preferably, when there is no sensitive information in the image, the image can be sent directly to the image recipient.
[0108] The method provided in this application involves: acquiring an image to be transmitted; processing the image using a preset recognition model to obtain various text recognition information of the image, wherein the text recognition information includes the text image regions identified in the image and the text content within the text image regions; determining the text recognition information containing sensitive words as sensitive information based on a preset sensitive word library; encrypting the text image regions corresponding to each sensitive information in the image to obtain an encrypted image corresponding to the image; generating encrypted information corresponding to the encrypted image; and transmitting the encrypted image and the encrypted information of the encrypted image to the image receiver. This solution encrypts only a portion of the image, eliminating the need for extensive full-image encryption, thus reducing the amount of data required for transmission and minimizing resource waste.
[0109] Reference Figure 2 The flowchart for encrypting a target image region by shuffling the pixel order using a digital key, as provided in this embodiment of the application, is described in detail below:
[0110] S201. Determine the pixel processing strategy corresponding to each number in the digital key.
[0111] For a digital key, divide it into two equal key segments. In one key segment, the numbers correspond to pixel processing strategies with an odd number of digits, and in the other key segment, the numbers correspond to pixel processing strategies with an even number of digits. For example, divide the digital key into two equal key segments, where one key segment corresponds to pixel processing strategies with an odd number of digits, and in the other key segment, the numbers correspond to pixel processing strategies with an even number of digits.
[0112] For example, if the digital key is 2345, the digital key is divided into two key segments: 23 and 45. The 23 key segment corresponds to the pixel processing strategy for odd-numbered digits, and the 45 key segment corresponds to the pixel processing strategy for even-numbered digits. Alternatively, the 23 key segment corresponds to the pixel processing strategy for even-numbered digits, and the 45 key segment corresponds to the pixel processing strategy for odd-numbered digits.
[0113] S202. Determine the number of pixels in the target image region and determine the sorting number of each pixel in the target image region.
[0114] The number of pixels in the target image region here can be the sum of the number of pixels in the target pixel region.
[0115] Preferably, each pixel in the target image region can be output in the form of coordinates, thus obtaining a one-dimensional array containing each pixel of the target image region: [p1(x1,y1),p2(x1,y2),p3(x1,y3),...,p n (x i ,y j )], where p n (x i ,y j ) represents the nth pixel in the target image region. Furthermore, n can also be regarded as the sort number of the pixel in the target image region, where n is a positive integer.
[0116] Preferably, the sorting number of the pixel can be regarded as the position number of the pixel in the target image area. Furthermore, according to the position number of each pixel, each pixel can be divided into pixels located in odd positions and pixels located in even positions.
[0117] S203. Determine the first digit in the digital key as the target digit.
[0118] S204. Determine the first pixel in the target image region as the target pixel.
[0119] S205. Based on the sorting number of the target pixel and the pixel processing strategy of the target number, process the pixel value in the target pixel.
[0120] Reference Figure 3 The flowchart illustrating the pixel value processing strategy based on the sorting number and target number of the target pixel provided in this application embodiment, and the relevant descriptions are as follows:
[0121] S301. Determine whether the numeric type of the sorting number of the target pixel matches the numeric type in the pixel processing strategy of the target pixel; if the numeric type of the sorting number of the target pixel matches the numeric type in the pixel processing strategy, execute S302; if the numeric type of the sorting number of the target pixel does not match the numeric type in the pixel processing strategy, execute S304.
[0122] It should be noted that the number type in the pixel processing strategy of the target number is the parity of the target number. For example, when the target number is 2, the number type of the pixel processing strategy of the target number is even; when the target number is 3, the number type of the pixel processing strategy of the target number is odd.
[0123] The number type here can be either odd or even. Furthermore, when the number type of the target pixel's sort number is the same as the number type in the target number's pixel processing strategy, the number type of the target pixel's sort number matches the number type in the target number's pixel processing strategy; otherwise, the number type of the target pixel's sort number does not match the number type in the target number's pixel processing strategy.
[0124] For example, suppose the target number is f and the sort number of the target pixel is 1. The number type in the pixel processing strategy of the target number f is even, while the number type of the sort number of the target pixel is odd. The target pixel is an odd-position pixel. In this case, the number type of the sort number of the target pixel does not match the number type in the pixel processing strategy of the target number.
[0125] For example, assuming the target number is f and the sort number of the target pixel is 2, the number type in the pixel processing strategy of the target number f is even, the number type of the sort number of the target pixel is even, and the target pixel is an even-numbered pixel. In this case, the number type of the sort number of the target pixel matches the number type in the pixel processing strategy of the target number.
[0126] S302. Based on the target number, the number of pixels, and the sorting number of the target pixels, determine whether the target pixel satisfies the exchange condition in the pixel processing strategy of the target number; if the target pixel satisfies the exchange condition in the pixel processing strategy of the target number, execute S303; if the target pixel does not satisfy the exchange condition in the pixel processing strategy of the target number, execute S304.
[0127] Based on the target number, the number of pixels in the target image region, and the sorting number of the target pixels, determine whether the target pixels meet the exchange conditions in the pixel processing strategy for the target number. Specifically, determine whether the sum of the target number and the sorting number of the target pixels is greater than the number of pixels in the target image region. If it is greater, determine that the target pixels do not meet the exchange conditions in the pixel processing strategy for the target number. If it is not greater, determine that the target pixels meet the exchange conditions in the pixel processing strategy for the target number.
[0128] For example: Suppose the target number is a, the number of pixels in the target image region is n, and the sort number of the target pixel is b. If (a+b)>n, then the target pixel does not satisfy the exchange condition in the pixel processing strategy for the target number. If (a+b)≤n, then the target pixel satisfies the exchange condition in the pixel processing strategy for the target number.
[0129] S303. Based on the target number and the sorting number of the target pixel, determine the first pixel in the target image region, and swap the pixel value in the target pixel with the pixel value of the first pixel.
[0130] When determining the first pixel, the target number is added to the sort number of the target pixel to obtain a numerical value. This numerical value is then used to determine the first pixel in the target image region. Specifically, the pixel in the target image region with the same sort number as this numerical value is determined as the first pixel. For example, if the sum of the target number and the sort number of the target pixel is 9, then the pixel with sort number 9 in the target pixel region is determined as the first pixel.
[0131] After determining the first pixel, the pixel value of the target pixel is swapped with the pixel value of the first pixel. At this time, the pixel value of the target pixel changes.
[0132] By changing the pixel values of pixels in the target image region, the sorting of pixels in the target image region is disrupted.
[0133] S304. End processing of the pixel value of the target pixel.
[0134] It should be noted that when the target pixel does not meet the exchange condition in the pixel processing strategy of the target number, or when the number type of the sorting number of the target pixel does not match the number type in the pixel processing strategy of the target number, the processing of the pixel value of the target pixel ends, and the pixel value of the target pixel does not change.
[0135] In this application, the pixel sorting order of pixels in the target image region is disrupted by changing the pixel values of the pixels. By changing the pixel values, the original sorting of pixels in the target image region is disrupted, thereby encrypting the target image region.
[0136] S206. Determine whether the target pixel is the last pixel in the target image region; if the target pixel is not the last pixel in the target image region, then execute S207; if the target pixel is the last pixel in the target image region, then execute S208.
[0137] S207. Determine the next pixel in the target image region after the target pixel as the new target pixel, and then return to step S205.
[0138] S208. Determine whether the target number is the last number in the digital key; if the target number is not the last number in the digital key, then execute S209; if the target number is the last number in the digital key, then execute S210.
[0139] S209. Determine the digit following the target digit in the digital key as the new target digit, and return to step S204.
[0140] S210. Complete the encryption of the target image region.
[0141] This application uses digital cryptography to shuffle the pixel order of each sensitive information text image region, thereby encrypting each sensitive information text image region and obtaining an encrypted image corresponding to the image. This achieves localized encryption of an image, eliminating the need for full-image encryption, saving image processing resources, and using fewer transmission resources when transmitting the encrypted image, avoiding resource waste. Furthermore, it prevents the leakage of sensitive information in the image during transmission, improving the security of image transmission.
[0142] Furthermore, after receiving the encrypted image and its encrypted information, the image receiver first uses the corresponding decryption algorithm to decrypt the encrypted information, obtaining the digital key and each encrypted text image region. For each encrypted text image region, the digital key is used to recover the pixels within that region; that is, the digital key is used to perform AND operations on the pixels within that region. Figure 2 The reverse process corresponding to the illustrated procedure restores the sorting of pixels in the encrypted text image region, thereby obtaining the decrypted text image region; once all encrypted text image regions have been decrypted, the image can be obtained.
[0143] This application provides an example illustrating the process of transmitting images carrying sensitive information, as detailed below:
[0144] Step 1: The user prepares the image to be transmitted and inputs it into the processor or server equipped with the solution provided in this application.
[0145] Step 2: The server uses an AI model to detect regions and text information in the image. The AI model can be a variety of natural scene text detection and recognition models such as SwinTextSpotter or PaddleOCR.
[0146] The region containing text can be called a text image region. The pixels in this region can be output as coordinates. Each text image region containing text in an image can be represented as follows:
[0147] Area = {P1, P2, ..., P} a}, where P a This represents the a-th text image region in the image;
[0148] P a ={p a1 (x1,y1),p a2 (x1,y2),...,p an (x i ,y j )}, where p an (x i ,y j ) represents the nth pixel in the a-th text image region of the image, where x and y represent the horizontal and vertical coordinates, respectively.
[0149] Furthermore, the text information in each text image region can be represented as: Text = {str1, str2, ..., str...} a}, where str n This represents the text information in the a-th text image region of the image.
[0150] Step 3: For each text message, match it against a sensitive word database. If a sensitive word is found, determine the corresponding text image region as the text image region to be encrypted, and store this text image region in an array, represented as follows:
[0151] Area secret ={S1,S2,...,S} m}, where S m This represents the m-th text image region in the image that needs to be encrypted;
[0152] S m ={p m1 (x1,y1),p m2 (x1,y2),...,p mn (x i ,y j )}, where pmn (x i ,y j ) represents the nth pixel in the mth text image region that needs to be encrypted, where x and y represent the horizontal and vertical coordinates, respectively.
[0153] Step 4: Encrypt the text image area containing sensitive information using an encryption algorithm. This application will shuffle the pixel order of the text image area to be encrypted according to the digital key, thereby encrypting the text image area to be encrypted. In this way, the recipient without the key will not be able to read this part of the content normally.
[0154] Preferably, the process of shuffling the pixel order of each text image region that needs to be encrypted in the image is as follows:
[0155] (A) Enter Area secret Set the digital key to any 4-digit Arabic numeral: mnqo;
[0156] (B) Traverse Area sequentially secret For each text image region, determine the number of pixels u in each text image region; during the traversal of Area secret When traversing the various text image regions in the array Area, iterate from front to back. secret Each text image region in the image; take the currently traversed text image region as the target image region, and perform steps (C)-(G) on the target image region;
[0157] (C) For m, for pixel p located at an odd position in the target image region i If (i+m)≤u, then the pixel point p i and p i+m If (i+m)>u, swap the positions of pixel p. i constant;
[0158] (D) For n, for pixel p located at an odd position in the target image region i If (i+n)≤u, then the pixel p i and p i+n Swap positions; if (i+n)>u, pixel p i constant;
[0159] (E) For q, for pixel p located at an even position in the target image region i If (i+q)≤u, then the pixel point p i and p i+q Swap positions; if (i+q)>u, pixel p i constant;
[0160] (F) For o, for pixel p located at an even position in the target image region. i If (i+o)≤u, then the pixel point p i and p i+o Swap positions; if (i+o)>u, pixel p i constant;
[0161] (G) If Area secret If the traversal is complete, proceed to step (H); if Area secret If the traversal has not ended, the next text image region encountered is taken as the new target image region, and then the process returns (C);
[0162] (H) Obtain the encrypted image.
[0163] Encrypt the Area array using the SM4 algorithm. secret With the digital key mnqo, the encrypted information is obtained, and the encrypted image and the encrypted information are sent to the image recipient.
[0164] If the image receiver has a decryption algorithm corresponding to the SM4 algorithm, it can use the decryption algorithm to decrypt the encrypted information and obtain the Area array. secret and the digital key mnqo, then use the array Area secret The encrypted image can be decrypted using a digital key, while the uncracked image can be obtained directly using a decryption algorithm corresponding to the SM4 algorithm.
[0165] The decryption process is as follows:
[0166] (A) Decrypt using the SM4 key to obtain Area secret and key mnqo;
[0167] (B) Traverse Area sequentially secret Each text image region in the image contains a pixel count of u; during the traversal of the Area... secret When traversing the various text image regions in the array, iterate through the array Area from back to front. secret Each text image region in the image; take the currently traversed text image region as the target image region, and perform steps (C)-(G) on the target image region;
[0168] (C) For o, for pixel p located at an even position in the target image region. i If (i+o)≤u, then the pixel point p i and p i+o Swap positions; if (i+o)>u, pixel p i constant;
[0169] (D) For q, for pixel p located at an even position in the target image region i If (i+q)≤u, then the pixel point p i and p i+q Swap positions; if (i+q)>u, pixel p i constant;
[0170] (E) For n, for pixels p located at odd positions in the target image region i If (i+n)≤u, then the pixel p i and p i+n Swap positions; if (i+n)>u, pixel p i constant;
[0171] (F) For m, for pixels p located at odd positions in the target image region i If (i+m)≤u, then the pixel point p i and p i+m If (i+m)>u, swap the positions of pixel p. i constant;
[0172] (G) If Area secret If the traversal is complete, proceed to step (H); if Area secret If the traversal has not ended, the next text image region encountered is taken as the new target image region, and then the process returns (C);
[0173] (H) Obtain the decrypted image.
[0174] Furthermore, each text image region in the image that needs to be encrypted is then encrypted.
[0175] Reference Figure 4 The following is a flowchart of an image processing procedure provided in this application embodiment: An image is acquired; an AI model is used to detect text content and text content regions in the image; each identified text content is matched against a sensitive word database to determine if any text content contains sensitive information; if any text content contains sensitive information, the region containing the sensitive information in the image is encrypted, and then the encrypted image is sent to the receiver; when the receiver does not have the key, the receiver acquires the encrypted image; when the receiver has the key, the encrypted image is decrypted to obtain the unencrypted image; when no text content contains sensitive information, the image is directly sent to the receiver.
[0176] This application utilizes an AI model as a tool for detecting and recognizing text regions in natural scenes within images. It can broadly identify distorted, warped, and differently colored and fonted text, demonstrating good versatility and applicability to most scenarios. Secondly, this invention can automatically encrypt sensitive information image regions with minimal impact, protecting information security while allowing other recipients to easily read publicly available information. The encryption and decryption algorithms effectively protect critical image information.
[0177] This application utilizes deep learning technology to optimize image encryption and decryption. The proposed scheme employs an AI model to detect and recognize text, identifying image regions where sensitive information exists. It effectively recognizes text regions in natural scenes and identifies the text content, matching the text content against a sensitive information lexicon. If sensitive information is found, the region containing the text is locally encrypted. The pixel order in the text image region containing sensitive information is scrambled, thus encrypting the region. The disordered pixel order in the text image region containing sensitive information renders it unreadable. Users without the key cannot recognize the content of this region, while users with the key can decrypt the region to obtain all image information, preventing the leakage of sensitive information during transmission and improving the security and reliability of transmission.
[0178] Although the present invention describes the operations in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain circumstances, multitasking and parallel processing may be advantageous.
[0179] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0180] This application embodiment also provides a transmission device carrying sensitive information images, which is disposed in a processor or server, and is used to support... Figure 1 The specific implementation of the method shown.
[0181] Reference Figure 5 The following is a schematic diagram of a transmission device carrying sensitive information images provided in an embodiment of this application, and is described in detail below:
[0182] The first acquisition unit 401 is used to acquire the image to be transmitted;
[0183] The second acquisition unit 402 is used to process the image using a preset recognition model to acquire various text recognition information of the image, wherein the text recognition information includes the text image region recognized in the image and the text content in the text image region;
[0184] The determining unit 403 is used to determine text recognition information containing sensitive words as sensitive information based on a preset sensitive word library;
[0185] The encryption unit 404 is used to encrypt the text image region corresponding to each of the sensitive information in the image to obtain an encrypted image corresponding to the image;
[0186] The generation unit 405 is used to generate encryption information corresponding to the encrypted image and transmit the encrypted image and the encryption information of the encrypted image to the image receiver.
[0187] The apparatus provided in this application acquires an image to be transmitted; processes the image using a preset recognition model to obtain various text recognition information of the image, the text recognition information including the text image regions identified in the image and the text content within the text image regions; based on a preset sensitive word library, text recognition information containing sensitive words is identified as sensitive information; the text image regions corresponding to each sensitive information in the image are encrypted to obtain an encrypted image corresponding to the image; encrypted information corresponding to the encrypted image is generated, and the encrypted image and the encrypted information of the encrypted image are transmitted to the image receiver. This scheme encrypts only a portion of the image, eliminating the need for extensive full-image encryption, thus reducing the amount of data transmitted and minimizing resource waste.
[0188] In another embodiment provided in this application, the determining unit of the device performs a process of determining text recognition information containing sensitive words as sensitive information based on a preset sensitive word database, including:
[0189] For each piece of text recognition information, based on the sensitive word database, it is determined whether there are sensitive words in the text recognition information. When there are sensitive words in the text recognition information, the text recognition information is identified as sensitive information.
[0190] In another embodiment provided in this application, the encryption unit of the device performs the process of encrypting the text image region corresponding to each piece of sensitive information in the image to obtain an encrypted image corresponding to the image, including:
[0191] Obtain a numeric key with an even number of digits;
[0192] For each piece of sensitive information, the text image region in the image corresponding to the sensitive information is determined as the target image region, and the pixel sorting order of the target image region is shuffled using the digital key to encrypt the target image region;
[0193] After each of the sensitive information's corresponding text image regions in the image is encrypted, an encrypted image corresponding to the image is obtained.
[0194] In another embodiment provided in this application, the encryption unit of the device performs a process of scrambling the pixel sorting order of the target image region using the digital key to encrypt the target image region, including:
[0195] Determine the pixel processing strategy corresponding to each number in the digital key;
[0196] Determine the number of pixels in the target image region, and determine the sort number of each pixel in the target image region;
[0197] The first digit in the digital key is determined as the target digit;
[0198] The first pixel in the target image region is determined as the target pixel.
[0199] Based on the sorting number of the target pixel and the pixel processing strategy of the target number, the pixel values in the target pixel are processed;
[0200] Determine whether the target pixel is the last pixel in the target image region;
[0201] If the target pixel is not the last pixel in the target image region, then the pixel in the target image region that is after the target pixel is determined as the new target pixel, and then the process returns to the step of processing the pixel value in the target pixel based on the sorting number of the target pixel and the target number.
[0202] If the target pixel is the last pixel in the target image region, then determine whether the target number is the last number in the digital key;
[0203] If the target number is not the last number in the digital key, then the number following the target number in the digital key is determined as the new target number, and the process returns to the step of determining the first pixel in the target image region as the target pixel.
[0204] If the target number is the last number in the digital key, then the encryption of the target image region is complete.
[0205] In another embodiment provided in this application, the encryption unit of the device performs a pixel processing strategy based on the sorting number of the target pixel and the target number to process the pixel value in the target pixel, including:
[0206] Determine whether the numeric type of the sorting number of the target pixel matches the numeric type in the pixel processing strategy of the target number;
[0207] When the number type of the sorting number of the target pixel matches the number type in the pixel processing strategy, based on the target number, the number of pixels, and the sorting number of the target pixel, it is determined whether the target pixel satisfies the exchange condition in the pixel processing strategy of the target number.
[0208] When the target pixel meets the swapping condition in the pixel processing strategy of the target number, a first pixel is determined in the target image region based on the target number and the sorting number of the target pixel, and the pixel value in the target pixel is swapped with the pixel value of the first pixel;
[0209] When the target pixel does not meet the exchange condition in the pixel processing strategy of the target number, or when the number type of the sorting number of the target pixel does not match the number type in the pixel processing strategy of the target number, the processing of the pixel value of the target pixel ends.
[0210] In another embodiment provided in this application, the device further includes:
[0211] The decryption unit is used to decrypt the encrypted information and the encrypted image after the image receiver receives the encrypted image and the encrypted information to obtain the image.
[0212] This invention also provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device containing the storage medium is controlled to perform the above-described method for transmitting images carrying sensitive information.
[0213] This invention also provides an electronic device, the structural schematic of which is shown below. Figure 6 As shown, it specifically includes a memory 601 and one or more instructions 602, wherein one or more instructions 602 are stored in the memory 601 and configured to be executed by one or more processors 603 to perform the following operations:
[0214] Acquire the image to be transmitted;
[0215] The image is processed using a preset recognition model to obtain various text recognition information of the image. The text recognition information includes the text image region recognized in the image and the text content in the text image region.
[0216] Based on a pre-defined sensitive word database, text containing sensitive words is identified as sensitive information.
[0217] Encrypt the text image region corresponding to each of the sensitive information in the image to obtain an encrypted image corresponding to the image;
[0218] Generate encrypted information corresponding to the encrypted image, and transmit the encrypted image and the encrypted information of the encrypted image to the image receiver.
[0219] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data shall comply with the relevant laws, regulations and standards of the relevant regions.
[0220] The specific implementation processes and derivative methods of the above embodiments are all within the protection scope of this invention.
[0221] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0222] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0223] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for transmitting images carrying sensitive information, characterized in that, include: Acquire the image to be transmitted; The image is processed using a preset recognition model to obtain various text recognition information of the image. The text recognition information includes the text image region recognized in the image and the text content in the text image region. Based on a pre-defined sensitive word database, text containing sensitive words is identified as sensitive information. Encrypt the text image region corresponding to each of the sensitive information in the image to obtain an encrypted image corresponding to the image; The step of encrypting the text image region corresponding to each piece of sensitive information in the image to obtain an encrypted image corresponding to the image includes: Obtain a numeric key with an even number of digits; For each piece of sensitive information, the text image region in the image corresponding to the sensitive information is determined as the target image region, and the pixel sorting order of the target image region is shuffled using the digital key to encrypt the target image region; After each of the sensitive information's corresponding text image regions in the image is encrypted, an encrypted image corresponding to the image is obtained; An encrypted message corresponding to the encrypted image is generated, and the encrypted image and its encrypted message are transmitted to the image receiver; the encrypted message includes a digital key and information about each encrypted region in the image. The step of scrambling the pixel order of the target image region using the digital key to encrypt the target image region includes: Determine the pixel processing strategy corresponding to each number in the digital key; wherein, determining the pixel processing strategy corresponding to each number in the digital key includes: dividing the digital key into two key segments of equal number, wherein the numbers in one key segment correspond to a pixel processing strategy with an odd number of digits, and the numbers in the other key segment correspond to a pixel processing strategy with an even number of digits. Determine the number of pixels in the target image region, and determine the sort number of each pixel in the target image region; The first digit in the digital key is determined as the target digit; The first pixel in the target image region is determined as the target pixel. Based on the sorting number of the target pixel and the pixel processing strategy of the target number, the pixel values in the target pixel are processed; Determine whether the target pixel is the last pixel in the target image region; If the target pixel is not the last pixel in the target image region, then the pixel in the target image region that is after the target pixel is determined as the new target pixel, and then the process returns to the step of processing the pixel value in the target pixel based on the sorting number of the target pixel and the target number. If the target pixel is the last pixel in the target image region, then determine whether the target number is the last number in the digital key; If the target number is not the last number in the digital key, then the number following the target number in the digital key is determined as the new target number, and the process returns to the step of determining the first pixel in the target image region as the target pixel. If the target number is the last number in the digital key, then the encryption of the target image region is complete.
2. The method according to claim 1, characterized in that, The method, based on a preset sensitive word database, identifies text containing sensitive words as sensitive information, including: For each piece of text recognition information, based on the sensitive word database, it is determined whether there are sensitive words in the text recognition information. When there are sensitive words in the text recognition information, the text recognition information is identified as sensitive information.
3. The method according to claim 1, characterized in that, The pixel processing strategy based on the sorting number of the target pixel and the target number processes the pixel values in the target pixel, including: Determine whether the numeric type of the sorting number of the target pixel matches the numeric type in the pixel processing strategy of the target number; When the number type of the sorting number of the target pixel matches the number type in the pixel processing strategy, based on the target number, the number of pixels, and the sorting number of the target pixel, it is determined whether the target pixel satisfies the exchange condition in the pixel processing strategy of the target number. When the target pixel meets the swapping condition in the pixel processing strategy of the target number, a first pixel is determined in the target image region based on the target number and the sorting number of the target pixel, and the pixel value in the target pixel is swapped with the pixel value of the first pixel; When the target pixel does not meet the exchange condition in the pixel processing strategy of the target number, or when the number type of the sorting number of the target pixel does not match the number type in the pixel processing strategy of the target number, the processing of the pixel value of the target pixel ends.
4. The method according to claim 1, characterized in that, Also includes: When the image receiver receives the encrypted image and the encrypted information, it decrypts the encrypted information and the encrypted image to obtain the image.
5. A transmission device for carrying sensitive information images, characterized in that, include: The first acquisition unit is used to acquire the image to be transmitted; The second acquisition unit is used to process the image using a preset recognition model to acquire various text recognition information of the image. The text recognition information includes the text image region recognized in the image and the text content in the text image region. The determining unit is used to identify text containing sensitive words as sensitive information based on a preset sensitive word database. An encryption unit is used to encrypt the text image region corresponding to each piece of sensitive information in the image, so as to obtain an encrypted image corresponding to the image; The encryption unit is further configured to: Obtain a numeric key with an even number of digits; For each piece of sensitive information, the text image region in the image corresponding to the sensitive information is determined as the target image region, and the pixel sorting order of the target image region is shuffled using the digital key to encrypt the target image region; After each of the sensitive information's corresponding text image regions in the image is encrypted, an encrypted image corresponding to the image is obtained; A generation unit is used to generate encrypted information corresponding to the encrypted image, and transmit the encrypted image and the encrypted information of the encrypted image to the image receiver; the encrypted information includes a digital key and information about each encrypted region in the image; The encryption unit of the device performs a process of scrambling the pixel order of the target image region using the digital key to encrypt the target image region, including: Determine the pixel processing strategy corresponding to each number in the digital key; wherein, determining the pixel processing strategy corresponding to each number in the digital key includes: dividing the digital key into two key segments of equal number, wherein the numbers in one key segment correspond to a pixel processing strategy with an odd number of digits, and the numbers in the other key segment correspond to a pixel processing strategy with an even number of digits. Determine the number of pixels in the target image region, and determine the sort number of each pixel in the target image region; The first digit in the digital key is determined as the target digit; The first pixel in the target image region is determined as the target pixel. Based on the sorting number of the target pixel and the pixel processing strategy of the target number, the pixel values in the target pixel are processed; Determine whether the target pixel is the last pixel in the target image region; If the target pixel is not the last pixel in the target image region, then the pixel in the target image region that is after the target pixel is determined as the new target pixel, and then the process returns to the step of processing the pixel value in the target pixel based on the sorting number of the target pixel and the target number. If the target pixel is the last pixel in the target image region, then determine whether the target number is the last number in the digital key; If the target number is not the last number in the digital key, then the number following the target number in the digital key is determined as the new target number, and the process returns to the step of determining the first pixel in the target image region as the target pixel. If the target number is the last number in the digital key, then the encryption of the target image region is complete.
6. The apparatus according to claim 5, characterized in that, The determining unit performs a process based on a preset sensitive word database to determine text recognition information containing sensitive words as sensitive information, including: For each piece of text recognition information, based on the sensitive word database, it is determined whether there are sensitive words in the text recognition information. When there are sensitive words in the text recognition information, the text recognition information is identified as sensitive information.
7. A storage medium, characterized in that, The storage medium includes stored instructions, wherein, when the instructions are executed, the device containing the storage medium is controlled to perform the transmission method for carrying sensitive information images as described in any one of claims 1-4.
8. An electronic device, characterized in that, It includes a memory, and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors as described in any one of claims 1-4, the method for transmitting images carrying sensitive information.
Citation Information
Patent Citations
Image encryption method and device, image decryption method and device, electronic equipment and storage medium
CN112035847A
Information processing method and device, computer equipment and storage medium
CN114329030A
Image acquisition synchronization information encryption and use end decryption restoration method
CN114374773A
Image information desensitization method and device, equipment and storage medium
CN117390681A