A test data encryption method for an unmanned vehicle
By segmenting, correcting grayscale histograms, and equalizing the test data of autonomous vehicles, and combining it with an asymmetric encryption algorithm, the problems of slow encryption speed and inability to change statistical characteristics in existing technologies are solved, thus achieving secure and reliable encryption of test data.
Patent Information
- Application Number
- CN202310181192.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-01
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-03-01
AI Technical Summary
In existing technologies, asymmetric encryption algorithms are slow and unsuitable for encrypting large amounts of test data. Image encryption methods based on chaotic mapping cannot resist statistical analysis attacks, and existing methods cannot effectively change the statistical characteristics of images.
By dividing the plaintext image into blocks, a key is constructed to obtain the initial value sequence. Based on the left and right boundaries of the grayscale histogram, a correction coefficient equation is constructed. The grayscale histogram is then frequency-corrected and histogram equalized to generate ciphertext image blocks. Finally, an asymmetric encryption algorithm is used to encrypt the boundary sequence.
It effectively alters the statistical characteristics of plaintext images, enhances the security of ciphertext images, resists statistical analysis attacks, and ensures the decryptability and accuracy of the encryption method.
Smart Images

Figure CN116112149B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of encrypted transmission, in particular to a test data encryption method of an unmanned vehicle. BACKGROUND
[0002] Before an unmanned vehicle that has completed initial development or upgrading is formally put into use, test data needs to be used to test the functions of the unmanned vehicle, therefore, the test data is crucial to the function test of the unmanned vehicle, and the test data contains data of key technologies related to the unmanned vehicle, which may lead to leakage of the key technologies of the unmanned vehicle if stolen and analyzed. In order to ensure the safety of the test data of the unmanned vehicle, the test data needs to be encrypted and transmitted.
[0003] Non-symmetric encryption algorithms are all based on mathematical problems, and although they have high security, the encryption and decryption speed is slow, therefore, non-symmetric encryption algorithms are only suitable for encrypting a small amount of data. For images in the test data, which have a large amount of data and high redundancy, non-symmetric encryption algorithms are not suitable. Conventional image encryption methods based on chaotic mapping only change the positions of the pixel points in the image, but do not change the gray values of the pixel points in the image, although the strong correlation between the pixel points in the image is broken, the gray level histogram of the encrypted image does not change, that is, the statistical characteristics of the image do not change, therefore, the image cannot resist statistical analysis attacks by attackers. SUMMARY
[0004] In order to solve the above problems, the present application provides a test data encryption method of an unmanned vehicle, which comprises:
[0005] obtaining a plaintext image, dividing the plaintext image into blocks to obtain all plaintext image blocks;
[0006] constructing a key to obtain a starting value sequence according to the key;
[0007] encrypting any one of the plaintext image blocks, comprising: obtaining the left boundary and the right boundary of the gray level histogram of the plaintext image block, constructing a correction coefficient equation according to the frequencies of all gray values between the left boundary and the right boundary of the gray level histogram, solving the correction coefficient equation to obtain the correction coefficient of the plaintext image block; frequency correcting the gray level histogram according to the correction coefficient to obtain a corrected histogram of the plaintext image block; obtaining a starting value of the plaintext image block according to the starting sequence; histogram equalizing the corrected histogram of the plaintext image block according to the starting value to obtain a mapping relationship of the plaintext image block; encrypting all plaintext pixel points of the plaintext image block according to the mapping relationship, and taking an image block composed of all ciphertext pixel points as a ciphertext image block;
[0008] All the plaintext image blocks of the plaintext image are encrypted, and an image composed of all the ciphertext image blocks is recorded as a ciphertext image.
[0009] Further, the step of constructing the correction coefficient equation according to the frequencies of all the gray values between the left boundary and the right boundary of the gray histogram comprises:
[0010] The correction coefficient of the plaintext image block is set as The expression of the correction coefficient equation is specifically:
[0011]
[0012] In the formula, P1 and P2 respectively represent the left boundary and the right boundary of the gray histogram of the plaintext image block, p(h) represents the frequency of the gray value h on the gray histogram of the plaintext image block, represents rounding up, and δ(P1, P2) represents the number of all the gray values with a frequency of 0 between the left boundary P1 and the right boundary P2.
[0013] Further, the step of performing frequency correction on the gray histogram according to the correction coefficient to obtain the corrected histogram of the plaintext image block comprises:
[0014] For all the gray values with a frequency of 0 between the left boundary and the right boundary of the gray histogram of the plaintext image block, the corrected frequency of each gray value is set as .
[0015] For all the gray values with a frequency not equal to 0 between the left boundary and the right boundary of the gray histogram of the plaintext image block, the corrected frequency of the gray value is set as , wherein represents the frequency of the gray value , represents the correction coefficient, and represents rounding up.
[0016] For all the gray values not belonging to the left boundary and the right boundary of the gray histogram of the plaintext image block, the frequencies of the gray values are not corrected and remain 0.
[0017] The histogram composed of the corrected frequencies of all the gray values of the plaintext image block is recorded as the corrected histogram of the plaintext image block.
[0018] Further, the step of histogram equalization of the modified histogram of the plaintext image block according to the initial value to obtain the mapping relationship of the plaintext image block comprises:
[0019] According to the modified frequency of all the gray values in the modified histogram of the plaintext image block, the cumulative frequency of the gray value is accumulated, and the gray value The specific calculation formula of the cumulative frequency of the gray value
[0020]
[0021] In the formula, The cumulative frequency of the gray value in the modified histogram of the plaintext image block is represented, The modified frequency of the gray value 0 to the gray value between the first gray value is represented;
[0022] The equalization result of the gray value and the gray value in the plaintext image block forms a pair of mapping relationship The calculation formula of the equalization result of the gray value is as follows:
[0023]
[0024] In the formula, The equalization result of the gray value is represented, The cumulative frequency of the gray value in the modified histogram of the plaintext image block is represented, The initial value of the corresponding plaintext image block is represented, The remainder of division is represented.
[0025] Further, the step of encrypting all the plaintext pixel points in the plaintext image block according to the mapping relationship comprises:
[0026] For any one plaintext pixel point in the plaintext image block, according to the gray value of the plaintext pixel point, the corresponding mapping relationship is obtained, The equalization result in the mapping relationship is taken as the ciphertext, The gray value of the plaintext pixel is set as the ciphertext,
[0027] And the plaintext pixel point after setting the gray value is recorded as the ciphertext pixel point.
[0028] 1、The present application obtains the mapping relationship of the plaintext image block by histogram equalization of the modified histogram of the plaintext image block combined with the start value of the plaintext image block, encrypts all plaintext image blocks according to the mapping relationship, and obtains the ciphertext image composed of all ciphertext image blocks. As the start value and the gray histogram of different plaintext image blocks are different, the mapping relationship obtained after histogram equalization is different, so the encryption result of the plaintext pixel points with the same gray value in different plaintext image blocks may be different, and the encryption result of the plaintext pixel points with different gray values in different plaintext image blocks may be the same, so that the statistical image of the final ciphertext image and the statistical characteristics of the plaintext image are completely different. Therefore, the encryption method of the present application can change the statistical characteristics of the plaintext image, so that the attacker cannot decipher the ciphertext image by analyzing the statistical rules of the plaintext image and the ciphertext image, and the ciphertext image can resist the statistical analysis attack of the attacker.
[0029] 2、The frequency of the gray value between which the frequency is zero in the gray histogram of the plaintext image block is not swallowed after the frequency correction of the gray histogram of the plaintext image block according to the correction coefficient, so that the distance between the gray values in the original gray histogram can be retained in the equalized gray histogram. At the same time, the range of the distribution of the gray values in the original gray histogram is retained by saving the left boundary and the right boundary of the gray histogram. The distance and the distribution range of the gray values in the original gray histogram are retained in the present application, so that the original gray histogram can be accurately obtained according to the equalized mapping result, and the ciphertext image can be accurately decrypted according to the mapping relationship, so that the decryptability and the decryption accuracy of the encryption method are ensured. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art and the advantages thereof, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0031] Figure 1 A step flow chart of a test data encryption method of an unmanned vehicle provided by an embodiment of the present application is shown in the figure.
[0032] Figure 2 A gray histogram provided by an embodiment of the present application is shown in the figure.
[0033] Figure 3 A gray histogram provided by an embodiment of the present application is shown in the figure.
[0034] Figure 4 A step flow chart of a test data encryption method of an unmanned vehicle provided by an embodiment of the present application is shown in the figure. Figure 2 andFigure 3 The equalized grayscale histogram;
[0035] Figure 5 Provided for one embodiment of the present invention Figure 2 The corrected histogram of the grayscale histogram;
[0036] Figure 6 Provided for one embodiment of the present invention Figure 3 The corrected histogram of the grayscale histogram;
[0037] Figure 7 Provided for one embodiment of the present invention Figure 5 The grayscale histogram after equalization of the corrected histogram;
[0038] Figure 8 Provided for one embodiment of the present invention Figure 6 The grayscale histogram after equalization of the corrected histogram. Detailed Implementation
[0039] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a test data encryption method for unmanned vehicles proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0041] The following description, in conjunction with the accompanying drawings, details a specific scheme for encrypting test data of an unmanned vehicle provided by the present invention.
[0042] Please see Figure 1 The diagram illustrates a flowchart of a test data encryption method for an autonomous vehicle according to an embodiment of the present invention. The method includes the following steps:
[0043] S001, acquire plaintext image, divide plaintext image into blocks, and obtain all plaintext image blocks.
[0044] 1. Obtain plaintext images.
[0045] Data is typically collected using test vehicles equipped with high-end data loggers, including cameras, millimeter-wave radar, and lidar. This test data is used to accurately simulate traffic conditions in the laboratory and test the correctness of ADAS perception algorithms and control logic.
[0046] The test data collected by the camera is image data, and an image in the image data is denoted as a plaintext image, denote the size of the plaintext image, denote the length and width of the plaintext image, respectively.
[0047] 2. By presetting the size The plaintext image is divided into blocks to obtain all plaintext image blocks, denote the size of the plaintext image block, denote the side length of the plaintext image block. In this embodiment, the side length of the plaintext image block is , the size of the plaintext image block is In other embodiments, the implementer can set the side length and size of the plaintext image block as needed.
[0048] S002, construct a key and obtain a starting value sequence according to the key.
[0049] The one-dimensional Logistic map is a typical chaotic map, and the model is When the coefficient , the system enters a chaotic state, and a chaotic sequence between is generated.
[0050] In the range of , , , a key is randomly generated, and the one-dimensional Logistic chaotic map model will be iterated times according to the parameters of the key. In order to prevent initial value interference, the first numerical values are removed, each of the remaining numerical values is multiplied by , and rounding is performed. The first numerical value after rounding is denoted as a starting value , and a sequence composed of starting values is denoted as a starting value sequence.
[0051] wherein, , in the formula, denote the size of the plaintext image, denote the length and width of the plaintext image, respectively, denote the size of the image block, denote the side length of the image block, denote the upward rounding.
[0052] It should be noted that the key is obtained only once in the entire encryption process and is stored separately in the sending end and the receiving end. When the encrypted ciphertext image is transmitted from the sending end to the receiving end, the key does not need to be transmitted, thereby ensuring the security of the key.
[0053] S003, obtaining a correction coefficient of the plaintext image block according to the gray level histogram of the plaintext image block, performing frequency correction on the gray level histogram of the plaintext image block according to the correction coefficient, and obtaining a corrected histogram of the plaintext image block.
[0054] It should be noted that the gray level histogram of the plaintext image block is histogram equalized in combination with the starting value sequence to obtain a mapping result of the equalized gray level histogram, and the plaintext image block is encrypted according to the mapping result to obtain a ciphertext image block.
[0055] However, since the mapping result of the histogram equalization is only related to the frequency of the gray level histogram, and is not related to the distribution of the frequency, the histogram equalization is performed on different plaintext image blocks. If the frequency of the gray level histogram of two plaintext image blocks has the same rule, for example Figure 2 and Figure 3 corresponding two gray level histograms, the results of the histogram equalized plaintext image blocks of the two plaintext image blocks are the same, for example Figure 2 and Figure 3 corresponding two histogram equalized plaintext image blocks of the gray level histograms have the same result Figure 4 as shown in the gray level histogram. Therefore, the mapping results of the histogram equalization of the gray level histograms of different plaintext image blocks may be the same, resulting in that the decryption result of the ciphertext image is not unique when the ciphertext image is decrypted according to the mapping result, and the ciphertext image block cannot be accurately restored.
[0056] According to an important property of the mapping result of the equalization of the gray level histogram: after equalization, the frequency of the gray level histogram does not change at all, and the distribution of the gray level values in the gray level histogram changes, which is reflected in two aspects: on the one hand, the range of the distribution of the gray level values changes, and on the other hand, the distance between the gray level values changes. Therefore, in order to accurately obtain the original gray level histogram according to the equalized mapping result, it is necessary to preserve the distribution of the gray level values. For the range of the distribution of the gray level values, the left boundary and the right boundary of the gray level histogram are preserved, and for the distance between the gray level values, the gray level histogram is frequency corrected, so that the gray level values with a frequency of 0 between the gray level values are not swallowed after histogram equalization, thereby reflecting the distance between the gray level values.
[0057] In the embodiment, for any one of the plaintext image blocks, the correction coefficient of the plaintext image block is obtained according to the gray histogram of the plaintext image block, the frequency of the gray histogram of the plaintext image block is corrected according to the correction coefficient, and the corrected histogram of the plaintext image block is obtained, and the specific steps are as follows:
[0058] 1. Obtain the correction coefficient of the plaintext image block according to the gray histogram of the plaintext image block.
[0059] Obtain the gray histogram of the plaintext image block, in which the horizontal axis is the gray value, the vertical axis is the frequency of the gray value, and the frequency of the gray value is . The gray value with the minimum gray value and the frequency not equal to 0 in the gray histogram is recorded as the left boundary , and the gray value with the maximum gray value and the frequency not equal to 0 in the gray histogram is recorded as the right boundary .
[0060] The correction coefficient of the plaintext image block is set as , the correction coefficient equation is constructed according to the frequencies of all the gray values between the left boundary and the right boundary of the gray histogram of the plaintext image block, and the expression of the correction coefficient equation is as follows:
[0061]
[0062] In the formula, the left boundary and the right boundary of the gray histogram of the plaintext image block are respectively represented by , the frequency of the gray value in the gray histogram of the plaintext image block is represented by , the upward rounding is represented by , and the number of the gray values with the frequency of 0 between the left boundary and the right boundary is represented by .
[0063] Since the objects in the above equation, except the correction coefficient , can be obtained through the gray histogram, the correction coefficient of the plaintext image block can be obtained according to the above equation. The correction coefficient of the plaintext image block is obtained by solving the above equation.
[0064] For example, the correction coefficient Figure 2 of the gray histogram as shown in FIG. 2 is , and the correction coefficient Figure 3 of the gray histogram as shown in FIG. 3 is .
[0065] 2. Apply frequency correction to the grayscale histogram of the plaintext image block based on the correction coefficient to obtain the corrected histogram of the plaintext image block.
[0066] It should be noted that the underlying logic of histogram equalization is to broaden gray values with high frequencies in plaintext image blocks and merge gray values with low frequencies. Therefore, equalization of the gray-level histogram can result in a "swallowing" phenomenon, especially for gray values with a frequency of 0. The number of gray values with a frequency of 0 reflects the distance between them. To accurately obtain the original gray-level histogram based on the equalization mapping result, it is necessary to preserve the distance between gray values; that is, to ensure that gray values with a frequency of 0 are not swallowed after histogram equalization. This invention corrects the frequency of the gray-level histogram using a correction coefficient, ensuring that gray values with a frequency of 0 are not swallowed after histogram equalization, thereby preserving the distance between gray values.
[0067] In this embodiment, the grayscale histogram of the plaintext image block is frequency corrected according to the correction coefficient to obtain the corrected histogram of the plaintext image block. The specific steps are as follows:
[0068] (1) In the grayscale histogram of a plaintext image patch, the left boundary With right boundary For all grayscale values with a frequency of 0, adjust the frequency of each grayscale value. Set as .
[0069] (2) In the grayscale histogram of a plaintext image block, the left boundary With right boundary All grayscale values with frequencies other than 0 will be converted to grayscale values. Correction frequency Set as In the formula, Represents grayscale value frequency, This represents the correction factor. This indicates rounding up to the nearest integer.
[0070] (3) In the grayscale histogram of the plaintext image block, the part that does not belong to the left boundary With right boundary The frequencies of all grayscale values in between are not corrected; the frequency remains 0.
[0071] The histogram composed of the corrected frequencies of all gray values in the plaintext image block is denoted as the corrected histogram of the plaintext image block.
[0072] For example, Figure 2 The grayscale histogram shown is corrected for frequency using correction coefficients, and the corrected histogram is as follows: Figure 5 As shown,Figure 3 The correction histogram shown in the gray scale histogram is frequency-corrected according to the correction coefficient, as shown in the figure. Figure 6
[0073] The gray scale histogram of the plaintext image block is frequency-corrected according to the correction coefficient, so that the gray scale value between which the frequency is zero is not swallowed after the histogram equalization, and then the equalized gray scale histogram can retain the distance between the gray scale values in the original gray scale histogram; at the same time, the left boundary and the right boundary of the gray scale histogram are saved to retain the range of the gray scale value distribution in the original gray scale histogram; by retaining the distance and the distribution range of the gray scale values in the original gray scale histogram, it is ensured that the original gray scale histogram can be accurately obtained according to the mapping result of the equalization, and then the ciphertext image is accurately decrypted according to the mapping relationship, so that the decryptability and the decryption accuracy of the encryption method are ensured.
[0074] S004, obtaining the starting value of the plaintext image block according to the starting sequence; histogram equalizing the correction histogram of the plaintext image block according to the starting value to obtain the mapping relationship of the plaintext image block; encrypting all plaintext image blocks according to the mapping relationship to obtain the ciphertext image composed of all ciphertext image blocks.
[0075] 1. Obtain the starting value of the plaintext image block according to the starting sequence.
[0076] All plaintext image blocks of the plaintext image are arranged in the order from left to right and from top to bottom, and for the first plaintext image block, the first value in the starting value sequence is taken as the starting value of the first plaintext image block.
[0077] 2. Histogram equalize the correction histogram of the plaintext image block according to the starting value to obtain the mapping relationship of the plaintext image block.
[0078] (1) Calculate the cumulative frequency of all gray scale values according to the correction histogram.
[0079] According to the correction frequency of all gray scale values in the correction histogram, the cumulative frequency of the gray scale value is accumulated, and the specific calculation formula of the cumulative frequency of the gray scale value is:
[0080]
[0081] In the formula, F (i) represents the cumulative frequency of the gray scale value i, and F (i-1) represents the correction frequency of the gray scale value i-1 in the correction histogram. The correction frequency for each grayscale value.
[0082] (2) Obtain the mapping relationship based on the cumulative frequency of all gray values and the initial value of the plaintext image block.
[0083] grayscale values in plaintext image blocks With grayscale value equilibrium result Form a mapping relationship grayscale value equilibrium result The calculation formula is:
[0084]
[0085] In the formula, Represents grayscale value The equilibrium result, The gray values on the modified histogram representing plaintext image patches The cumulative frequency, This indicates the starting value of the corresponding plaintext image block. This indicates taking the remainder after division.
[0086] For example, Figure 5 The initial value of the modified histogram shown is 5. Histogram equalization is performed on the modified histogram based on the initial value. Figure 5 The result of histogram equalization of the modified histogram is shown below. Figure 7 As shown; Figure 6 The initial value of the modified histogram shown is 5. Histogram equalization is performed on the modified histogram based on the initial value. Figure 6 The result of histogram equalization of the modified histogram is shown below. Figure 8 As shown.
[0087] 3. Encrypt all plaintext image blocks according to the mapping relationship to obtain a ciphertext image composed of all ciphertext image blocks.
[0088] For the first in plaintext image For each plaintext image block, the mapping relationship of all grayscale values of the plaintext image block is obtained according to step 2 above. The plaintext image block is encrypted based on the mapping relationship. Specifically, for any plaintext pixel in the plaintext image block, the corresponding mapping relationship is obtained based on the grayscale value of the plaintext pixel, and the equalization result in the mapping relationship is... As ciphertext, the grayscale value of the plaintext pixel is set as ciphertext, and the plaintext pixel after the grayscale value is set is recorded as the ciphertext pixel; all plaintext pixels in the plaintext image block are converted into ciphertext pixels, and the image block composed of all ciphertext pixels is recorded as the ciphertext image block.
[0089] All the plaintext image blocks in the plaintext image are encrypted to obtain corresponding ciphertext image blocks, and an image composed of all the ciphertext image blocks is recorded as a ciphertext image.
[0090] The present application performs histogram equalization on the modified histogram of the plaintext image block by combining the starting value of the plaintext image block, obtains the mapping relationship of the plaintext image block, and encrypts all the plaintext image blocks according to the mapping relationship to obtain a ciphertext image composed of all the ciphertext image blocks. As the starting value and the grayscale histogram of different plaintext image blocks are different, the mapping relationship obtained after histogram equalization is different, the encryption result of the plaintext pixel points with the same grayscale value in different plaintext image blocks may be different, and the encryption result of the plaintext pixel points with different grayscale values in different plaintext image blocks may be the same, so that the statistical image of the final ciphertext image and the statistical characteristics of the plaintext image are completely different. Therefore, the encryption method of the present application can change the statistical characteristics of the plaintext image, so that the attacker cannot decipher the ciphertext image by analyzing the statistical rules of the plaintext image and the ciphertext image, and the ciphertext image can resist statistical analysis attacks of the attacker.
[0091] 4, the left and right boundaries of all plaintext image blocks are arranged in sequence to form a sequence, and the sequence is encrypted by an asymmetric encryption algorithm to obtain a ciphertext sequence. In this embodiment, the asymmetric encryption algorithm includes but is not limited to RSA algorithm, DSA algorithm or ECC algorithm and other asymmetric encryption algorithms.
[0092] By saving the left and right boundaries of the grayscale histogram, the range of the distribution of the grayscale values in the original grayscale histogram is preserved; by preserving the distance and distribution range of the grayscale values in the original grayscale histogram, the present application can accurately obtain the original grayscale histogram according to the equalized mapping result, and then accurately decrypt the ciphertext image according to the mapping relationship, thereby ensuring the decryptability and decryption accuracy of the encryption method.
[0093] 5, the ciphertext image and the ciphertext sequence are transmitted by the sending end to the receiving end.
[0094] S005, the ciphertext image is divided into blocks to obtain ciphertext image blocks, and the ciphertext image blocks are decrypted according to the key to obtain a plaintext image composed of all the plaintext image blocks.
[0095] The receiving end receives the ciphertext image and the ciphertext sequence from the sending end, and decrypts the ciphertext image by the key stored in the receiving end. The specific steps are as follows:
[0096] 1, the ciphertext image is divided into blocks to obtain ciphertext image blocks.
[0097] 2, the ciphertext sequence is decrypted to obtain a boundary sequence, and the initial value sequence is obtained according to the key.
[0098] 3. For any ciphertext image block, obtain the left boundary of the ciphertext image block based on the boundary sequence. and right boundary Obtain the grayscale histogram of the encrypted image block, and then obtain the number of grayscale values with non-zero frequencies in the grayscale histogram. Assume the correction coefficient for the ciphertext image block is... Construct the correction coefficient equation The correction coefficient equation is solved to obtain the correction coefficients for the plaintext image patch. .
[0099] 4. In the grayscale histogram of the encrypted image block, the left boundary... With right boundary All grayscale values with frequencies not equal to 0 are adjusted according to the correction factor. The correction frequency for each grayscale value is obtained as follows: Calculate the cumulative frequency of grayscale values The initial values of the encrypted image blocks are obtained based on the initial value sequence. If the grayscale value is not less than the initial value, the formula for calculating the grayscale value interval is as follows: If the grayscale value is less than the initial value, the formula for calculating the grayscale value interval is as follows: .
[0100] 5. Based on the grayscale values in the encrypted image block Obtain the mapping value at intervals Mapping value The calculation formula is grayscale value and mapping value Form a mapping relationship .
[0101] 6. Decrypt the ciphertext image block, specifically: for any ciphertext pixel in the ciphertext image block, obtain the corresponding mapping relationship based on the grayscale value of the ciphertext pixel, and then decrypt the mapping value in the mapping relationship. As plaintext, the grayscale values of the ciphertext pixels are set to ciphertext, and the ciphertext pixels after setting their grayscale values are recorded as plaintext pixels. All ciphertext pixels in the ciphertext image block are converted to plaintext pixels, and the image block composed of all plaintext pixels is recorded as a plaintext image block. All ciphertext image blocks in the ciphertext image are decrypted to obtain the corresponding plaintext image blocks, and the image composed of all plaintext image blocks is recorded as a plaintext image.
[0102] In summary, the present application obtains a plaintext image block by dividing the plaintext image, obtains a starting value sequence according to a secret key, obtains a correction coefficient according to a gray level histogram of the plaintext image block, and corrects the frequency of the gray level histogram according to the correction coefficient to obtain a corrected histogram; the corrected histogram of the plaintext image block is histogram equalized according to the starting value of the plaintext image block to obtain a mapping relationship of the plaintext image block; the plaintext image block is encrypted according to the mapping relationship to obtain a ciphertext image composed of all the encrypted plaintext image blocks, and the ciphertext image is transmitted.
[0103] It should be noted that the above-mentioned embodiments of the present application are only for description, not for representing the advantages and disadvantages of the embodiments. The above-mentioned embodiments of the present application are described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be executed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are possible or can be advantageous.
[0104] Each embodiment in the specification is described in a progressive manner, and the same or similar parts between each embodiment can be referred to each other. Each embodiment focuses on the difference from other embodiments.
[0105] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for encrypting test data of an unmanned vehicle, characterized by, The method comprises: obtaining a plaintext image, dividing the plaintext image into blocks, and obtaining all plaintext image blocks; constructing a key, and obtaining a starting value sequence according to the key; encrypting any plaintext image block in the plaintext image, which comprises: obtaining the left boundary and the right boundary of the grayscale histogram of the plaintext image block, constructing a correction coefficient equation according to the frequencies of all grayscale values between the left boundary and the right boundary of the grayscale histogram, solving the correction coefficient equation to obtain the correction coefficient of the plaintext image block, frequency-correcting the grayscale histogram according to the correction coefficient to obtain a corrected histogram of the plaintext image block, obtaining a starting value of the plaintext image block according to the starting value sequence, histogram equalizing the corrected histogram of the plaintext image block according to the starting value to obtain a mapping relationship of the plaintext image block, and encrypting all plaintext pixel points of the plaintext image block according to the mapping relationship, wherein the image block composed of all ciphertext pixel points is referred to as a ciphertext image block; encrypting all plaintext image blocks of the plaintext image, wherein the image composed of all ciphertext image blocks is referred to as a ciphertext image; the step of constructing the correction coefficient equation according to the frequencies of all grayscale values between the left boundary and the right boundary of the grayscale histogram comprises: The modified coefficient of the plain image block is set as The expression of the modified coefficient equation is specifically as follows: where P1, P2 represent the left and right boundaries of the gray level histogram of the plaintext image block respectively, p(h) represents the frequency of the gray level value h in the gray level histogram of the plaintext image block, represents the ceiling function, and δ(P1, P2) represents the number of all gray level values whose frequencies are 0 between the left boundary P1 and the right boundary P2.
2. The test data encryption method of an unmanned vehicle according to claim 1, wherein, the step of frequency-correcting the grayscale histogram according to the correction coefficient to obtain the corrected histogram of the plaintext image block comprises: For all gray scale values whose frequency between the left boundary P1 and the right boundary P2 in the gray scale histogram of the plain image block is 0, the modified frequency z(h) of each gray scale value is set as For the gray level histogram of the plain image block, the modified frequency z(h) of the gray level h is set as where p(h) represents the frequency of the gray level h, represents the modified coefficient, represents the upward rounding. for the grayscale histogram of the plaintext image block, the frequencies of all grayscale values between the left boundary P1 and the right boundary P2 are not corrected, and the frequencies remain 0; the histogram composed of the corrected frequencies of all grayscale values of the plaintext image block is referred to as the corrected histogram of the plaintext image block.
3. The method of claim 1, wherein the test data is encrypted by using a symmetric key encryption algorithm. the step of histogram equalizing the corrected histogram of the plaintext image block according to the starting value to obtain the mapping relationship of the plaintext image block comprises: according to the corrected frequencies of all grayscale values in the corrected histogram of the plaintext image block, the cumulative frequencies of the grayscale values are accumulated, and the specific calculation formula of the cumulative frequency of the grayscale value h is: wherein s(h) represents the cumulative frequency of the grayscale value h in the corrected histogram of the plaintext image block, and z(j) represents the corrected frequency of the jth grayscale value between the grayscale value 0 and the grayscale value h. The equalization result of the gray value h in the plaintext image block and the gray value h composing a pair of mapping relationships The equalization result of the gray value h The calculation formula is: wherein represents the equalization result of the gray value h, s(h) represents the cumulative frequency of the gray value h on the modified histogram of the plaintext image block, q represents the starting value of the corresponding plaintext image block, and % represents the division remainder.
4. The test data encryption method of an unmanned vehicle according to claim 1, wherein, the step of encrypting all plaintext pixel points of the plaintext image block according to the mapping relationship comprises: For any one of the plaintext pixel points in the plaintext image block, a corresponding mapping relationship is obtained according to the gray value h of the plaintext pixel point The balanced result in the mapping relationship is obtained As ciphertext, the gray value of the plaintext pixel is set as ciphertext, and the plaintext pixel point after setting the gray value is recorded as a ciphertext pixel point.
Citation Information
Patent Citations
Image enhancement processing method and device, equipment and medium
CN115661008A
Gray image visual encription method
US20210044431A1