Underwater communication system and method based on color two-dimensional code
By using color QR code technology to encode and decode information in the underwater communication system, the problem of expensive and low communication rates of existing underwater communication equipment is solved, and more efficient underwater information transmission is achieved.
Patent Information
- Application Number
- CN202410093916.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2025-03-07
AI Technical Summary
Existing underwater communication equipment is expensive and has a low communication rate, making it difficult to meet the needs of real-time and efficient information transmission.
The underwater communication system based on color QR code is adopted, and the original information is encoded through color QR code generation technology, and the signal is sent through the display screen, and the color QR code is analyzed using color mapping to achieve a larger capacity of underwater information transmission.
It improves the information transmission capacity and efficiency of underwater communication, reduces equipment costs, and is suitable for short-range and low-speed underwater communication scenarios.
Smart Images

Figure CN119578439A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of underwater communication technology, and in particular to an underwater communication system and method based on a color two-dimensional code. Background Art
[0002] As one of the key technologies for ocean development, underwater communication is widely used in the fields of marine resource development, seabed scientific research, marine environment monitoring and underwater operations. At present, underwater short-range communication technology mainly includes three methods: hydroacoustic communication, electromagnetic wave communication and optical communication. Among them, hydroacoustic communication has low bandwidth and high latency, and it is difficult to meet real-time requirements. The commonly used electromagnetic wave communication frequency band cannot overcome the influence of absorption effect. Underwater laser communication is expensive and difficult to promote and apply. Underwater visible light communication can achieve short-range underwater communication using ordinary visible light source and photoelectric detector, which is a promising underwater short-range communication method. A feasible visible light method for underwater communication uses QR code as the medium for information transmission. However, due to the small text storage capacity of monochrome QR code, the communication rate is low. Summary of the invention
[0003] In view of the problems of expensive underwater communication equipment and low communication rate in the prior art, the present invention provides an underwater communication system and method based on color two-dimensional code. The present invention mainly uses the color two-dimensional code generation technology to encode the original information and send the signal through the display screen, and parses the color two-dimensional code by color mapping to achieve larger capacity underwater information transmission.
[0004] The technical means adopted by the present invention are as follows:
[0005] An underwater communication system based on color QR codes, which uses optical coding for information transmission, includes a transmitter, a receiver, and a communication protocol;
[0006] The transmitting end includes an encoding unit and a display unit, wherein the encoding unit is used to convert the transmitted information into a color two-dimensional code image, and the display unit is used to display the color two-dimensional code image;
[0007] The receiving end includes an acquisition unit, an enhancement unit and a parsing unit. The acquisition unit is used to acquire the color two-dimensional code image and output the acquisition result as the original color two-dimensional code image. The enhancement unit is used to restore the color of the original color two-dimensional code image to generate an enhanced color two-dimensional code image. The parsing unit is used to decode the enhanced color two-dimensional code image to obtain the encoding information.
[0008] The communication protocol is used to define the communication message format and communication process based on the color QR code to achieve reliable underwater communication.
[0009] Furthermore, the encoding unit converts the sent information into a color two-dimensional code image in the following manner:
[0010] The information to be sent is decomposed into several information blocks according to the information capacity of the color two-dimensional code image, and the information volume of each information block is the information capacity of a color two-dimensional code image;
[0011] Decompose each information block twice to generate n sub-blocks, and encode the information of each sub-block into a single-color two-dimensional code, where n is an integer greater than 1;
[0012] Combine n monochrome QR codes into a color QR code.
[0013] Furthermore, n monochrome QR codes are combined into a color QR code by the following method:
[0014] Get n monochrome QR codes qr 0 ,qr 1 ,…,qr n-1 , Indicates a monochrome QR code qr i The jth code element of the color two-dimensional code cqr is:
[0015] qq j =qr j 0 ×2 0 +qr j 1 ×2 1 +…+qr j n-1 ×2 n-1
[0016] where cqr j Indicates the jth code element value of the color QR code cqr, corresponding to the cqr j Colors, and a color QR code cqr requires a total of 2 n Color representation.
[0017] Furthermore, the enhancement unit performs color restoration on the original color two-dimensional code image in the following manner:
[0018] The original color two-dimensional code image is input into the trained generative adversarial network, wherein the generator G of the generative adversarial network is implemented by a U-net network with an attention map, wherein the attention map is a matrix composed of the brightness values of the color two-dimensional code image; the discriminator of the generative adversarial network includes a global discriminator D g and the local discriminator D l ; Training the generative adversarial network, comprising:
[0019] The enhanced color QR code images and real color QR code images generated by the generator G are taken as random samples, and the global discriminator D g The enhanced color QR code image and the original color QR code image are taken as input, and the local discriminator D l Taking the randomly cropped patches of the enhanced color QR code image and the real color QR code image as input, the global discriminator D g and D l They learn independently and distinguish whether the input sample comes from the real color QR code image or the enhanced color QR code image generated by G; finally, the predicted label of the discriminator is compared with the real label and the loss function is calculated.
[0020] Furthermore, the global discriminator D g The relative discriminator structure is used to guide the generator to generate a color QR code image of real brightness by estimating the probability that the given real data is more real than the false data. The standard function of the relative discriminator is expressed as:
[0021]
[0022]
[0023] in Represents the probability that the original sample is more realistic than the enhanced sample, Represents the probability that the enhanced sample is more realistic than the original sample, x r and x f denote the real sample and the enhanced sample respectively, C denotes the discriminator network, C(x r ) represents the output of the real sample after the discriminator network, C(x f ) represents the output of the enhanced sample after the discriminator network, Express expectations, represents the expectation of the output of the enhanced sample in the discriminator network from the enhanced data distribution, represents the expectation of the output result of the real sample sampled from the real data distribution in the discriminator network, and σ represents the Sigmoid function.
[0024] Furthermore, the loss function is:
[0025]
[0026] Among them, I L Represents the original color QR code image, G(I L ) represents the enhanced color QR code, φ function represents the extracted sample feature map, W and H are the dimensions of the extracted feature map.
[0027] Furthermore, the attention map isi,j The value at is obtained according to the following calculation:
[0028] I(i,j)=Normalize(αi R (p i,j )+βi G (p i,j )+γi B (p i,j ))
[0029] Among them, i R (p i,j ),i G (p i,j ),i B (p i,j ) are p i,j The brightness values of the three color channels of the pixel RGB, α, β, γ are weights.
[0030] Furthermore, the parsing unit decodes the enhanced color two-dimensional code image in the following manner:
[0031] Mapping QR code elements to binary integers according to color;
[0032] Split the color QR code into n monochrome QR codes according to the bit plane;
[0033] The ZXing QR code parsing engine is used to parse n monochrome QR codes to obtain n information sub-blocks, which are then merged to obtain the decoding information of the color QR code.
[0034] The present invention also discloses an underwater communication method based on a color two-dimensional code, which is implemented based on the above system and includes the following steps:
[0035] At the beginning of a session, the receiving end displays F ready Indicates that it is ready; the sender recognizes F ready After that, F is also displayed. ready The symbol indicates its ready state, and both parties enter the data transmission stage;
[0036] In the data transmission stage, the receiving end displays a color QR code with frame number s to indicate the frame it needs to receive. After identifying and parsing the frame number s, the sending end displays the color QR code of the data segment corresponding to the s frame. When the s frame is successfully identified and received, the receiving end increases s by 1 and repeats the data transmission process until the last color QR code is successfully identified and parsed.
[0037] When the receiving end recognizes the color QR code with the end symbol, all data has been received and the receiving end displays F finish Symbol, the transmitter also displays F after recognizing the signalfinish Symbol, the receiving end receives the F finish The communication ends after the symbol. When the sender cannot recognize the F finish When the symbol is displayed, wait for 2 seconds to end the communication and complete a communication session.
[0038] Compared with the prior art, the present invention has the following advantages:
[0039] This paper constructs a color QR Code-based underwater communication system and method (CQR-UC). First, the CQR-UC framework is constructed; second, the original information is encoded through the color QR code generation technology and the signal is sent through the display screen; third, the receiving end receives the color QR code frame image and uses the generative adversarial network (GAN) based on the attention map to enhance the underwater image; finally, the color QR code is parsed by color mapping to extract information. Experiments show that the method in this paper can effectively realize underwater communication and can be applied to short-range and low-speed underwater communication scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0041] Figure 1 Schematic diagram of a system link in an embodiment of the present invention.
[0042] Figure 2 This is a schematic diagram of the framework of an underwater communication system based on a color QR code according to the present invention.
[0043] FIG3 is an RGB color histogram in an embodiment of the present invention, wherein Figure 3a-1 is the blue histogram of the image at the sending end, Figure 3a-2 is the green histogram of the image at the sending end, Figure 3a-3 is the red histogram of the image at the sending end, Figure 3b-1 is the blue histogram of the image at the receiving end, Figure 3b-2 is the green histogram of the image at the receiving end, Figure 3b-3 It is the red histogram of the image at the receiving end.
[0044] Figure 4 This is a diagram of the architecture of a generative adversarial network model in an embodiment of the present invention.
[0045] Figure 5 This is the data frame format in the embodiment of the present invention.
[0046] FIG6 is a state symbol representation in an embodiment of the present invention, wherein Figure 6a Indicates the ready state. Figure 6b Indicates that the reception is complete.
[0047] Figure 7 It is a reliable transmission protocol for color two-dimensional code communication in an embodiment of the present invention.
[0048] Figure 8 Schematic diagram of the CQR-UC architecture in an embodiment of the present invention.
[0049] Fig. 9 This is the experimental environment in the embodiments of the present invention. DETAILED DESCRIPTION
[0050] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0051] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0052] The present invention provides an underwater communication system based on color two-dimensional code, including a transmitting end, a receiving end and a communication protocol; wherein the transmitting end includes a coding unit and a display unit, and the receiving end includes a collection unit, an enhancement unit and a parsing unit. The coding unit is used to convert the transmitted information into a color two-dimensional code image, and the display unit is used to display the color two-dimensional code image; the collection unit is used to collect the color two-dimensional code image and output the collection result as the original color two-dimensional code image, the enhancement unit is used to restore the color of the original color two-dimensional code image and generate an enhanced color two-dimensional code image, and the parsing unit is used to decode the enhanced color two-dimensional code image to obtain the coded information. The communication protocol defines the communication message format and communication process based on the color two-dimensional code.
[0053] like Figure 1 As shown, in one embodiment of the present invention, both parties in underwater communication are equipped with an electronic display screen and a camera, which serve as the sending end and receiving end of the information transmission system respectively (when the communication direction changes, the functions of the two can be interchanged), and a visible light communication link is constructed underwater. The sender converts the transmitted information into a color QR code image sequence and displays it through the display screen; the receiver uses the camera to receive the color QR code and extract the color QR code information. The sender and the receiver perform two-way data communication according to a specific communication protocol. According to the CQR-UC communication link, a CQR-UC framework can be constructed, such as Figure 2 As shown in the figure, it includes three parts: the transmitter, the receiver and the communication protocol. The transmitter encodes the information to be sent into a color QR code and displays it on the display screen. The receiver first uses a camera to scan the color QR code to obtain the original QR code image; then, the image enhancement technology is used to enhance the original QR code to obtain the enhanced color QR code; finally, the color QR code is parsed to obtain the sent information. The underwater color QR code communication protocol defines the communication message format and communication process to achieve reliable underwater communication.
[0054] Since the traditional static black and white two-dimensional code has a small information capacity and low data transmission efficiency, the encoding unit in this application increases the capacity of information transmission in both horizontal and vertical dimensions. In the horizontal dimension, the number of two-dimensional code colors is increased so that each code element can represent more bit data; in the vertical dimension, multiple static two-dimensional codes are combined to generate a color two-dimensional code sequence and dynamically display it through a display.
[0055] Specifically, the present application adopts the method of QR code synthesis to encode the color QR code. Let n be the number of binary bits represented by a module in the color QR code, then a color QR code cqr can be regarded as n monochrome QR codes qr 0 ,qr 1 ,…,qr n-1 The synthesis of Indicates a monochrome QR code qr iThe jth code element (0 or 1) of the color two-dimensional code cqr is cqr j =qr j 0 ×2 0 +qr j 1 ×2 1 +…+qr j n-1 ×2 n-1 , corresponding to cqr j A color QR code cqr requires 2 n For example, two single-color QR codes can be combined into 2 2 = 4 color two-dimensional codes, each of which can represent 2 bits of information. In practical applications, the sender first decomposes the information to be sent into multiple information blocks according to the information capacity of the color two-dimensional code; then, decomposes one information block into n sub-blocks, each of which is encoded into a monochrome two-dimensional code; finally, the n monochrome two-dimensional codes are combined into a color two-dimensional code, where n is an integer greater than 1. Specifically, n is manually specified according to actual needs, and is the number of monochrome two-dimensional codes that are actually synthesized into a color two-dimensional code.
[0056] In practical applications, due to the influence of interference factors such as color difference defects, background light interference, and contrast changes in the image projection process, the reception of color QR codes will experience color attenuation and offset. As shown in Figure 3, the RGB histogram of the underwater color QR code transmitter and receiver, it can be seen from the figure that there is a large deviation between the color value of the image signal received by the receiver and the color value of the image signal sent. If the color QR code is directly parsed, a large number of errors may occur. The present invention adopts Figure 4 The CQR-GAN model shown uses a generative adversarial network (GAN) to enhance the image, improve the image color brightness and contrast, and restore the color of the color QR code, thereby ensuring that the color QR code can be reliably decoded. The CQR-GAN model solution specifically includes:
[0057] 1) Generator
[0058] In CQR-GAN, the generator G is implemented using a U-net network with an attention map, such as Figure 4 As shown in Figure 2. Different from EnlightenGAN, the image enhancement in CQR-GAN focuses on the color brightness information in the image, so the attention map is a matrix composed of the brightness values of the color QR code image. Let p i,j is a pixel in the color QR code image, then the attention map is in p i,j The value at is shown in formula (1), where i R ,i G ,i B They are p i,jThe brightness values of the three color channels of the pixel RGB, α, β, γ are weights.
[0059] I(i,j)=Normalize(αi R (p i,j )+βi G (p i,j )+γi B (p i,j )) (1)
[0060] 2) Discriminator
[0061] CQR-GAN adopts a global-local discriminator structure, such as Figure 4 As shown. First, the structure takes the enhanced color QR code image (Enhanced Image) and the real color QR code image (Normal Image) generated by the generator G as random samples, and the global discriminator D g The enhanced color QR code image and the original color QR code image (Original Image) are taken as input, and the local discriminator D l The random cropped patches of the enhanced color QR code image and the real color QR code image are taken as input. Global Discriminator D g and D l They learn and distinguish independently whether the input sample comes from the real color QR code image or the enhanced color QR code image generated by G, both of which are identified by PatchGA. Finally, the predicted label of the discriminator is compared with the real label to calculate the loss function. The global-local discriminator structure forces the generator G to adaptively enhance the local area while enhancing the global brightness, which can effectively solve the problem of excessive or insufficient local exposure.
[0062] In addition, for the global discriminator D g A relative discriminator structure is also adopted, which guides the generator to generate color QR code images with realistic brightness by estimating the probability that a given real data is more realistic than a fake data. The standard function of the relative discriminator is expressed as (2) and (3).
[0063]
[0064]
[0065] in Represents the probability that the original sample is more realistic than the enhanced sample, Represents the probability that the enhanced sample is more realistic than the original sample, x r and x fdenote the real sample and the enhanced sample respectively, C denotes the discriminator network, C(x r ) represents the output of the real sample after the discriminator network, C(x f ) represents the output of the enhanced sample after the discriminator network, Express expectations, represents the expectation of the output of the enhanced sample in the discriminator network from the enhanced data distribution, represents the expectation of the output result of the real sample sampled from the real data distribution in the discriminator network, and σ represents the Sigmoid function.
[0066] 3) Loss Function
[0067] In order to maintain the texture features of the color QR code image before and after enhancement, this application uses a self-feature preservation loss to limit the feature distance between the input image and the output image of the generator G. Self-feature preservation loss function As shown in formula (4).
[0068]
[0069] Among them I L Represents the original color QR code image, G(I L ) represents the enhanced color QR code, and the φ function represents the extracted sample feature map. W and H are the dimensions of the extracted feature map.
[0070] From a local perspective, this application adopts the least squares adversarial loss of LSGAN. The local loss function of the generator G is and the discriminator D l The local loss function They are expressed as equation (5) and equation (6) respectively.
[0071]
[0072]
[0073] Where D(x r ) and D(x f ) are represented as local discriminators D l Identification results of real color QR code images and enhanced color QR code images.
[0074] From a global perspective, this paper adopts the relative discriminator D Ra (x f ,x r ) and D Ra (x r ,x f ) replaces D(x f ) and D(x r). The global loss function of the generator G and the discriminator D g The global loss function They are expressed as equation (7) and equation (8) respectively.
[0075]
[0076]
[0077] Finally, the loss function Loss of the CQR-GAN model can be expressed as formula (9).
[0078]
[0079] Furthermore, the receiving end decodes the enhanced color QR code to obtain the encoded information. This process is the opposite of the encoding process of the color QR code. First, the QR code element is mapped to a binary integer according to the color; then, the color QR code is split into n monochrome QR codes according to the bit plane; finally, the ZXing QR code parsing engine is used to parse the n monochrome QR codes to obtain n information sub-blocks, which are then merged to obtain the decoded information of the color QR code. For example, for a 4-color QR code, each color module can be mapped to a 2-bit binary integer. Thus, the entire QR code can be split into 2 monochrome QR codes.
[0080] The traditional QR code information transmission method is difficult to use for underwater two-way reliable communication. The reasons are mainly two-fold. 1) Traditional QR codes are mostly used for one-time communication. The information they transmit is single and lacks communication control information. 2) Traditional QR codes are used for one-way communication and cannot guarantee the reliability of the communication channel. In response to the above problems, this application designs a color QR code communication data frame format and a reliable transmission protocol. Specifically, it includes:
[0081] 1) Data frame format
[0082] In color QR code communication, each monochrome QR code contains a frame of the transmitted data, and its format is as follows: Figure 5 The first byte of the data frame is the control information, and the rest is the data part. The first 7 bits of the control information represent the frame number, and the last bit is the identifier, indicating whether the information transmission is completed.
[0083] 2) Reliable transmission protocol
[0084] In order to ensure reliable information transmission, this paper designs F ready and F finish Two communication control symbols indicate the ready and end of a session, as shown in Figure 6. Before the session starts, the receiving end displays F ready Indicates that it is ready; when it recognizes the other party's Fready After that, the sender adjusts the camera position, aligns the device, and uses F ready The symbol indicates that it has also entered the ready state, and both parties begin to transmit. When the transmission is completed, the sender displays F finish Symbol, the receiving end also uses F finish To indicate that the reception is complete, a color QR code communication is completed. The above symbols are recognized by the deep learning model.
[0085] In order to achieve reliable transmission, this paper draws on the process of TCP three-way handshake protocol to design a color QR code transmission protocol, such as Figure 7 Before communication, the sender converts the data to be sent into a color QR code sequence and then starts a communication session.
[0086] Based on the above transmission protocol, the present application also provides an underwater communication method based on a color QR code implemented based on the above system, comprising the following steps:
[0087] 1) At the beginning of a session, the receiving end displays F ready Indicates that it is ready; the sender recognizes F ready After that, F is also displayed. ready The symbol indicates its ready state, and both parties enter the data transmission stage.
[0088] 2) During the data transmission phase, the receiving end displays a color QR code with frame number s to indicate the frame it needs to receive; after identifying and parsing the frame number s, the sending end displays the color QR code of the data segment corresponding to the s frame; when the s frame is successfully identified and received, the receiving end increases s by 1 and repeats the above process until the last color QR code is successfully identified and parsed.
[0089] 3) When the receiving end recognizes the color QR code with the end symbol, all data has been received and the receiving end displays F finish After the transmitter recognizes the signal, it will also display F finish Symbol. The receiving end receives the F finish The communication ends after the symbol. The sender cannot recognize the F finish After the symbol, wait for 2 seconds to end the communication and complete a communication session.
[0090] The scheme and effect of the present invention are further illustrated below through a specific application example.
[0091] In this embodiment, Fig. 9 The CQR-UC architecture is implemented in the simulation environment shown in the figure. Figure 8As shown. It mainly includes a sending module, a receiving module and a control module. The sending module generates a color QR code for the signal, wherein the barcode sequence generation module first splits the source signal and adds control information to generate a data frame; secondly, it uses compression coding technology to encode each data frame; thirdly, it converts the encoded data into a monochrome QR code image set; finally, it combines the pairs of monochrome QR codes together to obtain a color QR code sequence, and outputs it on the display screen.
[0092] The receiving module mainly completes the data analysis of the image frames received by the camera. First, the color QR code video stream is obtained by shooting with the camera; then, the image preprocessing module analyzes the video stream and calculates the attention map for the image frame with the color QR code; again, the original color QR code image and the attention map are input into the generator model for enhancement to reduce the impact of the underwater environment on the transmission of optical signals; finally, the color QR code data analysis module analyzes the QR code image, which decomposes the color QR code image into two gray monochrome QR code images, and finally obtains the target signal through decoding and sorting.
[0093] The control module controls and manages the transmission process to ensure reliable data transmission. A control signal image is added to the color QR code sending link to indicate the status information. In the color QR code receiving link, the control image signal is inferred and identified to obtain the ready or end state of the signal sending end, so as to enter the next established process.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An underwater communication system based on color QR code, using optical coding for information transmission, characterized in that: It includes three parts: the sending end, the receiving end and the communication protocol; The transmitting end includes an encoding unit and a display unit, wherein the encoding unit is used to convert the transmitted information into a color two-dimensional code image, and the display unit is used to display the color two-dimensional code image; The receiving end includes an acquisition unit, an enhancement unit and a parsing unit. The acquisition unit is used to acquire the color two-dimensional code image and output the acquisition result as the original color two-dimensional code image. The enhancement unit is used to restore the color of the original color two-dimensional code image to generate an enhanced color two-dimensional code image. The parsing unit is used to decode the enhanced color two-dimensional code image to obtain the encoding information. The communication protocol is used to define the communication message format and communication process based on the color QR code to achieve reliable underwater communication.
2. According to claim 1, an underwater communication system based on a color two-dimensional code is characterized in that: The encoding unit converts the sent information into a color two-dimensional code image in the following manner: The information to be sent is decomposed into several information blocks according to the information capacity of the color two-dimensional code image, and the information volume of each information block is the information capacity of a color two-dimensional code image; Each information block is decomposed twice to generate n sub-blocks, and the information of each sub-block is encoded into a monochrome two-dimensional code, where n is an integer greater than 1; Combine n monochrome QR codes into a color QR code.
3. The underwater communication system based on color two-dimensional code according to claim 2 is characterized in that: Combine n monochrome QR codes into a color QR code in the following way: Get n monochrome QR codes qr 0 ,qr 1 ,…,qr n-1 , Indicates a monochrome QR code qr i The jth code element of the color two-dimensional code cqr is: cqr j =qr j 0 ×2 0 +qr j 1 ×2 1 +…+qr j n-1 ×2 n-1 where cqr j Indicates the jth code element value of the color QR code cqr, corresponding to the cqr j Colors, and a color QR code cqr requires a total of 2 n Color representation.
4. The underwater communication system based on color two-dimensional code according to claim 1, characterized in that: The enhancement unit performs color restoration on the original color two-dimensional code image in the following manner: The original color two-dimensional code image is input into the trained generative adversarial network, wherein the generator G of the generative adversarial network is implemented by a U-net network with an attention map, wherein the attention map is a matrix composed of the brightness values of the color two-dimensional code image; the discriminator of the generative adversarial network includes a global discriminator D g and the local discriminator D l ; Training the generative adversarial network, comprising: The enhanced color QR code images and real color QR code images generated by the generator G are taken as random samples, and the global discriminator D g The enhanced color QR code image and the original color QR code image are taken as input, and the local discriminator D l Taking the randomly cropped patches of the enhanced color QR code image and the real color QR code image as input, the global discriminator D g and D l They learn independently and distinguish whether the input sample comes from the real color QR code image or the enhanced color QR code image generated by G; finally, the predicted label of the discriminator is compared with the real label and the loss function is calculated.
5. The underwater communication system based on color two-dimensional code according to claim 4, characterized in that: The global discriminator D g The relative discriminator structure is used to guide the generator to generate a color QR code image with real brightness by estimating the probability that the given real data is more real than the false data. The standard function of the relative discriminator is expressed as: in Indicates the probability that the original sample is more realistic than the enhanced sample, Represents the probability that the enhanced sample is more realistic than the original sample, x r and x f denote the real sample and the enhanced sample respectively, C denotes the discriminator network, C(x r ) represents the output of the real sample after the discriminator network, C(x f ) represents the output of the enhanced sample after the discriminator network, Express expectations, represents the expectation of the output of the enhanced sample in the discriminator network from the enhanced data distribution, represents the expectation of the output result of the real sample sampled from the real data distribution in the discriminator network, and σ represents the Sigmoid function.
6. The underwater communication system based on color two-dimensional code according to claim 4, characterized in that: The loss function is: Among them, I L Represents the original color QR code image, G(I L ) represents the enhanced color QR code, φ function represents the extracted sample feature map, W and H are the dimensions of the extracted feature map.
7. The underwater communication system based on color two-dimensional code according to claim 4, characterized in that: The attention map is in p i,j The value at is obtained according to the following calculation: I(i,j)=Normalize(αi R (p i,j )+βi G (p i,j )+γi B (p i,j )) Among them, i R (p i,j ),i G (p i,j ),i B (p i,j ) are p i,j The brightness values of the three color channels of the pixel RGB, α, β, γ are weights.
8. The underwater communication system based on color two-dimensional code according to claim 1, characterized in that: The parsing unit decodes the enhanced color two-dimensional code image in the following manner: Mapping QR code elements to binary integers according to color; Split the color QR code into n monochrome QR codes according to the bit plane; The ZXing QR code parsing engine is used to parse n monochrome QR codes to obtain n information sub-blocks, which are then merged to obtain the decoding information of the color QR code.
9. An underwater communication method based on color two-dimensional code, implemented based on the system described in claim 1, characterized in that: The following steps are involved: At the beginning of a session, the receiving end displays F ready Indicates that it is ready; the sender recognizes F ready After that, F is also displayed. ready The symbol indicates its ready state, and both parties enter the data transmission stage; In the data transmission stage, the receiving end displays a color QR code with frame number s to indicate the frame it needs to receive. After identifying and parsing the frame number s, the sending end displays the color QR code of the data segment corresponding to the s frame. When the s frame is successfully identified and received, the receiving end increases s by 1 and repeats the data transmission process until the last color QR code is successfully identified and parsed. When the receiving end recognizes the color QR code with the end symbol, all data has been received and the receiving end displays F finish Symbol, the transmitter also displays F after recognizing the signal finish Symbol, the receiving end receives the F finish The communication ends after the symbol. When the sender cannot recognize the F finish When the symbol is displayed, wait for 2 seconds to end the communication and complete a communication session.