An image transmission method, device, storage medium and program product
By performing encryption processing on the image matrix through transformation and reordering, the security and processing volume issues in image data transmission are solved, achieving efficient and secure image data transmission.
Patent Information
- Application Number
- CN202411709311.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-11-26
AI Technical Summary
Existing internet transmission technologies pose a risk of data leakage when transmitting image data, especially during peak trading hours, when servers may be unable to process large amounts of image data in a short period, leading to server downtime.
By performing matrix transformation and sorting reset on the original image matrix, an encrypted image is generated. The image data is then encrypted using a random matrix and a sorting value mapping table, reducing the amount of data processing and improving security.
This effectively improves the security of image data during plaintext transmission, reduces the amount of data processing, and avoids the risk of server downtime.
Smart Images

Figure CN119484720B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image transmission method, device, storage medium, and program product. Background Technology
[0002] In recent years, with the rapid development of computer technology, the financial sector is gradually promoting digital transformation, using the internet as a platform to provide convenient and high-quality financial services to society. During financial transactions, clients and servers inevitably need to exchange and transmit highly private data over the internet, such as deposit records, bills, ID card images, and facial images.
[0003] Because current internet transmission technology uses plaintext transmission, without encryption, attackers could intercept private information through illegal means such as packet sniffing, posing a serious risk of data leakage to users. For single-field data such as usernames and passwords, which are generally of fixed length and small in number, existing encryption schemes can be used. However, for image data containing large amounts of data, using encryption schemes would result in significant time consumption and require substantial storage space. Especially during peak transaction periods, when a large amount of image data is transmitted to the server simultaneously, it can cause the server to be unable to handle the large number of transactions in a short time, leading to downtime and serious impact.
[0004] Therefore, how to provide a technical solution that can conveniently encrypt and transmit image data is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] This application provides an image transmission method, device, storage medium, and program product. By performing matrix transformation and sorting resetting on each pixel in the original image matrix, the original image is encrypted. This not only reduces the amount of data processing during the encryption process but also effectively improves the security of the image data during plaintext transmission.
[0006] According to a first aspect of this application, an image transmission method is provided, applied to a client, the method comprising:
[0007] Obtain a random matrix and a sorted value mapping table from the server; wherein, the sorted value mapping table is a correspondence table between pixel values and sorted values;
[0008] The original image matrix is transformed based on the random matrix to obtain an intermediate matrix; wherein the random matrix has the same dimension as the original image matrix, and the dimension of the original image matrix includes the number of rows, columns and color channels of pixels in the original image;
[0009] The intermediate pixel values in the intermediate matrix are replaced based on the sorting value mapping table to obtain an encrypted image, which is then sent to the server.
[0010] According to a second aspect of this application, an image transmission method is provided, applied to a server, the method comprising:
[0011] Generate a random matrix and a sorted value mapping table;
[0012] The random matrix and the sorted value mapping table are sent to the client so that the client can encrypt the original image matrix according to the random matrix and the sorted value mapping table to obtain an encrypted image;
[0013] The encrypted image sent by the client is obtained, and the encrypted image is processed by inverse operation based on the random matrix and the sorting value mapping table to obtain the original image.
[0014] According to a third aspect of this application, an electronic device is provided, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image transmission method described in the first or second aspect of this application.
[0015] According to a fourth aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the image transmission method described in the first or second aspect of this application.
[0016] According to a fifth aspect of this application, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the image transmission method described in the first or second aspect of this application.
[0017] The technical solution provided in this application obtains a pre-determined random matrix and sorted value mapping table from a server; then transforms the original image matrix based on the random matrix to obtain an intermediate matrix; finally, it replaces the pixel values in the intermediate matrix based on the sorted value mapping table to obtain an encrypted image. This technical solution achieves encryption of the original image by performing matrix transformation and sorting reset on each pixel in the original image matrix. This not only reduces the amount of data processing during the encryption process but also effectively improves the security of image data during plaintext transmission.
[0018] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart of an image transmission method provided in Embodiment 1 of this application.
[0021] Figure 2 This is a schematic diagram of an encrypted image provided in Embodiment 1 of this application.
[0022] Figure 3 This is a flowchart of an image transmission method provided in Embodiment 2 of this application.
[0023] Figure 4 This is a schematic diagram of the structure of a device for implementing an image transmission method according to an embodiment of this application. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "original," "intermediate," "target," "comparison," "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] Example 1
[0027] Figure 1 This is a flowchart of an image transmission method provided in Embodiment 1 of this application. This embodiment is applicable to situations where the client encrypts and transmits image data. The method can be executed by an image encryption device, which can be implemented in hardware and / or software. This image encryption device can be configured in a device with data processing capabilities. Figure 1 As shown, the method includes the following steps.
[0028] S110. Obtain the random matrix and sorted value mapping table from the server.
[0029] The sorting value mapping table is a table that corresponds pixel values to sorting values.
[0030] The client can be a program used to provide local services to customers. For example, in the banking sector, the client can be a bank's mobile app or website. When a customer wants to make a transaction, they can open the relevant page on the bank's mobile app or website, enter their personal information as required, and submit the data. The client will then send the data entered by the user to the bank's server via the internet. After the server processes the user's request, the client will receive the processing result from the server and send the transaction processing result back to the customer.
[0031] The server can be a high-performance computer and its corresponding database system used to process the data sent by the client. When the server receives the data sent by the client, it will automatically process the data according to the defined logical rules, save the processed results to the database, and finally send feedback to the client to indicate whether the processing is complete.
[0032] Specifically, the client and server can establish a connection based on a network protocol. The client sends a request command to the server, and after authenticating the client's request, the server sends a random matrix and a sorted value mapping table to the client; or the server can proactively send a random matrix and a sorted value mapping table to a client with an established secure connection.
[0033] The random matrix and sorted value mapping table can be used to encrypt the image data sent by the client.
[0034] S120. Transform the original image matrix based on the random matrix to obtain an intermediate matrix.
[0035] The dimensions of the original image matrix include the number of rows, columns, and color channels of pixels in the original image.
[0036] In this application, image data can be viewed as a pixel matrix, and each element in the original image matrix can be changed using a random matrix of the same dimension. For example, the original image can be viewed as a three-dimensional matrix O, with dimensions W×H×C, where W is the width of the original image, H is the height of the original image, and C is the number of color channels of the original image. Taking a 1920×1080 RGB color image as an example, the image has a width of 1920 pixels, 1920 pixels per row, a height of 1080 pixels, and 1080 pixels per column. Since the image is a color RGB image, it has three color channels, meaning the image has 3 channels. Therefore, the dimension of the image matrix is 1920×1080×3.
[0037] Because existing transmission methods use plaintext transmission and data packets are not encrypted during transmission, attackers could potentially obtain the original data packets transmitted over the internet and extract key text, images, and other data uploaded by users. To avoid data leakage, this application employs matrix transformation to preprocess the original image before transmission, altering the original pixel values and preventing attackers from obtaining the original image.
[0038] Specifically, the random matrix and the original image matrix can be added or multiplied to change the pixel values in the original image matrix. It should be noted that each element in the random matrix is a random positive integer, and they are independent of each other, having no influence on one another.
[0039] For example, if a random matrix is multiplied by the original image matrix, it is necessary to ensure that the number of columns in the random matrix is equal to the number of rows in the original image matrix, or the number of rows in the random matrix is equal to the number of columns in the original image matrix.
[0040] Optionally, the random matrix has the same dimension as the original image matrix; correspondingly, the original image matrix is transformed based on the random matrix to obtain an intermediate matrix, including: traversing each original pixel in the original image matrix, determining the reference pixel in the random matrix that has the same position as each original pixel; and adding the original pixel and the reference pixel at the same position to obtain the intermediate matrix.
[0041] Specifically, the original image matrix O has dimensions W×H×C. Iterate through all the original pixel points O[i,j,k] (1≤i≤W,1≤j≤H,1≤k≤C) in the original image matrix, and determine the corresponding pixel point R[i,j,k] in the random matrix R that has the same position as the original pixel point. Then, add the original pixel point and the corresponding pixel point at the same position using the following formula.
[0042] T[i,j,k]=O[i,j,k]+R[i,j,k];
[0043] In the formula, T[i,j,k] represents the pixel points of the intermediate matrix.
[0044] After adding the pixels at each position according to the above formula, each original pixel O[i,j,k] in the original image matrix is replaced by a new pixel T[i,j,k], resulting in the intermediate matrix T.
[0045] Since the intermediate matrix T is obtained by adding a random matrix R to the original image matrix O, each pixel value in the intermediate matrix T has undergone a huge change compared to the original pixel value. Under the condition of only having the intermediate matrix T, it is already difficult for the attacker to recover the original image matrix.
[0046] S130. Replace each intermediate pixel value in the intermediate matrix based on the sorting value mapping table to obtain an update matrix, generate an encrypted image according to the update matrix, and send the encrypted image to the server.
[0047] The sorting value mapping table is a table that corresponds to pixel values and sorting values.
[0048] For example, if a pixel value sequence is {1,3,5,6,8}, then according to the sorting position of the pixel value in the sequence, the sorting value corresponding to pixel value 1 is determined to be 1, the sorting value corresponding to pixel value 3 is 2, the sorting value corresponding to pixel value 5 is 3, the sorting value corresponding to pixel value 6 is 4, and the sorting value corresponding to pixel value 8 is 5.
[0049] For example, the intermediate pixel values in the intermediate matrix can be sorted in a certain order to determine the sorting value, such as from top to bottom and from left to right. The sorting value mapping table is then used to replace the pixel values in the intermediate matrix that have the same sorting value. For instance, if the sequence of intermediate pixel values in the intermediate matrix, sorted in a preset order, is {25,10,2,80,60}, then according to the sorting value mapping table in the example above, it is replaced with {1,3,5,6,8}.
[0050] Furthermore, the update matrix can be converted into a visualized image format based on the pixel values at each position in the update matrix. For example, an original image is a photocopy of a product purchase and sale contract, containing important information such as the product amount and quantity. After encrypting the photocopy image using the encryption method described above, the result is as follows: Figure 2 The encrypted image shown. (By...) Figure 2 It can be observed that the processed image has undergone a significant visual change compared to the original image, effectively concealing key information in the original image and thus protecting the privacy of the original image.
[0051] Optionally, an update matrix is obtained by replacing each intermediate pixel value in the intermediate matrix based on the sorting value mapping table, including: determining the first sorting value corresponding to each intermediate pixel value in the sorting value mapping table; and replacing each intermediate pixel value in the intermediate matrix with the first sorting value corresponding to the intermediate pixel value to obtain the update matrix.
[0052] In this application, the intermediate matrix can be divided into at least one two-dimensional matrix according to the number of color channels; the first sorting value corresponding to each pixel value in the two-dimensional matrix is determined in the sorting value mapping table, and each pixel value is replaced with the first sorting value corresponding to each pixel value in turn.
[0053] For example, if the pixel value sequence in a sorting value mapping table is {1,3,5,6,8}, then according to the sorting position of the pixel value in this sequence, the sorting value corresponding to pixel value 1 is determined to be 1, the sorting value corresponding to pixel value 3 is 2, the sorting value corresponding to pixel value 5 is 3, the sorting value corresponding to pixel value 6 is 4, and the sorting value corresponding to pixel value 8 is 5. Based on the intermediate pixel values in the intermediate matrix, the first sorting value corresponding to the intermediate pixel value is found in the sorting value mapping table and replaced. For example, if an intermediate pixel value is 5, it is replaced with 3; similarly, if another intermediate pixel value is 8, it is replaced with 5.
[0054] Optionally, after replacing each intermediate pixel value in the intermediate matrix based on the sorted value mapping table to obtain an update matrix, the method further includes: if the maximum element value of the update matrix is greater than the maximum pixel value, then determining a scaling ratio based on the maximum element value and the maximum pixel value; and scaling the update matrix based on the scaling ratio to obtain a scaling matrix.
[0055] It is understandable that in the updated matrix after random matrix processing and sorting of the original image matrix, there may be element values greater than the maximum pixel value. For example, an element in the updated matrix may have a value of 280, which is greater than the maximum pixel value of 255. In this case, if an encrypted image is generated based on this updated matrix, image conversion may fail or become abnormal.
[0056] Therefore, this application determines the scaling ratio based on the maximum element value and the maximum pixel value, thereby scaling down the update matrix to obtain matrix data that can be used to transform the image.
[0057] Specifically, the ratio of the maximum pixel value to the maximum element value can be determined as the scaling factor. For example, if the maximum element value in the update matrix is 510 and the maximum pixel value is 255, then the scaling factor can be determined to be 0.5. As another example, if the maximum element value in the update matrix is 600 and the maximum pixel value is 255, the ratio is approximately 0.425, and to facilitate scaling, the scaling factor can be determined to be 0.4.
[0058] This invention provides an image transmission method. The method involves obtaining a pre-determined random matrix and sorted value mapping table from a server; transforming the original image matrix based on the random matrix to obtain an intermediate matrix; and finally replacing each pixel value in the intermediate matrix based on the sorted value mapping table to obtain an encrypted image. This technical solution encrypts the original image by performing matrix transformation and sorting on each pixel in the original image matrix. This not only reduces the amount of data processing during encryption but also effectively improves the security of image data during plaintext transmission.
[0059] Example 2
[0060] Figure 3 This is a flowchart illustrating an image transmission method provided in Embodiment 2 of this application. The method is applied to a server. This embodiment is applicable to situations where the server decrypts and transmits image data. The method can be executed by an image transmission device, which can be implemented in hardware and / or software and can be configured in a device with data processing capabilities. Figure 3 As shown, the method in this embodiment specifically includes the following steps.
[0061] S210. Generate a random matrix and a sorted value mapping table.
[0062] Both the random matrix and the sorted value mapping table can be generated by the server for images of different resolutions. For example, common image resolutions include 640×480, 1024×768, and 2048×1536.
[0063] Optionally, generating a sorting value mapping table includes: generating a first sequence containing a first preset number of integer values and a second preset number of floating-point values; sorting the first sequence in ascending order to obtain a second sequence; and generating a sorting value mapping table based on each integer value in the second sequence and the second sorting value corresponding to each integer value.
[0064] In order to further change the original pixel values after random matrix transformation, this application uses nonlinear transformation to process the transformed matrix, thereby further improving the security of image transmission.
[0065] Specifically, an empty sequence P can be generated first, and then integer values from 0 to 255 can be added to the empty sequence P. At this point, sequence P already contains 256 different pixel values. Then, n different random floating-point numbers q1-q are generated. n Then add it to sequence P, and sort sequence P in ascending order. The sorting algorithm used in the sorting process can be flexibly selected, such as the efficient quicksort.
[0066] Suppose that sequence P is sorted to obtain a new sequence H. In the new sequence H, the index of the minimum value is 0, and the index of the maximum value is 255+n. Each item in the sorting mapping table is (x, i), where x is a value in sequence H and i is the index of x. Once the server generates the sorting value mapping table, it can send the table to the client.
[0067] Optionally, the value of each pixel in the random matrix is greater than or equal to a first preset threshold and less than or equal to a second preset threshold; correspondingly, the integer value in the first sequence is greater than or equal to the first preset threshold and less than or equal to the sum of the second preset threshold and the maximum pixel value.
[0068] Specifically, the value range of any pixel R[i,j,k] in the random matrix is [0,t], where t is the maximum value range of each pixel in the random matrix, i.e., the second preset threshold.
[0069] Accordingly, in order to ensure that the server can fully decrypt the encrypted image, the maximum value of the integer values in the first sequence should be 255+t.
[0070] This application ensures that the server can completely decrypt the encrypted image by limiting the relationship between the integer values in the sorted mapping table and the pixel values in the random matrix.
[0071] S220. The random matrix and the sorted value mapping table are sent to the client so that the client can encrypt the original image matrix according to the random matrix and the sorted value mapping table to obtain an encrypted image.
[0072] S230. Obtain the encrypted image sent by the client, and perform inverse operation on the encrypted image based on the random matrix and the sorting value mapping table to obtain the original image.
[0073] Specifically, the encrypted image matrix can first be inversely operated on using the sorted value mapping table, then multiplied by the inverse of the random matrix to obtain the original image matrix, and finally the original image matrix is used to generate the original image.
[0074] This invention provides an image transmission method applied to a server. The method involves generating a random matrix and a sorted value mapping table; sending the random matrix and sorted value mapping table to a client, enabling the client to encrypt the original image matrix according to the random matrix and sorted value mapping table to obtain an encrypted image; acquiring the encrypted image sent by the client and performing an inverse operation on the encrypted image based on the random matrix and sorted value mapping table to obtain the original image. This technical solution, by generating a random matrix and sorted value mapping table on the server side and sending it to the client to encrypt the image according to preset rules, reduces the amount of data processing during image data encryption and effectively improves the security of image data during plaintext transmission.
[0075] Example 3
[0076] Figure 4 A schematic diagram of the structure of a device 10 that can be used to implement embodiments of this application is shown. The device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0077] like Figure 4 As shown, device 10 includes at least one processor 11 and a memory, such as read-only memory (ROM) 12, random access memory (RAM) 13, etc., communicatively connected to at least one processor 11. The memory stores computer programs executable by at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of device 10. The processor 11, ROM 12, and RAM 13 are interconnected via bus 14. Input / output (I / O) interface 15 is also connected to bus 14.
[0078] Multiple components in device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0079] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as image transmission methods.
[0080] In some embodiments, the image transfer method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the image transfer method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the image transfer method by any other suitable means (e.g., by means of firmware).
[0081] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0082] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0083] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0084] To provide interaction with a user, the systems and techniques described herein can be implemented on a device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or haptic feedback); and input from the user can be received in any form (including sound input, voice input, or haptic input).
[0085] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0086] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0087] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0088] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. An image transmission method characterized by, Applied to the client, the method comprises: Obtaining a random matrix and an order value mapping table from a server; wherein the order value mapping table is a corresponding relationship table of pixel values and order values; Transforming an original image matrix based on the random matrix to obtain an intermediate matrix; wherein the dimensions of the original image matrix include the number of rows, the number of columns and the number of color channels of the pixels in the original image; Replacing each intermediate pixel value in the intermediate matrix based on the order value mapping table to obtain an updated matrix, and generating an encrypted image according to the updated matrix, and sending the encrypted image to the server.
2. The method of claim 1, wherein, Replacing each intermediate pixel value in the intermediate matrix based on the order value mapping table to obtain an updated matrix comprises: Determining a first order value corresponding to each intermediate pixel value in the order value mapping table respectively; Replacing each intermediate pixel value in the intermediate matrix with the first order value corresponding to the intermediate pixel value to obtain an updated matrix.
3. The method of claim 2, wherein, After replacing each intermediate pixel value in the intermediate matrix based on the order value mapping table to obtain an updated matrix, the method further comprises: If the maximum element value of the updated matrix is greater than the maximum pixel value, determining a scaling ratio according to the maximum element value and the maximum pixel value; Scaling the updated matrix based on the scaling ratio to obtain a scaled matrix.
4. The method of claim 1, wherein, The random matrix has the same dimensions as the original image matrix; Correspondingly, transforming the original image matrix based on the random matrix to obtain an intermediate matrix comprises: Traversing each original pixel point in the original image matrix, and determining a corresponding control pixel point in the random matrix with the same position as each original pixel point; Adding the pixel values of the original pixel point and the control pixel point at the same position respectively to obtain an intermediate matrix.
5. An image transmission method characterized by, Applied to the server, the method comprises: Generating a random matrix and an order value mapping table; Sending the random matrix and the order value mapping table to the client, so that the client encrypts the original image matrix based on the random matrix and the order value mapping table to obtain an encrypted image; Obtaining the encrypted image sent by the client, and performing inverse operation processing on the encrypted image based on the random matrix and the order value mapping table to obtain an original image.
6. The method of claim 5, wherein, Generating an order value mapping table comprises: Generating a first sequence containing a first preset number of integer values and a second preset number of floating point values; Sorting the first sequence in ascending order to obtain a second sequence, and generating an order value mapping table according to each integer value in the second sequence and the second order value corresponding to each integer value.
7. The method of claim 6, wherein, The values of each pixel point in the random matrix are greater than or equal to a first preset threshold value and less than or equal to a second preset threshold value; Correspondingly, the integer values in the first sequence are greater than or equal to the first preset threshold value and less than or equal to the sum of the second preset threshold value and the maximum pixel value.
8. An electronic device, comprising: The device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the image transmission method of any one of claims 1-4 or 5-7.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a processor to implement the image transmission method of any one of claims 1-4 or 5-7 when executed by the processor.
10. A computer program product, characterised in that, The computer program product comprises a computer program which, when executed by a processor, implements the image transmission method according to any one of claims 1-4 or 5-7.
Citation Information
Patent Citations
Image encryption method, device and equipment and readable storage medium
CN110535623A
Color image encryption method based on two-dimensional chaotic mapping
CN112800444A