An image transmission method, device, system, processing device and medium

By partitioning and storing image blocks in the memory of the acquisition card and using the PCIe bus for transmission, the problem of low transmission efficiency of high-resolution images is solved, achieving efficient and low-cost image transmission.

CN116743964BActive Publication Date: 2026-08-04HANGZHOU HIKROBOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU HIKROBOT TECH CO LTD
Filing Date
2023-06-30
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing technologies are inefficient and costly when transmitting high-resolution images, and are easily limited by network resources, making it difficult to effectively transmit high-resolution images.

Method used

Image blocks are written from the memory of the capture card to the preset cache of the processing device via the PCIe bus. The image blocks are stored in the memory partition of the capture card and transmitted via the PCIe bus, thus avoiding network resource limitations.

Benefits of technology

It reduces transmission costs, improves the transmission efficiency of high-resolution images, avoids frame drops, and reduces the CPU utilization of processing devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116743964B_ABST
    Figure CN116743964B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an image transmission method, device, system, processing device and medium. The method can be applied to a PCIE driver of a processing device. The processing device is connected to a capture card through a PCIE bus. The capture card is connected to an image capture device. The method comprises: in the case of obtaining an image transmission instruction, calculating a maximum image row height that can be stored in the memory of the capture card and image block information according to image information of an image to be transmitted, a memory size of the capture card and a partition number of the memory of the capture card; controlling the capture card to obtain an image to be transmitted collected by the image capture device from the image capture device, to obtain an image block corresponding to the image to be transmitted; controlling the capture card to store the image block in the memory of the capture card; and writing the image block from the memory of the capture card to a corresponding position of a preset cache of the processing device through the PCIE bus, to obtain a transmitted image. In this way, the transmission cost can be reduced, and the transmission efficiency of a large-resolution image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image transmission technology, and in particular to an image transmission method, apparatus, system, processing equipment, and medium. Background Technology

[0002] As the resolution of images captured by cameras and other image acquisition devices continues to increase, the size of the captured images is also getting larger. However, during the transmission of large-resolution images, the transmission efficiency of image acquisition devices is not high, and frame drops are common.

[0003] Currently, to transmit high-resolution images, multiple acquisition terminals can be set up at the sending end, each acquiring different sub-images from the video source. After encoding these sub-images, they are transmitted over the network. At the receiving end, the encoded data can be decoded to obtain multiple sub-images, which are then merged into a single image and output according to preset rules. However, this method is costly, limited by network resources, and has low image transmission efficiency. Summary of the Invention

[0004] The purpose of this application is to provide an image transmission method, apparatus, system, processing device, and medium to reduce transmission costs and improve the transmission efficiency of high-resolution images. The specific technical solution is as follows:

[0005] In a first aspect, embodiments of this application provide an image transmission method applied to a PCIe driver for a processing device, wherein the processing device is connected to a capture card via a PCIe bus, and the capture card is connected to an image acquisition device, the method comprising:

[0006] Upon receiving an image transmission instruction, the maximum row height and image block information that the memory of the acquisition card can store are calculated based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height.

[0007] The acquisition card is controlled to acquire the image to be transmitted acquired by the image acquisition device, and the image block corresponding to the image to be transmitted is obtained.

[0008] The acquisition card is controlled to store the image blocks into its memory;

[0009] Based on the image block size and the number of image blocks, the image blocks are written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus to obtain the transmitted image.

[0010] Optionally, the step of writing the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, based on the image block size and the number of image blocks, includes:

[0011] Obtain the address corresponding to the preset cache of the processing device;

[0012] For each image block stored in the memory of the acquisition card, based on the size of the image block, the image block is written from the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, until the number of image blocks written reaches the specified number of image blocks.

[0013] Optionally, the step of storing each image block in the memory of the acquisition card, and based on the image block size, writing the image block from the memory of the acquisition card to the address corresponding to a preset cache of the processing device via the PCIe bus, until the number of image blocks written reaches the specified number of image blocks, includes:

[0014] Each time an image block is stored in the memory of the acquisition card, an image block is read from the memory of the acquisition card;

[0015] Upon receiving an image ready interrupt signal, the number of image blocks written to the preset buffer is obtained, wherein the image ready interrupt signal indicates that an image block has been read.

[0016] Based on the address, the number of image blocks already written to the preset cache, and the size of the image blocks, determine the position of the current image block to be written in the preset cache;

[0017] The current image block is written from the memory of the acquisition card to the location to be written via the PCIe bus;

[0018] Determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks;

[0019] If the number of image blocks currently written to the preset cache has not reached the number of image blocks, return to the step of reading image blocks from the memory of the acquisition card until the number of image blocks currently written to the preset cache reaches the number of image blocks.

[0020] Optionally, the step of determining the write position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the image block size includes:

[0021] Based on the address, the number of image blocks already written to the preset cache, and the image block size, the write position pBuf' of the current image block in the preset cache is calculated using the following formula:

[0022] pBuf'=pBuf+CurBlockNum*BlockSize

[0023] Where pBuf is the address, CurBlockNum is the number of image blocks written to the preset cache, and BlockSize is the size of the image block.

[0024] Optionally, after the step of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted, the method further includes:

[0025] Number the image blocks and record their sequence numbers;

[0026] The step of determining whether the number of image blocks currently written to the preset cache has reached the number of image blocks includes:

[0027] Based on the sequence number of the current image block, determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks.

[0028] Optionally, the image information includes at least the image size and row height of the image to be transmitted;

[0029] The step of calculating the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card includes:

[0030] The maximum row height of the image that the acquisition card can store is calculated based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card.

[0031] Based on the image size of the image to be transmitted, the row height, and the maximum row height, the image block size and the number of image blocks corresponding to the image to be transmitted are calculated.

[0032] Optionally, the step of calculating the image block size and number of image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height includes:

[0033] Based on the row height of the image to be transmitted and the maximum row height, the number N of image blocks corresponding to the multiple image blocks of the image to be transmitted is calculated according to the following formula:

[0034]

[0035] Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height;

[0036] Based on the image size of the image to be transmitted and the number of image blocks, the image block size of the multiple image blocks corresponding to the image to be transmitted is calculated.

[0037] Optionally, the step of writing the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, based on the image block size and the number of image blocks, to obtain the transmitted image, includes:

[0038] Based on the image block size and the number of image blocks, DMA technology is used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image.

[0039] Optionally, before the step of calculating the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card, the method further includes:

[0040] Determine whether the acquisition card supports image segmentation;

[0041] If image segmentation is supported, the step of calculating the maximum row height and image block information that the memory of the acquisition card can store is performed based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card;

[0042] If image segmentation is not supported, the number of image segments is set to 1, and the acquisition card is controlled to store the image to be transmitted into the memory of the acquisition card;

[0043] Before the step of writing the image blocks from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus based on the image block size and the number of image blocks, the method further includes:

[0044] Determine whether the acquisition card supports image segmentation;

[0045] If image segmentation is supported, the step of writing the image block from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks is executed;

[0046] If image segmentation is not supported, the image to be transmitted is read from the memory of the acquisition card via the PCIe bus and written to the location corresponding to the preset cache of the processing device.

[0047] Optionally, before the step of calculating the image block size and number of image blocks corresponding to the image to be transmitted based on the image size, the row height, and the maximum row height, the method further includes:

[0048] Determine whether the row height of the image to be transmitted is greater than the maximum row height;

[0049] If the row height of the image to be transmitted is greater than the maximum row height, the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height is performed.

[0050] If the row height of the image to be transmitted is not greater than the maximum row height, the number of image blocks is determined to be 1, and the image to be transmitted is stored in the memory of the acquisition card.

[0051] Secondly, embodiments of this application provide an image transmission device, which is applied to a PCIe driver for a processing device. The processing device is connected to a capture card via a PCIe bus, and the capture card is connected to an image acquisition device. The device includes:

[0052] The first calculation module is used to calculate the maximum row height and image block information that the memory of the acquisition card can store, based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card, when an image transmission instruction is received. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height.

[0053] The image block acquisition module is used to control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device, and obtain the image block corresponding to the image to be transmitted;

[0054] An image block storage module is used to control the acquisition card to store the image blocks into the memory of the acquisition card;

[0055] The image acquisition module is used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus, based on the image block size and the number of image blocks, so as to obtain the transmitted image.

[0056] Optionally, the image acquisition module includes:

[0057] The address acquisition submodule is used to acquire the address corresponding to the preset cache of the processing device;

[0058] The image block writing submodule is used to write each image block stored in the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, based on the size of the image block, until the number of image blocks written reaches the specified number of image blocks.

[0059] The image block writing submodule includes:

[0060] An image block reading unit is used to read image blocks from the memory of the acquisition card after storing each image block in the memory of the acquisition card.

[0061] The quantity acquisition unit is used to acquire the number of image blocks that have been written to the preset cache when an image ready interrupt signal is acquired, wherein the image ready interrupt signal indicates that an image block has been read.

[0062] The write position determination unit is used to determine the write position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the size of the image block;

[0063] An image block writing unit is used to write the current image block from the memory of the acquisition card to the location to be written via the PCIe bus;

[0064] An image block quantity determination unit is used to determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks;

[0065] The image block count reaches unit, which is used to return to the step of reading image blocks from the memory of the acquisition card when the number of image blocks currently written to the preset cache has not reached the image block count, until the number of image blocks currently written to the preset cache reaches the image block count.

[0066] Optionally, the unit for determining the writing location includes:

[0067] The write-to-location determination subunit is configured to calculate the write-to-location pBuf' of the current image block in the preset cache according to the address, the number of image blocks already written to the preset cache, and the image block size, using the following formula:

[0068] pBuf'=pBuf+CurBlockNum*BlockSize

[0069] Where pBuf is the address, CurBlockNum is the number of image blocks written to the preset cache, and BlockSize is the size of the image block.

[0070] Optionally, the device further includes:

[0071] The image block numbering module is used to number the image block and record the sequence number of the image block after the step of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted.

[0072] The image patch quantity determination unit includes:

[0073] The image block quantity determination subunit determines whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks, based on the current image block's sequence number.

[0074] Optionally, the image information includes at least the image size and row height of the image to be transmitted; the first calculation module includes:

[0075] The first calculation submodule is used to calculate the maximum row height of the image that the acquisition card can store based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card.

[0076] The second calculation submodule is used to calculate the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height.

[0077] Optionally, the second calculation submodule includes:

[0078] The image block number calculation unit is used to calculate the number N of multiple image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height, according to the following formula:

[0079]

[0080] Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height;

[0081] The image block size calculation unit calculates the image block size of multiple image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted and the number of image blocks.

[0082] The image acquisition module includes:

[0083] The image acquisition submodule is used to, based on the image block size and the number of image blocks, use DMA technology to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image.

[0084] Optionally, the device further includes:

[0085] The first judgment module is used to determine whether the acquisition card supports image segmentation before the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions of the memory of the acquisition card.

[0086] The first execution module is configured to, if image segmentation is supported, execute the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card;

[0087] The first storage module is used to determine that the number of image blocks is 1 if image segmentation is not supported, and to control the acquisition card to store the image to be transmitted into the memory of the acquisition card.

[0088] The device further includes:

[0089] The second judgment module is used to determine whether the acquisition card supports image segmentation before the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks;

[0090] The second execution module is configured to, if image segmentation is supported, execute the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus based on the image block size and the number of image blocks;

[0091] The image to be transmitted writing module is used to read the image to be transmitted from the memory of the acquisition card via the PCIe bus and write the image to be transmitted to the corresponding location of the preset cache of the processing device if image segmentation is not supported.

[0092] Optionally, the device further includes:

[0093] The third judgment module is used to determine whether the row height of the image to be transmitted is greater than the maximum row height before the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height.

[0094] The first acquisition module is used to perform the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height if the row height of the image to be transmitted is greater than the maximum row height;

[0095] The second storage module is used to determine the number of image blocks as 1 if the row height of the image to be transmitted is not greater than the maximum row height, and to store the image to be transmitted in the memory of the acquisition card.

[0096] Thirdly, embodiments of this application provide an image transmission system, the system including a processing device, a capture card, and an image acquisition device. The processing device includes a PCIe driver, the processing device is connected to the capture card via a PCIe bus, and the capture card is connected to the image acquisition device, wherein:

[0097] The PCIe driver of the processing device is used, upon receiving an image transmission command, to calculate the maximum row height and image block information that the memory of the acquisition card can store, based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; to control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device, thereby obtaining the image block corresponding to the image to be transmitted; to control the acquisition card to store the image block in the memory of the acquisition card; and, based on the image block size and the number of image blocks, to write the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image; wherein, the image block information includes the image block size, the number of image blocks, and the height of the image block is not greater than the maximum row height;

[0098] The acquisition card is used, under the control of the PCIE driver, to acquire the image to be transmitted acquired by the image acquisition device, and to store the image blocks in the memory of the acquisition card.

[0099] Fourthly, embodiments of this application provide a processing device, including a PCIe driver, wherein:

[0100] The PCIe driver is used to perform any of the methods described in the first aspect above.

[0101] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the methods described in the first aspect above.

[0102] Beneficial effects of the embodiments in this application:

[0103] The solution provided in this application embodiment is applied to the PCIe driver of a processing device. The processing device is connected to a capture card via a PCIe bus, and the capture card is connected to an image acquisition device. When an image transmission command is received, the PCIe driver can calculate the maximum row height and image block information that the capture card's memory can store based on the image information of the image to be transmitted, the memory size of the capture card, and the number of partitions in the capture card's memory. The image block information includes the image block size and the number of image blocks. The height of the image block is not greater than the maximum row height. The driver controls the capture card to acquire the image to be transmitted acquired by the image acquisition device, obtains the image block corresponding to the image to be transmitted, and controls the capture card to store the image block in the capture card's memory. Based on the image block size and the number of image blocks, the driver writes the image block from the capture card's memory to the corresponding location of the processing device's preset cache via the PCIe bus, thus obtaining the transmitted image. Since the image blocks corresponding to the image to be transmitted can be stored in the memory of the acquisition card after obtaining the image blocks, and then written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, the image transmission is achieved. This image transmission via the PCIe bus is not limited by network resources, reducing transmission costs. Furthermore, transmitting images in blocks supports high-resolution image transmission and improves the transmission efficiency of high-resolution images. Of course, implementing any product or method of this application does not necessarily require achieving all of the above advantages simultaneously. Attached Figure Description

[0104] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0105] Figure 1This is a schematic diagram of the structure of an image transmission system provided in an embodiment of this application;

[0106] Figure 2 A flowchart illustrating an image transmission method provided in an embodiment of this application;

[0107] Figure 3 Based on Figure 1 A specific flowchart of image block writing in the illustrated embodiment;

[0108] Figure 4 Based on Figure 1 A specific flowchart illustrating the determination of whether image segmentation is supported in the illustrated embodiment;

[0109] Figure 5 Based on Figure 1 Another specific flowchart for determining whether image segmentation is supported in the illustrated embodiment;

[0110] Figure 6 Based on Figure 1 A flowchart illustrating a specific method for determining whether a row height is greater than the maximum row height in the embodiment shown.

[0111] Figure 7 A specific flowchart for calculating the number of image blocks and the size of image blocks provided in an embodiment of this application;

[0112] Figure 8 This is a specific flowchart of image block transmission provided in an embodiment of this application;

[0113] Figure 9 This is a schematic diagram of the structure of an image transmission device provided in an embodiment of this application. Detailed Implementation

[0114] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

[0115] To reduce transmission costs and improve the transmission efficiency of high-resolution images, embodiments of this application provide an image transmission method, apparatus, system, processing device, computer-readable storage medium, and computer program product. The image transmission method provided in this application embodiment is described below.

[0116] This application provides an image transmission method, such as... Figure 1As shown, a PCIE driver 102 can be applied to a processing device 101, which is connected to a capture card 103 via a PCIE bus, and the capture card 103 is connected to an image acquisition device 104.

[0117] like Figure 2 As shown, an image transmission method includes:

[0118] S201, upon receiving an image transmission instruction, the maximum row height and image block information of the image that the memory of the acquisition card can store are calculated based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card.

[0119] The image block information includes the image block size, the number of image blocks, and the height of the image block is not greater than the maximum row height.

[0120] S202, control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device from the image acquisition device, and obtain the image block corresponding to the image to be transmitted;

[0121] S203, control the acquisition card to store the image block into the memory of the acquisition card;

[0122] S204, based on the image block size and the number of image blocks, the image blocks are written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus to obtain the transmitted image.

[0123] As can be seen, in the solution provided in this application embodiment, the PCIE driver applied to the processing device connects the processing device to the acquisition card via the PCIE bus, and the acquisition card connects to the image acquisition device. When the image transmission command is received, the PCIE driver can calculate the maximum row height and image block information that the acquisition card's memory can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the acquisition card's memory. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height. The driver controls the acquisition card to obtain the image to be transmitted acquired by the image acquisition device, obtains the image block corresponding to the image to be transmitted, controls the acquisition card to store the image block in the acquisition card's memory, and, based on the image block size and the number of image blocks, writes the image block from the acquisition card's memory to the corresponding location of the preset cache of the processing device via the PCIE bus to obtain the transmitted image. Since the image block corresponding to the image to be transmitted can be obtained, the image block can be stored in the memory of the acquisition card, and then written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus to realize the image transmission. In this way, the image transmission through the PCIe bus is not limited by network resources, which can reduce the transmission cost. At the same time, transmitting by image block can support the transmission of high-resolution images and improve the transmission efficiency of high-resolution images.

[0124] By connecting an image acquisition device to a capture card, images can be acquired. This reduces the CPU (Central Processing Unit) usage of the processing device and avoids frame drops. A capture card is a device that captures analog signals such as photoelectric, video, and audio signals from the outside world and digitizes them for digital processing in a computer. Types of capture cards include image capture cards, video capture cards, audio capture cards (such as sound cards), and data capture cards.

[0125] After acquiring an image, the capture card can store it in DDR (Double Data Rate) memory. DDR memory, or Double Data Rate Synchronous Dynamic Random Access Memory, is a currently mainstream form of memory. The PCIe driver of the processing device can access DDR memory to enable image transmission. A driver is a special program that allows communication between a computer and a device. For example, the computer's operating system can control hardware devices through drivers.

[0126] PCIe (Peripheral Component Interconnect Express) is a high-speed serial computer expansion bus standard. Acquisition cards are PCIe devices and can connect to processing devices via the PCIe bus. For example, an acquisition card can be plugged into the PCIe interface of a processing device. This allows images to be transmitted via the PCIe bus without needing to be transmitted over a network. Acquisition card memory can use DDR memory; no specific limitation is made here.

[0127] However, the size of images that a capture card can capture depends primarily on the size of its DDR memory. As the size of the images to be captured increases, the DDR memory of the capture card may not be able to fully store a single frame of a high-resolution image, thus preventing the transmission of high-resolution images. Therefore, this application proposes an image transmission method that can transmit high-resolution images without being limited by network constraints.

[0128] In step S201, upon receiving an image transmission command, the PCIe driver can calculate the maximum row height and image block information that the capture card's memory can store, based on the image information of the image to be transmitted, the memory size of the capture card, and the number of memory partitions on the capture card. Specifically, the number of image blocks and the size of each image block can be set in the corresponding registers of the capture card.

[0129] To transmit images that meet user requirements, users can configure the image information of the images to be transmitted to the PCIe driver. To improve transmission efficiency, images can be transmitted in the form of image blocks. This requires partitioning the capture card's memory so that subsequent image blocks can be stored before the blocks already stored in the capture card's memory are written to the processing device. Therefore, users can configure the number of memory partitions on the capture card to the PCIe driver. The image information may include the image's line height, width, size, and resolution, which are not specifically limited here.

[0130] In this way, when the PCIe driver receives the image transmission command, it can obtain the image information of the image to be transmitted, the memory size of the capture card, and the number of memory partitions on the capture card.

[0131] As one implementation, the image information includes at least the image size and row height of the image to be transmitted. The step of calculating the maximum row height and image block information that the acquisition card's memory can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the acquisition card's memory can include:

[0132] Step A1: Calculate the maximum row height of the image that the acquisition card can store based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card.

[0133] The PCIe driver can calculate the size of each partition in the capture card's memory based on the capture card's memory size and the number of partitions. Then, based on the partition size and the size of the image to be transmitted, it can calculate the maximum row height of the image that each partition can store, thus obtaining the maximum row height of the image that the capture card can store. The number of partitions in the capture card's memory can be set according to actual needs, such as 3 or 4.

[0134] In one implementation, the memory of the capture card consists of multiple memory blocks. The PCIE driver can calculate the maximum row height of the image that a single memory block of the capture card can store based on the image information of the image to be transmitted and the size of a single memory block.

[0135] Step A2: Based on the image size, row height, and maximum row height of the image to be transmitted, calculate the image block size and number of image blocks corresponding to the image to be transmitted.

[0136] After calculating the maximum row height of the image that the capture card can store, the PCIe driver can calculate the number of image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height. Then, based on the size of the image to be transmitted and the number of image blocks, it can calculate the size of each image block. The sizes of the image blocks can be the same or different. The height of each image block is not greater than the maximum row height.

[0137] For example, if the user sets the row height, width, and image size of the image to be transmitted to imageHeight, imageWidth, and imageSize respectively, and the capture card's memory size is DRRSize, and the number of memory partitions on the capture card is NodeNum, then when the PCIe driver receives the image transmission command, it can calculate the size of each partition (DRRSize / NodeNum) based on the capture card's memory size and the number of memory partitions. Furthermore, based on the partition size and the size of the image to be transmitted, it can calculate the maximum row height (Height) that the capture card can store.

[0138] Then, based on the image height (imageHeight) and the maximum image height (Height) of the image to be transmitted, the number of image blocks (N) corresponding to the multiple image blocks of the image to be transmitted is calculated, and based on the size (imageSize) of the image to be transmitted and the number of image blocks (N), the size (BlockSize) of the image block is calculated.

[0139] In step S202, the PCIE driver can control the acquisition card to obtain the image to be transmitted acquired by the image acquisition device, and obtain the image block corresponding to the image to be transmitted according to the image block size.

[0140] For example, when an image transmission command is received, the PCIe driver can calculate the image block size corresponding to the image to be transmitted as BlockSize. Then, when the PCIe driver controls the acquisition card to acquire the image to be transmitted from the image acquisition device, it can obtain the image block of size BlockSize corresponding to the image to be transmitted.

[0141] In step S203, the PCIe driver can control the capture card to store image blocks into the capture card's memory. Since the PCIe driver obtains the image blocks corresponding to the images to be transmitted sequentially, controlling the capture card to store the image blocks into the capture card's memory also proceeds sequentially. In one embodiment, the PCIe driver can control the capture card to store image blocks into an unoccupied partition of the capture card's memory.

[0142] For example, the capture card's memory has three partitions: partition a1, partition a2, and partition a3. When the PCIE driver obtains image block A1 corresponding to the image to be transmitted, it can control the capture card to store image block A1 in partition a1 of the capture card's memory. If, when it obtains image block A2 corresponding to the image to be transmitted, image block A1 still occupies partition a1, then the PCIE driver can control the capture card to store image block A2 in partition a2.

[0143] After the PCIE driver controls the capture card to store image blocks in the capture card's memory, it can write the image blocks from the capture card's memory to the corresponding location of the processing device's preset cache via the PCIE bus based on the image block size and the number of image blocks, thereby obtaining the transmitted image, i.e., executing step S204.

[0144] In one implementation, to avoid repeatedly writing image blocks in memory to the same location corresponding to a preset cache, the location corresponding to the preset cache may correspond to the available memory, and the PCIe driver may determine the location corresponding to the preset cache to which each image block is written.

[0145] As one implementation, the step of writing image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, based on the image block size and the number of image blocks, may include:

[0146] Step B1: Obtain the address corresponding to the preset cache of the processing device;

[0147] Step B2: For each image block stored in the memory of the acquisition card, based on the size of the image block, the image block is written from the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, until the number of image blocks written reaches the specified number of image blocks.

[0148] To write image blocks from the capture card's memory to the corresponding location in the processing device's preset cache, the PCIe driver can obtain the address of the processing device's preset cache. Thus, for each image block stored in the capture card's memory, the PCIe driver can determine the address of that image block in the processing device's preset cache based on the image block size, and then write the image block from the capture card's memory to the address of the processing device's preset cache via the PCIe bus, until the number of image blocks written reaches the specified limit.

[0149] Specifically, the PCIe driver can record the number of image blocks that have been transmitted. Based on this number, the size of each image block, and the address of the preset cache of the processing device, it can determine the writing position of the current image block in the preset cache, and then write the image block from the memory of the capture card to the corresponding position of the preset cache. After all image blocks are written to the preset cache, the transmitted image is obtained, which can then be processed or displayed.

[0150] For example, if the image blocks corresponding to the image to be transmitted all have a block size of BlockSize, the number of image blocks is 3, and the address of the preset cache of the processing device is pBuf, then when the PCIe driver writes the second image block from the capture card's memory to the corresponding location in the preset cache via the PCIe bus, it can determine the writing position of the second image block in the preset cache based on the number of transmitted image blocks (1), the block size (BlockSize), and the address of the preset cache (pBuf), and then write the second image block to the address corresponding to the preset cache. After the PCIe driver writes all three image blocks to the corresponding locations in the preset cache, the transmitted image is obtained.

[0151] In this embodiment, once the image block corresponding to the image to be transmitted is obtained, the PCIe driver can store the image block in the memory of the acquisition card, and then write the image block from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus to realize the image transmission. In this way, the image transmission through the PCIe bus is not limited by network resources, which can reduce the transmission cost. At the same time, transmitting by image block can support the transmission of high-resolution images and improve the transmission efficiency of high-resolution images.

[0152] As one implementation method of this application, such as Figure 3 As shown, the step of storing each image block in the memory of the acquisition card, and writing the image block from the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, based on the image block size, until the number of image blocks written reaches the specified number of image blocks, may include:

[0153] S301, for each image block stored in the memory of the acquisition card, an image block is read from the memory of the acquisition card;

[0154] After the PCIe driver stores image blocks into the capture card's memory, it can write the image blocks to the corresponding location in the processing device's preset cache. Then, as each image block is stored in the capture card's memory, the PCIe driver can read the image blocks from the capture card's memory and write them to the corresponding location in the processing device's preset cache in a specific order. For example, if the PCIe driver stores image block A1 in the capture card's memory, it can read image block A1 from the capture card's memory.

[0155] S302, if an image ready interrupt signal is received, the number of image blocks that have been written to the preset buffer is obtained;

[0156] The image ready interrupt signal indicates that an image block has been read.

[0157] In one implementation, if the PCIe driver reads the current image block, it can obtain an image ready interrupt signal. Upon obtaining the image ready interrupt signal, the PCIe driver can obtain the number of image blocks already written to a preset cache to further determine the position of the current image block to be written in the preset cache.

[0158] S303, determine the writing position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the image block size;

[0159] The PCIe driver writes image blocks from the capture card's memory to the processing device's preset buffer, requiring the determination of the write location. Since the PCIe driver reads only one image block from the capture card's memory at a time, it can determine the space occupied by each image block based on its size. Then, based on the number of already transmitted image blocks and the address corresponding to the preset buffer, it determines the write location of the current image block within the preset buffer.

[0160] For example, if the PCIe driver obtains the address of the preset cache as pBuf, the number of image blocks already written to the preset cache is 3, and the image blocks are all the same size, namely BlockSize, then the PCIe driver can determine the current image block's position to be written in the preset cache based on pBuf + 3 * BlockSize.

[0161] S304, the current image block is written from the memory of the acquisition card to the location to be written via the PCIe bus;

[0162] After determining the write location of the current image block in the preset buffer, the PCIe driver can write the current image block from the capture card's memory to the write location via the PCIe bus. For example, if the current image block is the 4th image block, the PCIe driver can write the 4th image block to the pBuf+3*BlockSize location.

[0163] S305, determine whether the number of image blocks currently written to the preset cache has reached the number of image blocks;

[0164] S306, if the number of image blocks currently written to the preset cache has not reached the number of image blocks, return to the step of reading image blocks from the memory of the acquisition card until the number of image blocks currently written to the preset cache reaches the number of image blocks.

[0165] After the PCIe driver writes the current image block to the corresponding location in the preset cache, the number of image blocks currently written to the preset cache can be obtained, and then it can be determined whether the number of image blocks currently written to the preset cache has reached the required number of image blocks.

[0166] If the number of image blocks currently written to the preset buffer has not yet reached the required number of image blocks, it means that there are still image blocks that have not been written to the corresponding positions in the preset buffer. In this case, the next image block can be read from the memory of the acquisition card until the number of image blocks currently written to the preset buffer reaches the required number of image blocks, that is, all image blocks are written to the corresponding positions in the preset buffer. If the number of image blocks currently written to the preset buffer reaches the required number of image blocks, it means that all image blocks have been written to the corresponding positions in the preset buffer, and the transmitted image can be obtained.

[0167] For example, if the number of image blocks to be transmitted is 5, the PCIe driver can determine that the number of image blocks currently written to the preset cache is 4. Since the number of image blocks currently written to the preset cache has not reached the number of image blocks 5, the 5th image block can be read from the memory of the capture card, and then all image blocks can be written to the corresponding positions of the preset cache to obtain the transmitted image.

[0168] As can be seen, in this embodiment, the PCIe driver can store each image block in the capture card's memory, read image blocks from the capture card's memory, and, upon receiving an image ready interrupt signal, obtain the number of image blocks already written to the preset cache. Then, based on the address, the number of image blocks already written to the preset cache, and the image block size, it determines the writing position of the current image block in the preset cache. After writing the current image block to the corresponding position in the preset cache, it determines whether the number of image blocks already written to the preset cache has reached the required number of image blocks. If the number of image blocks already written to the preset cache has reached the required number of image blocks, the transmitted image is obtained. This block-based image transmission supports high-resolution image transmission and improves the transmission efficiency of high-resolution images. Furthermore, image transmission via the PCIe bus eliminates the need for network resources, reducing transmission costs.

[0169] As one embodiment of this application, the step of determining the writing position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the image block size may include:

[0170] Based on the address, the number of image blocks already written to the preset cache, and the image block size, the write position pBuf' of the current image block in the preset cache is calculated using the following formula:

[0171] pBuf'=pBuf+CurBlockNum*BlockSize

[0172] Where pBuf is the address, CurBlockNum is the number of image blocks written to the preset cache, and BlockSize is the size of the image block.

[0173] Since the PCIe driver records the size of each image block and can obtain the address of the processing device's preset cache, when each image block size is the same, the PCIe driver can determine the current image block's write position in the preset cache according to the formula pBuf' = pBuf + CurBlockNum * BlockSize, based on the number of image blocks already transferred, the image block size, and the address. Here, pBuf is the address, CurBlockNum is the number of image blocks already written to the preset cache, and BlockSize is the image block size. It should be noted that when no image blocks are being written, i.e., when the PCIe driver obtains the first image block, CurBlockNum is 0.

[0174] In one implementation, the PCIe driver can number the image blocks. Based on these numbers, the number of image blocks already written to a preset cache can be determined. Then, based on the address, the current image block's sequence number, and the image block size, the write position of the current image block in the preset cache is determined using the formula pBuf' = pBuf + (CurBlockNum - N) * BlockSize. Here, pBuf is the address, CurBlockNum is the current image block's sequence number, N is the sequence number of the first image block, and BlockSize is the image block size.

[0175] For example, PCIe drivers can number image blocks according to the number of blocks they correspond to. If there are 3 image blocks, their numbers are 1, 2, and 3. The address corresponding to writing each image block to the preset cache can be calculated using the formula pBuf' = pBuf + (CurBlockNum - 1) * BlockSize, which are pBuf, pBuf + BlockSize, and pBuf + 2BlockSize, respectively.

[0176] For example, the PCIe driver can number image blocks, starting from 0. If there are 3 image blocks, their numbers are 0, 1, and 2. The location of each image block written to the preset buffer is calculated using the formula pBuf' = pBuf + CurBlockNum * BlockSize, which are pBuf, pBuf + BlockSize, and pBuf + 2BlockSize, respectively.

[0177] For example, the PCIe driver can number image blocks, starting with 100. If there are three image blocks, their numbers would be 100, 101, and 102. The address corresponding to writing each image block to the preset cache is calculated using the formula pBuf' = pBuf + (CurBlockNum - 100) * BlockSize, which are also pBuf, pBuf + BlockSize, and pBuf + 2BlockSize, respectively.

[0178] If each image block has a different size, the write position of the current image block in the preset cache can be determined based on the address of the preset cache, the number of image blocks that have been transmitted, and the size of each image block.

[0179] As can be seen, in this embodiment, the PCIe driver can calculate the current image block's writing position in the preset cache according to the address, the number of image blocks already written to the preset cache, and the image block size, according to a preset formula. This allows each image block to be written to the corresponding position in the preset cache, resulting in the transmitted image and completing the image transmission.

[0180] As one embodiment of this application, after the steps of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted, the above method may further include:

[0181] The image blocks are numbered, and the sequence number of the image blocks is recorded.

[0182] To determine whether the number of image blocks currently written to the preset cache has reached the required number of image blocks, the PCIe driver can make this judgment based on the image block's serial number. Therefore, the PCIe driver can number the image blocks and record their serial numbers.

[0183] In one implementation, the PCIe driver can number the image blocks according to the number of image blocks they correspond to. The image block number then corresponds to the number of image blocks currently written to the preset cache. In another implementation, the PCIe driver can number the image blocks starting from 0. In yet another implementation, the PCIe driver can number the image blocks starting from any number.

[0184] For example, if the number of image blocks is 3, and the PCIe driver numbers the image blocks according to their corresponding number, the image block numbers would be 1, 2, and 3. If the PCIe driver numbers the image blocks starting from 0, the image block numbers would be 0, 1, and 2.

[0185] The step of determining whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks may include:

[0186] Based on the sequence number of the current image block, determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks.

[0187] If a PCIe driver numbers image blocks according to the number of image blocks they correspond to, then the image block number is the number of image blocks currently written to the preset cache. The PCIe driver can determine whether the number of image blocks currently written to the preset cache has reached the required number of image blocks by checking whether the image block number CurBlockNum equals the number of image blocks BlockNum.

[0188] If the PCIe driver starts numbering image blocks from 0, then the number of image blocks in the preset cache is the number of image blocks currently written to the cache by incrementing the image block number by 1. The PCIe driver can determine whether the number of image blocks currently written to the preset cache has reached the required number of image blocks by checking whether the image block number CurBlockNum+1 equals the number of image blocks BlockNum.

[0189] If a PCIe driver uses any number to number image blocks, then certain calculations are needed to determine the number of image blocks currently written to the preset cache. For example, if the number of image blocks is 3, and the PCIe driver numbers the image blocks according to their corresponding number, then when the current image block number is 3, it can be determined that the number of image blocks currently written to the preset cache has reached the required number of image blocks. If the PCIe driver starts numbering the image blocks from 0, then when the current image block number is 2, it can be determined that the number of image blocks currently written to the preset cache has reached the required number of image blocks.

[0190] As can be seen, in this embodiment, the PCIe driver can determine whether the number of image blocks currently written to the preset cache has reached the required number of image blocks based on the current image block number. Therefore, if the number of image blocks currently written to the preset cache has reached the required number of image blocks, the transmitted image can be obtained.

[0191] As one embodiment of this application, the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height may include:

[0192] Based on the row height of the image to be transmitted and the maximum row height, the number N of image blocks corresponding to the multiple image blocks of the image to be transmitted is calculated according to the following formula:

[0193]

[0194] Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height;

[0195] Based on the image size of the image to be transmitted and the number of image blocks, the image block size of the multiple image blocks corresponding to the image to be transmitted is calculated.

[0196] After obtaining the row height of the image to be transmitted and calculating the maximum row height, the PCIe driver can, based on the row height of the image to be transmitted and the maximum row height, use the formula... The number of image blocks corresponding to the image to be transmitted is calculated. Here, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height.

[0197] In other words, the PCIe driver can round up imageHeight / Height, and then use the rounded result to determine the number of image blocks corresponding to the image to be transmitted. That is, when imageHeight is not zero when divided by Height, N = imageHeight / Height + 1.

[0198] For example, if the PCIE driver obtains that the row height of the image to be transmitted is 23cm and calculates that the maximum row height is 15cm, then according to the formula N = imageHeight / Height, the result is 1.53. This result can be rounded up to get 2. Therefore, the number of image blocks corresponding to the multiple image blocks of the image to be transmitted is 2.

[0199] The PCIe driver obtains the number of image blocks and can calculate the number of image blocks corresponding to the image to be transmitted based on the image size and the number of image blocks. In one implementation, the PCIe driver can divide the image to be transmitted into even blocks based on the image size and the number of image blocks, calculating multiple image blocks of the same size corresponding to the image to be transmitted. In another implementation, the PCIe driver can divide the image to be transmitted into blocks according to certain requirements based on the image size and the number of image blocks, calculating multiple image blocks of different sizes corresponding to the image to be transmitted.

[0200] For example, if the PCIe driver obtains that the number of image blocks is 2, it can divide the image to be transmitted into blocks based on the image size and the number of image blocks, resulting in image block 1 and image block 2. If the blocks are divided equally, image block 1 and image block 2 will be the same size; if the blocks are divided according to certain requirements, image block 1 and image block 2 will be different sizes.

[0201] Because the PCIe driver divides the image to be transmitted into multiple image blocks based on the number of corresponding image blocks and the size of the image to be transmitted, the size of the last image block is generally smaller than the size of the previously divided image blocks. Therefore, the size of the last image block can be calculated by subtracting the sum of the sizes of the previous image blocks from the size of the image to be transmitted, i.e., by using the formula ImageSize - CurBlockNum * BlockSize. Here, ImageSize is the size of the image to be transmitted, CurBlockNum is the number of previously divided image blocks, and BlockSize is the size of the previously divided image blocks. If the size of the last image block is the same as the size of the previously divided image blocks, then it is BlockSize.

[0202] As can be seen, in this embodiment, the PCIe driver can calculate the number of image blocks corresponding to the multiple image blocks of the image to be transmitted based on the row height and maximum row height of the image to be transmitted, according to the formula N = imageHeight / Height. Then, based on the image size of the image to be transmitted and the number of image blocks, the size of the multiple image blocks corresponding to the image to be transmitted can be calculated. This block-based transmission of images supports high-resolution image transmission and improves the transmission efficiency of high-resolution images.

[0203] As one embodiment of this application, the step of writing the image blocks from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus, based on the image block size and the number of image blocks, to obtain the transmitted image, may include:

[0204] Based on the image block size and the number of image blocks, DMA technology is used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image.

[0205] To reduce CPU resource usage and lower CPU utilization, PCIe drivers can employ DMA (Direct Memory Access) technology. DMA copies data from one address space to another, providing high-speed data transfer between peripherals and memory, or between memory devices. Therefore, it allows for rapid data movement without CPU intervention, improving data transfer efficiency. When using DMA, the user needs to set the source address, destination address, amount of data to transfer, and number of transfers. After the user sets the relevant parameters, DMA can initiate data transfer.

[0206] In one implementation, the acquisition card may include a DMA module, allowing the PCIe driver to control the transfer of image blocks. Specifically, before controlling the DMA module, the PCIe driver sets the source address, destination address, and number of image blocks for transfer. Then, the PCIe driver can control the DMA module to write the image blocks from the acquisition card's memory to the corresponding location in the preset buffer via the PCIe bus, thus obtaining the transferred image.

[0207] For example, the user can set the source address of image block transmission to the memory address of the capture card, the destination address to the address of the preset buffer, and the number of image blocks. When an image ready interrupt signal is received, the PCIe driver can determine the write location of the current image block in the preset buffer based on the address of the preset buffer, the number of image blocks already written to the preset buffer, and the image block size. Then, it can write the current image block from the capture card's memory to the write location in the preset buffer via the PCIe bus. This process continues until the number of image blocks to be transmitted is reached, at which point all image blocks can be written to the corresponding positions in the preset buffer, resulting in the transmitted image.

[0208] As can be seen, in this embodiment, the PCIe driver uses DMA technology to write image blocks from the capture card's memory to the corresponding location in the processing device's preset cache via the PCIe bus, based on the image block size and number, thus obtaining the transmitted image. This eliminates the need for CPU intervention, enabling rapid data movement and improving data transmission efficiency.

[0209] As one implementation method of this application, such as Figure 4 As shown, before the steps described above, which calculate the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card, the above method may further include:

[0210] S401, determine whether the acquisition card supports image segmentation; if image segmentation is supported, proceed to step S402; if image segmentation is not supported, proceed to step S403.

[0211] S402, Execute the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card;

[0212] S403, determine that the number of image blocks is 1, and control the acquisition card to store the image to be transmitted into the memory of the acquisition card.

[0213] The image to be transmitted, acquired by the PCIe driver, may be a high-resolution image, a standard-resolution image, or a low-resolution image. If the image to be transmitted is not a high-resolution image, and the memory size of the capture card can meet the storage requirements of the image to be transmitted, then there is no need to divide the image to be transmitted into blocks; the PCIe driver can directly store the image to be transmitted into the memory of the capture card.

[0214] In one implementation, the PCIe driver can determine whether the capture card supports image segmentation. If the capture card supports image segmentation, the PCIe driver can calculate the maximum row height of the image that the capture card's memory can store based on the image information of the image to be transmitted, the memory size of the capture card, and the number of partitions in the capture card's memory. When the row height of the image to be transmitted is greater than the maximum row height, the image to be transmitted is segmented, and the image block information is calculated.

[0215] If the capture card does not support image chunking, the PCIe driver can determine that the number of image chunks is 1 and control the capture card to store the image to be transmitted in the capture card's memory.

[0216] In one implementation, the PCIe driver can determine whether the capture card supports image chunking based on the resolution of the image to be transmitted. If the resolution of the image to be transmitted is greater than a preset threshold, then the PCIe driver can determine that the capture card supports image chunking. If the resolution of the image to be transmitted is not greater than the preset threshold, then it is determined that the capture card does not support image chunking.

[0217] As can be seen, in this embodiment, the PCIe driver can determine whether the capture card supports image segmentation. If image segmentation is supported, images can be transmitted in segments, which can support the transmission of high-resolution images and improve the transmission efficiency of high-resolution images.

[0218] like Figure 5 As shown, prior to the step of writing the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus based on the image block size and the number of image blocks, the above method may further include:

[0219] S501, determine whether the acquisition card supports image segmentation; if it supports image segmentation, proceed to step S502; if it does not support image segmentation, proceed to step S503.

[0220] S502, execute the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks;

[0221] S503, the image to be transmitted is read from the memory of the acquisition card via the PCIe bus, and the image to be transmitted is written to the location corresponding to the preset cache of the processing device.

[0222] When the PCIe driver acquires the image to be transmitted, it can determine whether the capture card supports image segmentation. If the capture card supports image segmentation, it obtains the image block corresponding to the image to be transmitted and stores it in the capture card's memory. If the capture card does not support image segmentation, it stores the image to be transmitted directly in the capture card's memory. Therefore, when the PCIe driver transmits the image block, it needs to determine again whether the capture card supports image segmentation in order to use different methods to transmit the image to be transmitted to the processing device's preset buffer.

[0223] If the capture card supports image segmentation, it means that the PCIe driver has segmented the image to be transmitted. Then, the PCIe driver can write the image blocks from the capture card's memory to the corresponding location of the processing device's preset cache via the PCIe bus to obtain the transmitted image.

[0224] If the capture card does not support image chunking, it means that the PCIe driver determines that the number of image chunks to be transmitted is 1. In this case, the PCIe driver can read the image to be transmitted from the memory of the capture card through the PCIe bus and write the image to be transmitted to the corresponding location of the preset cache of the processing device.

[0225] As can be seen, in this embodiment, the PCIe driver can determine whether the acquisition card supports image segmentation. If image segmentation is supported, the driver can read the corresponding image block from the acquisition card's memory via the PCIe bus until the image block is written to the corresponding location of the preset cache of the processing device, thus obtaining the transmitted image.

[0226] As one implementation method of this application, such as Figure 6 As shown, before the steps described above, in which the image block size and number of image blocks corresponding to the image to be transmitted are calculated based on the image size, the row height, and the maximum row height, the method may further include:

[0227] S601, determine whether the row height of the image to be transmitted is greater than the maximum row height; if the row height of the image to be transmitted is greater than the maximum row height, execute step S602; if the row height of the image to be transmitted is not greater than the maximum row height, execute step S603.

[0228] S602, perform the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height and the maximum row height;

[0229] S603, determine the number of image blocks as 1, and store the image to be transmitted in the memory of the acquisition card.

[0230] Once the PCIE driver obtains the row height and maximum row height of the image to be transmitted, it can determine whether the row height of the image to be transmitted is greater than the maximum row height.

[0231] If the row height of the image to be transmitted is greater than the maximum row height, it indicates that the memory of the capture card is insufficient to store the image to be transmitted. In this case, the image to be transmitted needs to be divided into blocks. The PCIe driver can divide the image to be transmitted into blocks based on the row height and the maximum row height, thus obtaining multiple image blocks corresponding to the image to be transmitted.

[0232] If the row height of the image to be transmitted is not greater than the maximum row height, it indicates that the memory of the acquisition card can meet the storage requirements of the image to be transmitted. There is no need to divide the image to be transmitted into blocks. The number of image blocks can be determined to be 1, that is, the number of image blocks is set in the register of the acquisition card, and the image to be transmitted can be stored in the memory of the acquisition card.

[0233] As can be seen, in this embodiment, the PCIe driver can determine whether the row height of the image to be transmitted is greater than the maximum row height to determine whether the image to be transmitted should be divided into blocks. When the image to be transmitted is a high-resolution image, it can be transmitted in blocks to improve the transmission efficiency of high-resolution images. At the same time, it can be compatible with the transmission of low-resolution images.

[0234] Figure 7 This is a schematic diagram illustrating a specific process for image segmentation provided in an embodiment of this application. The following is in conjunction with... Figure 7 The process of image segmentation in the image transmission method provided in this application embodiment will be illustrated with an example. For instance... Figure 7 As shown, the image segmentation process provided in this application embodiment may include the following steps:

[0235] S701, set image information (ImageWidth, ImageHeight, ImageSize);

[0236] Users can set the image information of the image to be transferred to the PCIe driver. The image information can include the image width (ImageWidth), line height (ImageHeight), and image size (ImageSize).

[0237] S702, set the number of memory partitions (NodeNum) of the capture card;

[0238] Since the PCIe driver needs to write the image to be transmitted to the processing device into the processing device's preset cache, the user can pre-configure the preset cache to be written to. The user can also set the number of memory partitions (NodeNum) of the capture card to the PCIe driver.

[0239] S703, obtain the available DDR size (DDRSize);

[0240] The PCIe driver can obtain the DDR size of the capture card, i.e., DDRSize. Based on DDRSize, it can be determined whether the memory size of the capture card meets the storage requirements of the image to be transmitted.

[0241] S704, Does it support infinite row height? If yes, proceed to step S705; if no, proceed to step S710.

[0242] The PCIe driver can determine whether the capture card supports unlimited line height, i.e., whether the capture card supports segmenting high-resolution images. If the capture card supports segmenting the image to be transmitted, it can segment the image based on the line height of the image to be transmitted and the maximum line height that the memory can store, calculating the number and size of the multiple image blocks corresponding to the image to be transmitted. If the capture card does not support unlimited line height, it does not support segmenting the image to be transmitted, and in this case, a single frame of the image to be transmitted can be stored in the capture card's memory.

[0243] S705 calculates the available DDR size for each partition (DDRSize / NodeNum);

[0244] If the capture card supports unlimited line height, meaning it supports dividing the image to be transmitted into blocks, then the PCIe driver can calculate the size of each partition according to the formula DDRSize / NodeNum, based on the capture card's memory size and the number of memory partitions set for the capture card.

[0245] S706, calculates the maximum row height;

[0246] When a PCIe driver receives an image transmission command, it can obtain the image information (ImageWidth, ImageHeight, ImageSize), the memory size (DDRSize) of the capture card, and the number of memory partitions (NodeNum) of the capture card. The PCIe driver can then calculate the partition size of the capture card based on the memory size (DDRSize) and the number of memory partitions (NodeNum), and then calculate the maximum line height (Height) of the image based on the partition size and the size of the image to be transmitted.

[0247] S707, Is the maximum line height less than the line height of the image to be transmitted? If yes, proceed to step S708; if no, proceed to step S710.

[0248] The PCIE driver controls the capture card to acquire the image to be transmitted from the image acquisition device. After obtaining the row height of the image to be transmitted and the maximum row height of the image that can be stored in memory, it can determine whether the maximum row height is less than the row height of the image to be transmitted. If the maximum row height is less than the row height of the image to be transmitted, the image to be transmitted needs to be divided into blocks. If the maximum row height is not less than the row height of the image to be transmitted, then there is no need to divide the image to be transmitted into blocks.

[0249] S708, Calculate the number of image blocks to be transmitted (ImageHeight / Height);

[0250] The PCIe driver can determine the maximum line height of the image to be transmitted, based on the ImageHeight and the maximum line height of the image that can be stored in memory, according to the formula... Calculate the number of image blocks corresponding to the multiple image patches of the image to be transmitted. Then, based on the size of the image to be transmitted and the number of image patches, calculate the size of the multiple image patches.

[0251] S709, Set the number of image blocks;

[0252] After the PCIe driver obtains the number of image blocks, it can set the number of image blocks to the corresponding register of the capture card.

[0253] S710, set the number of blocks to 1.

[0254] If the maximum row height is not less than the row height of the image to be transmitted, the number of image blocks is set to 1, and the PCIE driver can control the capture card to store the image to be transmitted into the capture card's memory.

[0255] As can be seen, in the solution provided in this application embodiment, the PCIE driver applied to the processing device connects the processing device to the acquisition card via the PCIE bus, and the acquisition card connects to the image acquisition device. When the PCIE driver receives an image transmission command, it can calculate the maximum row height of the image that the acquisition card's memory can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the acquisition card's memory. It then controls the acquisition card to acquire the image to be transmitted from the image acquisition device, and based on the row height and maximum row height of the image to be transmitted, it divides the image into blocks, calculating the number of image blocks and the size of each block. Since the image to be transmitted can be divided into blocks based on the row height and maximum row height to obtain multiple image blocks, this block-based image transmission supports high-resolution image transmission.

[0256] Figure 8 This is a schematic diagram illustrating a specific process of the image transmission method provided in an embodiment of this application. The following is a detailed explanation of the process. Figure 8 The image transmission method provided in the embodiments of this application will be described by way of example. Figure 8 As shown, the image transmission method provided in this application embodiment may include the following steps:

[0257] S801, Input the preset cache address (pBuf) of the processing device;

[0258] The PCIe driver can obtain the address pBuf of the processing device's default cache, and write it to the corresponding location in the processing device's default cache when an image block is acquired. The address of the processing device's default cache can be set by the user.

[0259] S802, Has the image ready interrupt signal arrived? If yes, proceed to step S803; if no, continue to proceed to step S802.

[0260] The PCIe driver can determine if an image ready interrupt signal has arrived. If an image ready interrupt signal is received, the number of image blocks written to the preset buffer can be obtained. When using DMA technology, DMA can count the number of transfers (i.e., the number of image blocks written to the preset buffer) until the number of transfers reaches the required number of image blocks. If no image ready interrupt signal is received, it can continuously listen for it.

[0261] S803, Does it support infinite row height? If yes, proceed to step S804; if no, proceed to step S808.

[0262] When the PCIe driver receives an image ready interrupt signal, it can determine whether the capture card supports infinite line height. If it does, the current image block can be retrieved from the capture card's memory for transmission. If it does not support infinite line height, step S808 is executed.

[0263] S804, obtain the current image block CurBlockNum;

[0264] If the capture card supports unlimited line height, the PCIe driver can retrieve the current image block from the capture card's memory and the number of image blocks already written to the preset buffer. The PCIe driver encodes image blocks starting from 0, and the current image block's sequence number is CurBlockNum.

[0265] S805, calculate the position of the image block to be written (pBuf + CurBlockNum * BlockSize);

[0266] The PCIe driver can determine the write position of the current image block in the preset cache according to the preset cache address, the size of each image block, and the number of image blocks that have been transferred, using the formula pBuf + CurBlockNum * BlockSize.

[0267] S806, DMA writes image blocks of size BlockSize to the corresponding location in the preset cache;

[0268] The PCIe driver can use DMA technology to write image blocks of size BlockSize from the capture card's memory to the corresponding location in the processing device's preset cache via the PCIe bus.

[0269] S807, Do you want to read all image blocks (CurBlockNum+1==BlockNum?)? If yes, proceed to step S809; if no, proceed to step S802.

[0270] The PCIe driver can determine whether the number of image blocks currently written to the preset cache has reached the required number of image blocks. This can be done by checking the image block number to see if CurBlockNum+1 == BlockNum. The process continues until the PCIe driver controls the DMA module to write all image blocks to the corresponding positions in the preset cache, thus obtaining the transmitted image.

[0271] S808, DMA reads image data into pBuf;

[0272] If the capture card does not support infinite line height, the PCIe driver can use DMA technology to read the image to be transmitted from the capture card's memory via the PCIe bus and write the image to be transmitted to the corresponding location in the preset cache of the processing device, i.e., write address pBuf.

[0273] S809 outputs the transmitted image.

[0274] The PCIe driver can obtain the transmitted image and output it. Specifically, it can perform corresponding image processing or display on the transmitted image.

[0275] As can be seen, in the solution provided in this application embodiment, the PCIe driver applied to the processing device connects the processing device to the acquisition card via the PCIe bus, and the acquisition card connects to the image acquisition device. When the PCIe driver obtains the image block corresponding to the image to be transmitted, it can control the acquisition card to store the image block in its memory. Then, the image block is written from the acquisition card's memory to the corresponding location of the preset cache on the processing device via the PCIe bus, thus obtaining the transmitted image. Since the image block can be written from the acquisition card's memory to the corresponding location of the preset cache via the PCIe bus after being stored in the acquisition card's memory, image transmission is achieved. This image transmission via the PCIe bus is not limited by network resources, reducing transmission costs. Furthermore, transmitting the image in blocks improves the transmission efficiency of high-resolution images.

[0276] Corresponding to the image transmission method described above, this application also provides an image transmission apparatus. The image transmission apparatus provided in this application will be described below.

[0277] like Figure 9 As shown, an image transmission device is applied to a PCIe driver for a processing device. The processing device is connected to a capture card via a PCIe bus, and the capture card is connected to an image acquisition device. The device includes:

[0278] The first calculation module 910 is used to calculate the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card when an image transmission instruction is obtained. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height.

[0279] The image block acquisition module 920 is used to control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device from the image acquisition device, and obtain the image block corresponding to the image to be transmitted;

[0280] Image block storage module 930 is used to control the acquisition card to store the image block into the memory of the acquisition card;

[0281] The image acquisition module 940 is used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus, based on the image block size and the number of image blocks, so as to obtain the transmitted image.

[0282] As can be seen, in the solution provided in this application embodiment, the PCIE driver applied to the processing device connects the processing device to the acquisition card via the PCIE bus, and the acquisition card connects to the image acquisition device. When the image transmission command is received, the PCIE driver can calculate the maximum row height and image block information that the acquisition card's memory can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the acquisition card's memory. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height. The driver controls the acquisition card to obtain the image to be transmitted acquired by the image acquisition device, obtains the image block corresponding to the image to be transmitted, controls the acquisition card to store the image block in the acquisition card's memory, and, based on the image block size and the number of image blocks, writes the image block from the acquisition card's memory to the corresponding location of the preset cache of the processing device via the PCIE bus to obtain the transmitted image. Since the image block corresponding to the image to be transmitted can be obtained, the image block can be stored in the memory of the acquisition card, and then written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus to realize the image transmission. In this way, the image transmission through the PCIe bus is not limited by network resources, which can reduce the transmission cost. At the same time, transmitting by image block can support the transmission of high-resolution images and improve the transmission efficiency of high-resolution images.

[0283] Optionally, the image acquisition module 940 includes:

[0284] The address acquisition submodule is used to acquire the address corresponding to the preset cache of the processing device;

[0285] The image block writing submodule is used to write each image block stored in the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, based on the size of the image block, until the number of image blocks written reaches the specified number of image blocks.

[0286] As one embodiment of this application, the above-mentioned image block writing submodule may include:

[0287] An image block reading unit is used to read image blocks from the memory of the acquisition card after storing each image block in the memory of the acquisition card.

[0288] The quantity acquisition unit is used to acquire the number of image blocks that have been written to the preset cache when an image ready interrupt signal is acquired, wherein the image ready interrupt signal indicates that an image block has been read.

[0289] The write position determination unit is used to determine the write position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the size of the image block;

[0290] An image block writing unit is used to write the current image block from the memory of the acquisition card to the location to be written via the PCIe bus;

[0291] An image block quantity determination unit is used to determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks;

[0292] The image block count reaches unit, which is used to return to the step of reading image blocks from the memory of the acquisition card when the number of image blocks currently written to the preset cache has not reached the image block count, until the number of image blocks currently written to the preset cache reaches the image block count.

[0293] As one embodiment of this application, the above-mentioned write location determination unit may include:

[0294] The write-to-location determination subunit is configured to calculate the write-to-location pBuf' of the current image block in the preset cache according to the address, the number of image blocks already written to the preset cache, and the image block size, using the following formula:

[0295] pBuf'=pBuf+CurBlockNum*BlockSize

[0296] Where pBuf is the address, CurBlockNum is the number of image blocks written to the preset cache, and BlockSize is the size of the image block.

[0297] As one embodiment of this application, the above-described apparatus may further include:

[0298] The image block numbering module is used to number the image block and record the sequence number of the image block after the step of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted.

[0299] The aforementioned image patch quantity determination unit may include:

[0300] The image block quantity determination subunit determines whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks, based on the current image block's sequence number.

[0301] Optionally, the image information includes at least the image size and row height of the image to be transmitted; the first calculation module includes:

[0302] The first calculation submodule is used to calculate the maximum row height of the image that the acquisition card can store based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card.

[0303] The second calculation submodule is used to calculate the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height.

[0304] As one embodiment of this application, the second calculation submodule described above may include:

[0305] The image block number calculation unit is used to calculate the number N of multiple image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height, according to the following formula:

[0306]

[0307] Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height;

[0308] The image block size calculation unit calculates the image block size of multiple image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted and the number of image blocks.

[0309] As one embodiment of this application, the above-described image acquisition module 940 may include:

[0310] The image acquisition submodule is used to, based on the image block size and the number of image blocks, use DMA technology to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image.

[0311] As one embodiment of this application, the above-described apparatus may further include:

[0312] The first judgment module is used to determine whether the acquisition card supports image segmentation before the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions of the memory of the acquisition card.

[0313] The first execution module is configured to, if image segmentation is supported, execute the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card;

[0314] The first storage module is used to determine that the number of image blocks is 1 if image segmentation is not supported, and to control the acquisition card to store the image to be transmitted into the memory of the acquisition card.

[0315] The above-mentioned device may further include:

[0316] The second judgment module is used to determine whether the acquisition card supports image segmentation before the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks;

[0317] The second execution module is configured to, if image segmentation is supported, execute the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus based on the image block size and the number of image blocks;

[0318] The image to be transmitted writing module is used to read the image to be transmitted from the memory of the acquisition card via the PCIe bus and write the image to be transmitted to the corresponding location of the preset cache of the processing device if image segmentation is not supported.

[0319] As one embodiment of this application, the above-described apparatus may further include:

[0320] The third judgment module is used to determine whether the row height of the image to be transmitted is greater than the maximum row height before the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height.

[0321] The first acquisition module is used to perform the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height if the row height of the image to be transmitted is greater than the maximum row height;

[0322] The second storage module is used to determine the number of image blocks as 1 if the row height of the image to be transmitted is not greater than the maximum row height, and to store the image to be transmitted in the memory of the acquisition card.

[0323] This application also provides an image transmission system, such as... Figure 1 As shown, the system includes a processing device 101, a capture card 103, and an image acquisition device 104. The processing device includes a PCIe driver 102. The processing device 101 is connected to the capture card 103 via a PCIe bus, and the capture card 103 is connected to the image acquisition device 104.

[0324] The PCIE driver 102 of the processing device 101 is used to, upon receiving an image transmission command, calculate the maximum row height and image block information that the memory of the acquisition card can store, based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device, and obtain the image block corresponding to the image to be transmitted; control the acquisition card to store the image block in the memory of the acquisition card; and, based on the image block size and the number of image blocks, write the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIE bus to obtain the transmitted image; wherein, the image block information includes the image block size, the number of image blocks, and the height of the image block is not greater than the maximum row height;

[0325] The acquisition card 103 is used to acquire the image to be transmitted acquired by the image acquisition device under the control of the PCIE driver, and store the image block in the memory of the acquisition card.

[0326] As can be seen, in the solution provided in this application embodiment, the PCIE driver applied to the processing device connects the processing device to the acquisition card via the PCIE bus, and the acquisition card connects to the image acquisition device. When the image transmission command is received, the PCIE driver can calculate the maximum row height and image block information that the acquisition card's memory can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the acquisition card's memory. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height. The driver controls the acquisition card to obtain the image to be transmitted acquired by the image acquisition device, obtains the image block corresponding to the image to be transmitted, controls the acquisition card to store the image block in the acquisition card's memory, and, based on the image block size and the number of image blocks, writes the image block from the acquisition card's memory to the corresponding location of the preset cache of the processing device via the PCIE bus to obtain the transmitted image. Since the image block corresponding to the image to be transmitted can be obtained, the image block can be stored in the memory of the acquisition card, and then written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus to realize the image transmission. In this way, the image transmission through the PCIe bus is not limited by network resources, which can reduce the transmission cost. At the same time, transmitting by image block can support the transmission of high-resolution images and improve the transmission efficiency of high-resolution images.

[0327] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can be specifically used to obtain the address corresponding to the preset cache of the processing device; for each image block stored in the memory of the acquisition card, based on the size of the image block, the image block is written from the memory of the acquisition card to the address corresponding to the preset cache of the processing device through the PCIE bus, until the number of image blocks written reaches the number of image blocks.

[0328] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can be specifically used to: read image blocks from the memory of the acquisition card after storing each image block in the memory of the acquisition card; when an image ready interrupt signal is received, obtain the number of image blocks already written to the preset cache; determine the writing position of the current image block in the preset cache according to the address, the number of image blocks already written to the preset cache, and the image block size; write the current image block from the memory of the acquisition card to the writing position through the PCIE bus; determine whether the number of image blocks currently written to the preset cache has reached the number of image blocks; if the number of image blocks currently written to the preset cache has not reached the number of image blocks, return to the step of reading image blocks from the memory of the acquisition card until the number of image blocks currently written to the preset cache reaches the number of image blocks, wherein the image ready interrupt signal indicates that an image block has been read.

[0329] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can be specifically used to calculate the write position pBuf' of the current image block in the preset cache according to the address, the number of image blocks already written to the preset cache, and the image block size, using the following formula:

[0330] pBuf'=pBuf+CurBlockNum*BlockSize

[0331] Where pBuf is the address, CurBlockNum is the number of image blocks written to the preset cache, and BlockSize is the size of the image block.

[0332] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can also be used to number the image block and record the sequence number of the image block after the step of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted.

[0333] The PCIE driver 102 of the processing device 101 can be used to determine whether the number of image blocks currently written to the preset cache has reached the number of image blocks, based on the sequence number of the current image block.

[0334] As one embodiment of this application, the image information includes at least the image size and row height of the image to be transmitted; the PCIE driver 102 of the processing device 101 can be specifically used to calculate the maximum row height of the image that the acquisition card can store based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; and to calculate the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height.

[0335] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can specifically be used to calculate the number N of multiple image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height, according to the following formula:

[0336]

[0337] Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height;

[0338] Based on the image size of the image to be transmitted and the number of image blocks, the image block sizes of the multiple images corresponding to the image to be transmitted are calculated.

[0339] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can be specifically used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIE bus based on the image block size and the number of image blocks, thereby obtaining the transmitted image.

[0340] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can also be used to determine whether the acquisition card supports image segmentation before the step of calculating the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; if image segmentation is supported, the step of calculating the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card is executed; if image segmentation is not supported, the number of image blocks is determined to be 1, and the acquisition card is controlled to store the image to be transmitted in the memory of the acquisition card;

[0341] The PCIe driver 102 of the processing device 101 can also be used to determine whether the acquisition card supports image segmentation before the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks; if image segmentation is supported, the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks is executed; if image segmentation is not supported, the image to be transmitted is read from the memory of the acquisition card through the PCIe bus and written to the location corresponding to the preset cache of the processing device.

[0342] As one embodiment of this application, the PCIE driver 102 of the processing device 101 can also be used to determine whether the row height of the image to be transmitted is greater than the maximum row height before the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size, the row height, and the maximum row height; if the row height of the image to be transmitted is greater than the maximum row height, the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size, the row height, and the maximum row height is executed; if the row height of the image to be transmitted is not greater than the maximum row height, the number of image blocks is determined to be 1, and the image to be transmitted is stored in the memory of the acquisition card.

[0343] This application embodiment also provides a processing device, including a PCIe driver, wherein:

[0344] The PCIe driver is used to execute any of the image transmission methods described in the above embodiments.

[0345] As can be seen, in the solution provided in this application embodiment, the PCIE driver applied to the processing device connects the processing device to the acquisition card via the PCIE bus, and the acquisition card connects to the image acquisition device. When the image transmission command is received, the PCIE driver can calculate the maximum row height and image block information that the acquisition card's memory can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the acquisition card's memory. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height. The driver controls the acquisition card to obtain the image to be transmitted acquired by the image acquisition device, obtains the image block corresponding to the image to be transmitted, controls the acquisition card to store the image block in the acquisition card's memory, and, based on the image block size and the number of image blocks, writes the image block from the acquisition card's memory to the corresponding location of the preset cache of the processing device via the PCIE bus to obtain the transmitted image. Since the image block corresponding to the image to be transmitted can be obtained, the image block can be stored in the memory of the acquisition card, and then written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus to realize the image transmission. In this way, the image transmission through the PCIe bus is not limited by network resources, which can reduce the transmission cost. At the same time, transmitting by image block can support the transmission of high-resolution images and improve the transmission efficiency of high-resolution images.

[0346] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described image transmission methods.

[0347] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the image transmission methods described above.

[0348] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), etc.

[0349] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0350] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, systems, processing devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0351] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. An image transmission method characterized by, A PCIe driver for a processing device connected to a capture card via a PCIe bus, the capture card being connected to an image acquisition device, the method comprising: Upon receiving an image transmission instruction, the maximum row height and image block information that the memory of the acquisition card can store are calculated based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height. The acquisition card is controlled to acquire the image to be transmitted acquired by the image acquisition device, and the image block corresponding to the image to be transmitted is obtained. The acquisition card is controlled to store the image blocks into its memory; Based on the image block size and the number of image blocks, the image blocks are written from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus to obtain the transmitted image.

2. The method of claim 1, wherein, The step of writing the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, based on the image block size and the number of image blocks, includes: Obtain the address corresponding to the preset cache of the processing device; For each image block stored in the memory of the acquisition card, based on the size of the image block, the image block is written from the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, until the number of image blocks written reaches the specified number of image blocks.

3. The method of claim 2, wherein, The step of storing each image block in the memory of the acquisition card, and writing the image block from the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, based on the image block size, until the number of image blocks written reaches the specified number of image blocks, includes: Each time an image block is stored in the memory of the acquisition card, an image block is read from the memory of the acquisition card; Upon receiving an image ready interrupt signal, the number of image blocks written to the preset buffer is obtained, wherein the image ready interrupt signal indicates that an image block has been read. Based on the address, the number of image blocks already written to the preset cache, and the image block size, determine the writing position of the current image block in the preset cache, wherein the current image block is the image block currently being read; The current image block is written from the memory of the acquisition card to the location to be written via the PCIe bus; Determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks; If the number of image blocks currently written to the preset cache has not reached the number of image blocks, return to the step of reading image blocks from the memory of the acquisition card until the number of image blocks currently written to the preset cache reaches the number of image blocks.

4. The method of claim 3, wherein, The step of determining the write position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the image block size includes: Based on the address, the number of image blocks already written to the preset cache, and the image block size, the write position pBuf' of the current image block in the preset cache is calculated using the following formula: ; Where pBuf is the address, CurBlockNum is the number of image blocks written to the preset cache, and BlockSize is the size of the image block.

5. The method of claim 3, wherein, After the step of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted, the method further includes: Number the image blocks and record their sequence numbers; The step of determining whether the number of image blocks currently written to the preset cache has reached the number of image blocks includes: Based on the sequence number of the current image block, determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks.

6. The method of claim 1, wherein, The image information includes at least the image size and row height of the image to be transmitted; The step of calculating the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card includes: The maximum row height of the image that the acquisition card can store is calculated based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card. Based on the image size of the image to be transmitted, the row height, and the maximum row height, the image block size and the number of image blocks corresponding to the image to be transmitted are calculated.

7. The method of claim 6, wherein, The step of calculating the image block size and number of image blocks corresponding to the image to be transmitted based on the row height and the maximum row height of the image to be transmitted includes: Based on the row height of the image to be transmitted and the maximum row height, the number N of image blocks corresponding to the multiple image blocks of the image to be transmitted is calculated according to the following formula: N= ; Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height; Based on the image size of the image to be transmitted and the number of image blocks, the image block size of the multiple image blocks corresponding to the image to be transmitted is calculated.

8. The method of claim 1, wherein, The step of writing the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, based on the image block size and the number of image blocks, to obtain the transmitted image includes: Based on the image block size and the number of image blocks, DMA technology is used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image.

9. The method according to any one of claims 1-5, characterized in that, Before the step of calculating the maximum row height and image block information that the memory of the acquisition card can store based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card, the method further includes: Determine whether the acquisition card supports image segmentation; If image segmentation is supported, the step of calculating the maximum row height and image block information that the memory of the acquisition card can store is performed based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; If image segmentation is not supported, the number of image segments is set to 1, and the acquisition card is controlled to store the image to be transmitted into the memory of the acquisition card; Before the step of writing the image blocks from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus based on the image block size and the number of image blocks, the method further includes: Determine whether the acquisition card supports image segmentation; If image segmentation is supported, the step of writing the image block from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks is executed; If image segmentation is not supported, the image to be transmitted is read from the memory of the acquisition card via the PCIe bus and written to the location corresponding to the preset cache of the processing device.

10. The method of claim 5, wherein, Before the step of calculating the image block size and number of image blocks corresponding to the image to be transmitted based on the image size, the row height, and the maximum row height, the method further includes: Determine whether the row height of the image to be transmitted is greater than the maximum row height; If the row height of the image to be transmitted is greater than the maximum row height, the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height is performed. If the row height of the image to be transmitted is not greater than the maximum row height, the number of image blocks is determined to be 1, and the image to be transmitted is stored in the memory of the acquisition card.

11. An image transmission apparatus characterized by comprising: A PCIe driver for a processing device connected to a capture card via a PCIe bus, the capture card being connected to an image acquisition device, the device comprising: The first calculation module is used to calculate the maximum row height and image block information that the memory of the acquisition card can store, based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card, when an image transmission instruction is received. The image block information includes the image block size and the number of image blocks, and the height of the image block is not greater than the maximum row height. The image block acquisition module is used to control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device, and obtain the image block corresponding to the image to be transmitted; An image block storage module is used to control the acquisition card to store the image blocks into the memory of the acquisition card; The image acquisition module is used to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device through the PCIe bus, based on the image block size and the number of image blocks, so as to obtain the transmitted image.

12. The apparatus of claim 11, wherein, The image acquisition module includes: The address acquisition submodule is used to acquire the address corresponding to the preset cache of the processing device; The image block writing submodule is used to write each image block into the memory of the acquisition card, based on the size of the image block, from the memory of the acquisition card to the address corresponding to the preset cache of the processing device via the PCIe bus, until the number of image blocks written reaches the specified number of image blocks. The image block writing submodule includes: An image block reading unit is used to read image blocks from the memory of the acquisition card after storing each image block in the memory of the acquisition card. The quantity acquisition unit is used to acquire the number of image blocks that have been written to the preset cache when an image ready interrupt signal is acquired, wherein the image ready interrupt signal indicates that an image block has been read. The write position determination unit is used to determine the write position of the current image block in the preset cache based on the address, the number of image blocks already written to the preset cache, and the size of the image block, wherein the current image block is the image block currently being read; An image block writing unit is used to write the current image block from the memory of the acquisition card to the location to be written via the PCIe bus; An image block quantity determination unit is used to determine whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks; The image block count reaches unit, which is used to return to the step of reading image blocks from the memory of the acquisition card when the number of image blocks currently written to the preset cache has not reached the number of image blocks, until the number of image blocks currently written to the preset cache reaches the number of image blocks; The unit for determining the writing location includes: The write-to-location determination subunit is configured to calculate the write-to-location pBuf' of the current image block in the preset cache according to the address, the number of image blocks already written to the preset cache, and the image block size, using the following formula: ; Where pBuf is the address, CurBlockNum is the number of image blocks that have been written to the preset cache, and BlockSize is the size of the image block; The device further includes: The image block numbering module is used to number the image block and record the sequence number of the image block after the step of controlling the acquisition card to acquire the image to be transmitted acquired by the image acquisition device and obtaining the image block corresponding to the image to be transmitted. The image patch quantity determination unit includes: The image block quantity determination subunit determines whether the number of image blocks currently written to the preset cache has reached the specified number of image blocks based on the current image block's sequence number. The image information includes at least the image size and row height of the image to be transmitted; the first calculation module includes: The first calculation submodule is used to calculate the maximum row height of the image that the acquisition card can store based on the image size of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card. The second calculation submodule is used to calculate the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height and the maximum row height; The second calculation submodule includes: The image block number calculation unit is used to calculate the number N of multiple image blocks corresponding to the image to be transmitted based on the row height of the image to be transmitted and the maximum row height, according to the following formula: N= ; Wherein, imageHeight is the row height of the image to be transmitted, and Height is the maximum row height; The image patch size calculation unit calculates the image patch size of multiple image patches corresponding to the image to be transmitted based on the image size of the image to be transmitted and the number of image patches; The image acquisition module includes: The image acquisition submodule is used to, based on the image block size and the number of image blocks, use DMA technology to write the image blocks from the memory of the acquisition card to the corresponding location of the preset cache of the processing device via the PCIe bus, so as to obtain the transmitted image; The device further includes: The first judgment module is used to determine whether the acquisition card supports image segmentation before the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions of the memory of the acquisition card. The first execution module is configured to, if image segmentation is supported, execute the step of calculating the maximum row height of the image that the memory of the acquisition card can store and the image block information based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; The first storage module is used to determine that the number of image blocks is 1 if image segmentation is not supported, and to control the acquisition card to store the image to be transmitted into the memory of the acquisition card. The device further includes: The second judgment module is used to determine whether the acquisition card supports image segmentation before the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device through the PCIe bus based on the image block size and the number of image blocks; The second execution module is configured to, if image segmentation is supported, execute the step of writing the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus based on the image block size and the number of image blocks; The image to be transmitted writing module is used to read the image to be transmitted from the memory of the acquisition card via the PCIe bus and write the image to be transmitted to the location corresponding to the preset cache of the processing device if image segmentation is not supported. The device further includes: The third judgment module is used to determine whether the row height of the image to be transmitted is greater than the maximum row height before the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height. The third execution module is used to execute the step of calculating the image block size and the number of image blocks corresponding to the image to be transmitted based on the image size of the image to be transmitted, the row height, and the maximum row height if the row height of the image to be transmitted is greater than the maximum row height; The second storage module is used to determine the number of image blocks as 1 if the row height of the image to be transmitted is not greater than the maximum row height, and to store the image to be transmitted in the memory of the acquisition card.

13. An image transmission system, characterized by, The system includes a processing device, a capture card, and an image acquisition device. The processing device includes a PCIe driver and is connected to the capture card via a PCIe bus. The capture card is connected to the image acquisition device, wherein: The PCIe driver of the processing device is used, upon receiving an image transmission command, to calculate the maximum row height and image block information that the memory of the acquisition card can store, based on the image information of the image to be transmitted, the memory size of the acquisition card, and the number of partitions in the memory of the acquisition card; to control the acquisition card to acquire the image to be transmitted acquired by the image acquisition device, thereby obtaining the image block corresponding to the image to be transmitted; to control the acquisition card to store the image block in the memory of the acquisition card; and, based on the image block size and the number of image blocks, to write the image block from the memory of the acquisition card to the location corresponding to the preset cache of the processing device via the PCIe bus, thereby obtaining the transmitted image, wherein the image block information includes the image block size, the number of image blocks, and the height of the image block is not greater than the maximum row height; The acquisition card is used, under the control of the PCIE driver, to acquire the image to be transmitted acquired by the image acquisition device, and to store the image blocks in the memory of the acquisition card.

14. A processing device, characterized by Includes PCIe drivers, of which: The PCIe driver is used to perform the method described in any one of claims 1-10.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-10.