Image data transmission method and device based on UDP protocol, and medium
Patent Information
- Application Number
- CN202311377161.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-23
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-10-23
AI Technical Summary
[0004]鉴于以上现有技术中存在的缺点,本发明的目的在于提供一基于UDP协议的图像数据传输方法、设备及计算机存储介质,用于解决现有的高分辨率和/或高帧率图像数据传输过程存在的丢包率较高的问题
[0015]如上所述,本申请所述的基于UDP协议的图像数据传输方法、设备及计算机存储介质,通过设置与各接收端口对应的接收线程,将对应接收端口处接收到的图像数据包依次进行缓存,以及通过设置与各接收线程对应的组帧线程,并根据各图像数据包所包含的组包顺序信息,将同一目标图像数据下的各图像数据包中的子图像数据进行拼接,获得目标图像数据;从而基于多线程的并发处理,将数据处理压力快速释放到用户层,可以大大减小高分辨率和/或高采集频率的图像传输过程中,内核层的数据阻塞压力,提高接收端中的图像接收和获取效率,进而有效地提高了探测器设备的可靠性和安全性。
Smart Images

Figure CN117579894B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of X-ray detection technology, and in particular to image data transmission methods, devices, and computer storage media based on the UDP protocol. Background Technology
[0002] X-ray motion detectors, capable of acquiring and displaying X-ray image data in real time, have been widely used in the field of medical imaging. With the continuous development of imaging technology, the image resolution and frame rate of X-ray motion detectors are becoming increasingly higher, currently exceeding 3Gbps, placing higher demands on the performance of receiving devices. When the data transmission and processing capabilities of the receiving device are insufficient, problems such as unclear, blurry, or unreadable image data often occur. For example, when the communication efficiency between the kernel and user layers in the receiving device is low, severe packet loss occurs when data is transmitted from the kernel layer to the user layer, resulting in unclear image data received by the user layer. This significantly affects the accuracy of the detection results and, in severe cases, can even lead to medical accidents.
[0003] Therefore, how to reduce the packet loss rate of receiving devices during high-resolution and / or high-frame-rate image data transmission has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0004] In view of the shortcomings of the prior art, the purpose of this invention is to provide an image data transmission method, device and computer storage medium based on the UDP protocol, so as to solve the problem of high packet loss rate in the existing high resolution and / or high frame rate image data transmission process.
[0005] To achieve the above and other related objectives, the present invention provides, in a first aspect, a method for image data transmission based on the UDP protocol, applicable to a receiving end, wherein the receiving end includes a receiving port and a buffer unit; wherein the buffer unit includes a first buffer for storing image data packets and a second buffer for storing target image data; the first buffer is configured in a one-to-one correspondence with the receiving port; the thread pool of the processing unit includes a receiving thread and a framing thread; the receiving thread is configured in a one-to-one correspondence with the receiving port; a single receiving thread is connected to the corresponding receiving port and the first buffer; the framing thread is associated with each receiving thread and connected to the second buffer; the method for image data transmission based on the UDP protocol includes: reading image data packets received by the corresponding receiving port based on each receiving thread, and storing the image data packets in the corresponding first buffer; obtaining image data packets corresponding to the same target image data from each first buffer based on the framing thread, and storing the read image data packets in the second buffer; and concatenating sub-image data in each image data packet in the second buffer to obtain the target image data.
[0006] In one embodiment of the first aspect, the image data packet includes packet order information and image identification information of the target image data.
[0007] In one embodiment of the first aspect, the method for obtaining the target image data includes: taking each image data packet with the same image identification information as an image data packet group; and splicing the sub-image data of each image data packet in the image data packet group according to the group packet order information to obtain the target image data corresponding to the image data packet group.
[0008] In one embodiment of the first aspect, the second buffer includes a plurality of image buffer segments, and each image buffer segment corresponds to the image identification information. The method of obtaining the target image data includes: based on the framing thread, reading each image data packet corresponding to the same target image data in each of the first buffers; and storing each read image data packet into the corresponding image buffer segment according to the packet order information and the image identification information to obtain the target image data.
[0009] In one embodiment of the first aspect, the first buffer includes a plurality of data packet buffer segments, each of the data packet buffer segments being arranged in a circular queue with the beginning and end connected: the implementation of storing the image data packets in the corresponding first buffer includes: storing the received image data packets sequentially into each of the data packet buffer segments.
[0010] In one embodiment of the first aspect, the receiving end is connected to the display unit, and the thread pool of the receiving end further includes a distribution thread. Then, the image data transmission method based on the UDP protocol includes: after the framing thread completes the stitching of the target image data, the distribution thread is used to send the stitched target image data to the display unit.
[0011] In a second aspect, this application also provides another image data transmission method based on the UDP protocol, applicable to the sending end. The method includes: constructing image data packets corresponding to the input target image data based on the input target image data; and sending each of the image data packets in parallel, so that the receiving end processes the received image data packets using the image data transmission method based on the UDP protocol as described above to obtain the target image data.
[0012] In one embodiment of the second aspect, the method for constructing the image data packet includes: identifying the target image data to obtain image identification information corresponding to the target image data; performing a splitting process on the identified target image data to obtain sub-image data corresponding to the target image data; obtaining the splicing order corresponding to each sub-image data based on the distribution position of each sub-image data in the target image data, and using the splicing order as the packet assembly order information of the corresponding image data packet; and constructing each image data packet corresponding to the target image data based on each sub-image data, the packet assembly order information, and the image identification information.
[0013] In a third aspect, this application also provides an electronic device, including a memory and a processor, the processor being configured to execute a computer program stored in the memory to cause the electronic device to perform the image data transmission method based on the UDP protocol as described above.
[0014] In a fourth aspect, this application provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when executed by a processor, the computer program implements the image data transmission method based on the UDP protocol as described above.
[0015] As described above, the image data transmission method, device, and computer storage medium based on the UDP protocol described in this application, by setting up receiving threads corresponding to each receiving port, sequentially buffers the image data packets received at the corresponding receiving port, and by setting up framing threads corresponding to each receiving thread, and by stitching together the sub-image data in each image data packet under the same target image data according to the packet assembly order information contained in each image data packet, obtains the target image data; thereby, based on multi-threaded concurrent processing, the data processing pressure is quickly released to the user layer, which can greatly reduce the data blocking pressure in the kernel layer during the transmission of high-resolution and / or high-acquisition-frequency images, improve the image reception and acquisition efficiency in the receiving end, and thus effectively improve the reliability and security of the detector device. Attached Figure Description
[0016] Figure 1 This is a schematic diagram illustrating an application scenario of the image data transmission method based on the UDP protocol described in one embodiment of this application.
[0017] Figure 2 This is a schematic diagram of the structure of each unit in the receiving end in an application scenario of the image data transmission method based on the UDP protocol described in an embodiment of this application.
[0018] Figure 3 The diagram shows a flowchart of an image data transmission method based on the UDP protocol according to an embodiment of this application.
[0019] Figure 4 This is a schematic diagram of the structure of the second cache area in one embodiment of this application;
[0020] Figure 5 This is a flowchart illustrating the image data transmission method based on the UDP protocol as described in another embodiment of this application.
[0021] Figure 6 The diagram shown is a structural schematic of the first cache area in one embodiment of this application.
[0022] Figure 7 This is a flowchart illustrating the image data transmission method based on the UDP protocol as described in another embodiment of this application.
[0023] Figure 8 This is a flowchart illustrating the image data transmission method based on the UDP protocol according to another embodiment of this application;
[0024] Figure 9 The diagram shows a flowchart illustrating the image data packet construction method described in one embodiment of this application.
[0025] Figure 10The diagram shown is a structural schematic of the electronic device described in one embodiment of this application.
[0026] Component designation explanation
[0027] 100 - Receiver; 101 - Receiver port; 102 - Buffer unit; 1021 - First buffer; 1022 - Second buffer; 103 - Processing unit; 1031 - Frame assembly thread; 1032 - Receiver thread; 200 - Transmitter. Detailed Implementation
[0028] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0029] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0030] To address the issue of packet loss that easily occurs in existing receivers during high-resolution and / or high-frequency image data transmission, this application provides an image data transmission method, device, and storage medium based on the UDP protocol. By setting up a receiving thread and a first buffer corresponding to the receiving port in the receiving end, and setting up a framing thread and a second buffer associated with each receiving thread, the target image data is obtained by storing each image data packet received by each receiving port in the first buffer and storing the sub-image data in each image data packet corresponding to the same target image data in the second buffer.
[0031] This application first provides an image data transmission method based on the UDP protocol, applicable to a receiving end; the receiving end is configured to receive image data packets corresponding to target image data, and obtain the corresponding target image data based on each image data packet.
[0032] The image data packet corresponding to the target image data is an image data packet generated based on each sub-image data after the target image data is split, that is, each image data packet contains the target image data and the split sub-image data.
[0033] The receiving end is a receiving device, including but not limited to a PC, mobile terminal, server or other existing receiving devices.
[0034] Please see Figure 1 and 2 The diagram illustrates an application scenario of the image data transmission method based on the UDP protocol provided in this application embodiment; as shown below. Figure 1 As shown, the receiving end 100 is communicatively connected to the transmitting end 200; as Figure 2 As shown, the receiving end 100 includes n receiving ports 101, a buffer unit 102, and a processing unit 103; where n is an integer greater than or equal to 2; for example, the number of receiving ports is any integer from 5 to 20.
[0035] Specifically, each of the receiving ports 101 is connected to the sending end 200 and is used to acquire each of the image data packets sent by the sending end;
[0036] The cache unit 102 includes a first cache area 1021 for storing image data packets and a second cache area 1022 for storing target image data. The number of first cache areas 1021 is the same as the number of receiving ports 101, and there is a one-to-one correspondence between them. The first cache area contains data packet cache segments connected in sequence, which are used to store the image data packets received by the corresponding receiving port.
[0037] The processing unit 103 includes a thread pool, which contains a framing thread 1031 and n receiving threads 1032.
[0038] In this embodiment, the receiving thread 1032 corresponds one-to-one with the receiving port 101, and the receiving thread 1032 corresponds one-to-one with the first buffer 1021; each receiving thread 1032 is connected to the corresponding receiving port 101 and the first buffer 1021 respectively, and is used to read the image data packets received by the corresponding receiving port 101 and store the image data packets in the corresponding first buffer 1021.
[0039] The framing thread 1031 is associated with each of the receiving threads 1032 and connected to the second buffer 1022. It is used to obtain the image data packets corresponding to each of the receiving threads 1032, and to obtain the target image data by splicing the sub-image data in each of the image data packets, and to store the target image data in the second buffer 1022.
[0040] Based on the aforementioned receiving end, the image data transmission method based on the UDP protocol provided in this application embodiment is as follows: Figure 3As shown, it includes the following steps:
[0041] S100: Based on each receiving thread, read the image data packet received at its corresponding receiving port, and store the image data packet in the corresponding first buffer.
[0042] Each of the image data packets includes sub-image data, packet order information, and image identification information of the corresponding target image data;
[0043] The packet assembly order information is the splicing order of the current image data packet, so that the sub-image data in the current image data packet is spliced with the sub-image data in other image data packets based on the splicing order to form the target image data; for example, the packet assembly order information is the splicing number of the sub-image data.
[0044] The image identification information is the identification information of the target image data; for example, the image identification information is the image number of the target image data.
[0045] Specifically, each receiving port in the receiving end receives each image data packet in parallel; after receiving the image data packet, according to the correspondence between the receiving port and the receiving thread, the image data packet received at the corresponding receiving port is read, and the read image data packet is stored in the first buffer corresponding to the receiving thread.
[0046] In one specific embodiment, the sending end and the receiving end transmit each image data packet using a socket method.
[0047] The following will combine Figure 1 The structure of the receiver shown is used to illustrate the above receiving process.
[0048] Specifically, after receiving the first image data packet corresponding to the first target image data at the first receiving port Port#1, the first receiving thread Thread#1 extracts the first image data packet at the first receiving port Port#1 and caches the first image data packet in the first data packet buffer segment of the corresponding first buffer PktBuffers#1; after receiving the second image data packet corresponding to the first target image data at the second receiving port Port#2, the second receiving thread Thread#2 extracts the second image data packet at the second receiving port Port#2 and caches the second image data packet in the first data packet buffer segment of the corresponding second buffer PktBuffers#2; and so on; and, After receiving the first image data packet corresponding to the second target image data at the first receiving port Port#1, the first receiving thread Thread#1 extracts the new first image data packet at the first receiving port Port#1 and caches the new first image data packet in the second data packet buffer segment of the corresponding first buffer PktBuffers#1; after receiving the second image data packet corresponding to the second target image data at the second receiving port Port#2, the second receiving thread Thread#2 extracts the new second image data packet at the second receiving port Port#2 and caches the new second image data packet in the second data packet buffer segment of the corresponding first buffer PktBuffers#2, and so on.
[0049] The second data packet buffer segment is the packet buffer segment located after the first data packet buffer segment within each buffer area.
[0050] It should be noted that the receiving process of each receiving port is a parallel receiving process, that is, the receiving process of each receiving port is independent of each other and does not affect each other.
[0051] S200: Based on the framing thread, each image data packet corresponding to the same target image data is read from each of the first buffers, and the read image data packets are stored in the second buffer; in the second buffer, the sub-image data in each image data packet is spliced together according to the packet assembly order information of each image data packet to obtain the target image data.
[0052] Specifically, the framing thread reads each of the image data packets stored in the corresponding first buffer; stores each of the image data packets in the second buffer; and parses each of the image data packets to obtain the sub-image data, the packet assembly order information, and the image identification information in each of the image data packets.
[0053] Based on the image identification information corresponding to each image data packet, image data packets with the same image identification information are grouped into an image data packet group; the sub-image data in each image data packet in the image data packet group are spliced together based on the group packet order information to obtain the target image data corresponding to the image data packet group, that is, to obtain the target image data corresponding to the image identification information.
[0054] In an optional embodiment, the second buffer is as follows: Figure 4 The image buffer queue is shown; the image buffer queue includes a first image buffer segment Frame#1, a second image buffer segment Frame#2, ... and an Nth image buffer segment Frame#N connected in sequence; each image buffer segment corresponds to an image identification information to store the target image data corresponding to the image identification information; then, in the UDP-based image data transmission method, when executing step S200, as follows... Figure 5 As shown, it can also be:
[0055] S200', based on the framing thread, read each image data packet corresponding to the same target image data in each of the first buffer areas; according to the packet order information and the image identification information, store each read image data packet in the corresponding image buffer segment to obtain the target image data.
[0056] Specifically, the framing thread reads each image data packet in the first buffer; extracts each image data packet with the same image identification information according to the image identification information in the image data packet, and uses them as the current image data packet; and determines the corresponding position in the image buffer segment corresponding to the current image data packet according to the image identification information, and stores the current image data packet at the corresponding position in the corresponding image buffer segment according to the packet assembly order information.
[0057] While storing each of the image data packets, it is detected whether the image data packets in the image buffer segment have been fully stored. If so, the stitched target image data is obtained; otherwise, the process continues until exiting, thereby achieving synchronous stitching of target image data. That is, while stitching the current target image data, the next target image data can be stitched simultaneously without waiting for the current target image data to be stitched, which can greatly improve the acquisition efficiency of each of the target image data in the receiving end.
[0058] It should be noted that when there are multiple framing threads in the receiving end, step S200' may further include, in specific execution, the following: according to the preset correspondence between the framing thread and the first buffer, each framing thread reads each image data packet in the first buffer corresponding to it, so as to obtain the corresponding target image data based on each image data packet.
[0059] The image data transmission method based on the UDP protocol provided in this embodiment, by setting a receiving thread and a first buffer corresponding to each receiving port, caches the image data packets received at the corresponding receiving port into the corresponding first buffer. By setting a framing thread and a second buffer associated with the receiving thread, image data packets belonging to the same target image data are transferred to the second buffer to obtain the target image data. Thus, based on multi-threaded concurrent processing, the data processing pressure is quickly released to the user layer, which greatly reduces the data blocking pressure of the kernel layer in the transmission of high-resolution and / or high acquisition frequency images. It reduces the probability of image data packet loss during transmission between the kernel layer and the user layer, improves the transmission and processing efficiency of image data packets, and does not require setting complex transmission control logic. It can be applied to receiving devices with limited hardware resources, effectively improving the applicability and security of the device.
[0060] In some preferred embodiments, in the first buffer area, each data packet buffer segment is arranged in a circular queue with the first and last segments connected, so that the receiving thread can immediately receive the next image data packet after receiving one image data packet.
[0061] Specifically, the first cache area is as follows: Figure 6 As shown, it contains several data packet buffer segments, and each data packet buffer segment is connected end to end in sequence; that is, the end of the first data packet buffer segment PktBuffer#1 is connected to the beginning of the second data packet buffer segment PktBuffer#2, the end of the second data packet buffer segment PktBuffer#2 is connected to the beginning of the third data packet buffer segment PktBuffer#3, and so on.
[0062] The order in which the first data packet buffer segment is arranged in the first buffer area is prior to the order in which the second data packet buffer segment is arranged in the first buffer area.
[0063] Based on the arrangement of the data packet buffer segments in the circular queue, while the receiving thread is storing image data packets in the first data packet buffer segment of the first buffer area, the framing thread is reading the corresponding image data packets from the second data packet buffer segment of the first buffer area; thus, the receiving thread and the framing thread can perform read / write operations on the same first buffer area simultaneously, improving data processing efficiency.
[0064] In some optional embodiments, the receiving end is connected to the display unit, and the thread pool of the receiving end further includes a distribution thread. The image data transmission method based on the UDP protocol, after executing step S200, as follows... Figure 7 As shown, it also includes:
[0065] S300, using the distribution thread, the stitched target image data is sent to the display unit.
[0066] Specifically, after the framing thread completes the stitching of the target image data, it starts the distribution thread; the distribution thread reads the stitched target image data from the second buffer and sends the target image data to the display unit for display.
[0067] In some optional embodiments, the transmitting end includes an FPGA module. By utilizing the parallel processing capability of the FPGA, the image data packets can be transmitted in parallel. This eliminates the need to configure complex transmitting end circuits and control logic, enabling the rapid transmission of each image data packet. This significantly reduces the size required by the transmitting end and improves its portability and operational flexibility.
[0068] In some optional embodiments, the receiving end employs a multi-core processor, and each receiving thread is bound to at least one processor core to improve the processing performance of the receiving process and the framing thread in the receiving end.
[0069] To address the technical problems existing in the prior art, this embodiment also provides an image data transmission method based on the UDP protocol, applicable to the sending end. The sending end is used to send image data packets corresponding to each target image data, so that after receiving each image data packet, the receiving end processes each received image data packet based on the image data transmission method based on the UDP protocol provided in the above embodiment to obtain the corresponding target image data.
[0070] The image data packet contains sub-image data, packet order information, and image identification information; the sub-image data is the target image data corresponding to the image data packet after being split into sub-data.
[0071] The packet assembly order information is the splicing order of the current image data packet, so as to combine and splice the sub-image data in the current image data packet with the sub-image data in other image data packets to form the target image; for example, the packet assembly order information is the splicing number of the sub-image data.
[0072] The image identification information is the recognition information of the target image data; for example, the image identification information is the image number of the target image data.
[0073] In one embodiment, the transmitting end is an X-ray dynamic detector, which is capable of acquiring target image data with high spatial resolution and frame rate, i.e., X-ray images.
[0074] Please see Figure 8 The diagram illustrates a flowchart of the image data transmission method based on the UDP protocol provided in this application embodiment; as shown below. Figure 8 As shown, the method includes the following steps:
[0075] S10, Based on the input target image data, construct each image data packet corresponding to the target image data;
[0076] Each of the image data packets includes the sub-image data, the packet order information, and the image identification information of the corresponding target image data;
[0077] In one specific embodiment, the transmitting end is connected to a detector; the detector is configured to acquire target image data based on a acquisition frequency, and transmit the acquired target image data to the transmitting end.
[0078] S20, each of the image data packets is sent in parallel, so that the receiving end obtains the corresponding target image data based on each of the image data packets.
[0079] Specifically, the sending end includes several different sending ports; the sending end outputs each of the image data packets to each of the sending ports to perform parallel sending.
[0080] In one specific embodiment, the image data packet transmission rate is greater than or equal to 3Gbps.
[0081] In one optional embodiment, the image data packets corresponding to the target image data are constructed in the following manner: Figure 9 As shown, it includes the following sub-steps:
[0082] S11, the input target image data is identified to obtain image identification information corresponding to the target image data;
[0083] S12, split the identified target image data to obtain each sub-image data corresponding to the target image data;
[0084] S13, based on the distribution position of each sub-image data in the target image data, obtain the splicing order corresponding to each sub-image data; based on the splicing order, obtain the packet assembly order information of the corresponding image data packet;
[0085] S14, based on each of the sub-image data, the packet order information and the image identification information, construct each image data packet corresponding to the target image data.
[0086] Specifically, the packet assembly unit in the sending end uses the sub-image data as the packet content information of the image data packet, and uses the packet assembly order information corresponding to the sub-image data and the image identifier information of the corresponding target image data as the packet header information of the image data packet to construct each image data packet corresponding to the target image data; and performs parallel transmission on each constructed image data packet.
[0087] It should be noted that the protection scope of the image data transmission method based on the UDP protocol in this application is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, deleting, or replacing steps in the prior art based on the principles of this application is included within the protection scope of this application.
[0088] This application also provides an electronic device, which is a user's mobile device such as a mobile phone, tablet, wearable device, or smart AI device; such as Figure 10 As shown, the electronic device includes a memory for storing computer programs and a processor for running the computer programs to implement the UDP-based image data transmission method in the above embodiments.
[0089] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0090] Furthermore, this application embodiment also provides a computing storage medium storing program instructions, which, when executed by a processor, implement the image data transmission method based on the UDP protocol described in the above embodiments.
[0091] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. This available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state drive (SSD)).
[0092] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.
[0093] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this application, depending on actual needs. For example, the functional modules / units in the various embodiments of this application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0094] In summary, the image data transmission method, device, and computer storage medium based on the UDP protocol provided in this application utilize each receiving thread to store the received image data packets; and utilizes a framing thread to stitch together the sub-image data in each image data packet according to the packet assembly order to obtain the target image data. This allows for multi-threaded concurrent processing, quickly releasing data processing pressure to the user layer, significantly reducing the data blocking pressure at the kernel layer in high-resolution and / or high-frequency image transmission, and improving the efficiency of image data reception and acquisition. Therefore, it eliminates the need for complex transmission control logic at the sending end, making it suitable for devices with limited hardware resources. This significantly improves the reliability and security of the device. Furthermore, by setting up a second buffer corresponding to the framing thread, and transferring each image data packet to the second buffer before combining and splicing them, the target image data is obtained. This avoids the impact of insufficient processing efficiency of the receiving thread on the framing thread, i.e., it avoids the probability of previously stored image data packets being overwritten by subsequently stored image data packets when the receiving thread's processing efficiency is insufficient, thereby reducing the image data packet storage pressure in the first buffer. In addition, this application uses a lightweight UDP protocol to transmit image data, reducing the hardware resource consumption of image data packets during transmission and splitting / parsing, and alleviating the communication pressure on the kernel layer.
[0095] Therefore, this application allows image data to pass through the bottleneck between the kernel layer and the user layer at a higher throughput, balancing high frame rate and high resolution, and meeting the market's performance requirements for high-resolution and / or high-acquisition-frequency digital image imaging systems.
[0096] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0097] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0098] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A method for image data transmission based on the UDP protocol, characterized in that, This is applicable to a receiving end, which includes a receiving port and a buffer unit. The buffer unit includes a first buffer for storing image data packets and a second buffer for storing target image data. The first buffer corresponds one-to-one with the receiving port. The processing unit's thread pool includes a receiving thread and a framing thread. The receiving thread corresponds one-to-one with the receiving port. Each receiving thread is connected to its corresponding receiving port and the first buffer. The framing thread is associated with each receiving thread and connected to the second buffer. The image data transmission method based on the UDP protocol includes: Based on each receiving thread, the image data packets received by its corresponding receiving port are read, and the image data packets are stored in the corresponding first buffer. Based on the framing thread, each image data packet corresponding to the same target image data is obtained from each of the first buffers; each of the read image data packets is stored in the corresponding second buffer to splice the sub-image data in each image data packet to obtain the corresponding target image data.
2. The image data transmission method based on the UDP protocol according to claim 1, characterized in that, The image data packet contains packet order information and image identification information of the target image data.
3. The image data transmission method based on the UDP protocol according to claim 2, characterized in that, The methods for acquiring the target image data include: Each image data packet with the same image identification information is grouped into an image data packet group. Based on the packet order information, the sub-image data of each image data packet in the image data packet group are spliced together to obtain the target image data corresponding to the image data packet group.
4. The image data transmission method based on the UDP protocol according to claim 2, characterized in that, The second buffer contains several image buffer segments, and each image buffer segment corresponds to the image identification information. Therefore, the method for obtaining the target image data includes: Based on the framing thread, each image data packet corresponding to the same target image data is read from each of the first buffers; Based on the packet order information and the image identification information, each of the read image data packets is stored in the corresponding image buffer segment to obtain the target image data.
5. The image data transmission method based on the UDP protocol according to claim 1, characterized in that, The first buffer area includes several data packet buffer segments, and each data packet buffer segment is arranged in a circular queue with the first segment connected to the last segment: The implementation methods for storing the image data packets in the corresponding first buffer include: The received image data packets are stored sequentially into each of the data packet buffer segments.
6. The image data transmission method based on the UDP protocol according to claim 1, characterized in that, The receiving end is connected to the display unit, and the thread pool of the receiving end also includes a distribution thread. Therefore, the image data transmission method based on the UDP protocol includes: After the framing thread completes the stitching of the target image data, the distribution thread sends the stitched target image data to the display unit.
7. A method for image data transmission based on the UDP protocol, characterized in that, Applicable to the sending end, the method includes: Based on the input target image data, construct each image data packet corresponding to the target image data; Each of the aforementioned image data packets is sent in parallel, so that the receiving end processes the received image data packets using the UDP-based image data transmission method as described in any one of claims 1 to 6 to obtain the target image data.
8. The image data transmission method based on the UDP protocol according to claim 7, characterized in that, The image data packet is constructed in the following ways: The target image data is identified to obtain image identification information corresponding to the target image data; A splitting process is performed on the identified target image data to obtain sub-image data corresponding to the target image data; Based on the distribution position of each sub-image data in the target image data, the splicing order corresponding to each sub-image data is obtained, and the splicing order is used as the packet assembly order information of the corresponding image data packet; Based on each of the sub-image data, the packet order information, and the image identification information, each image data packet corresponding to the target image data is constructed.
9. An electronic device comprising a memory and a processor, characterized in that, The processor is used to execute the computer program stored in the memory to cause the electronic device to perform the image data transmission method based on the UDP protocol as described in any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the image data transmission method based on the UDP protocol as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Video transmission method, embedded monitoring terminal and monitoring platform server
CN101488967A
Video data step-by-step storage method and device, electronic equipment and storage medium
CN115774796A
