Data processing method of industrial camera and industrial camera
By introducing a multi-DMA channel mechanism into industrial cameras, the problem of insufficient frame rate caused by the computational resource consumption of traditional processing units is solved, achieving efficient image data processing and reliable data transmission, thus improving the data processing efficiency of industrial cameras.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-12
- Publication Date
- 2026-04-10
AI Technical Summary
The data processing efficiency of industrial cameras is limited by the computing resources occupied by traditional processing units, resulting in a frame rate that is insufficient to meet the needs of assembly line production.
A multi-DMA channel mechanism is adopted, which involves configuring the first DMA channel to transmit sensor image data to the storage unit and configuring the second DMA channel to transmit image data from the storage unit to the external communication unit, thereby reducing the computational resource consumption of the processing unit and realizing parallel processing of image data.
It improves the data processing efficiency of industrial cameras, ensures the reliability of image acquisition and data processing in each round, and increases the frame rate to meet the needs of assembly line production.
Smart Images

Figure CN121842344A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision technology, and in particular to a data processing method for an industrial camera and an industrial camera. Background Technology
[0002] In industrial settings, industrial cameras must have a sufficient frame rate to capture production details effectively while the production line is running continuously. However, the actual frame rate of an industrial camera is limited by its data processing efficiency; therefore, the data processing efficiency of industrial cameras is crucial.
[0003] In traditional technology, image data acquired by the sensors of industrial cameras needs to be relayed through the processing unit of the industrial camera before it can be transmitted. However, this method consumes too much computing resources of the processing unit, limiting the data processing efficiency of industrial cameras. Summary of the Invention
[0004] Therefore, it is necessary to provide a data processing method for industrial cameras and an industrial camera that can guarantee data processing efficiency in response to the above-mentioned technical problems.
[0005] In a first aspect, this application provides a data processing method for an industrial camera, including: In the first round of data processing after the image acquisition function is enabled, the first DMA channel is configured and the sensor is started, and the next round of data processing is started after the first DMA channel completes the transfer; wherein, after configuration, the first DMA channel is used to transfer the image data acquired by the sensor in this round after it is started to the storage unit. In each round of data processing after the first round, the first DMA channel and the second DMA channel are configured, and the next round of data processing is entered after both the first DMA channel and the second DMA channel have completed their transmissions; wherein, after configuration, the second DMA channel is used to transmit the image data of the previous round in the storage unit to the external communication unit; In each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transfer, when an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed.
[0006] Secondly, this application also provides an industrial camera, which includes a sensor and a field-programmable gate array (FPGA); the FPGA includes a processing unit, a direct memory access unit, a storage unit, and an external communication unit; the direct memory access unit includes a first DMA channel, a second DMA channel, a third DMA channel, and a fourth DMA channel; The direct memory access unit is connected to the sensor, the storage unit, and the external communication unit, respectively; the processing unit is connected to the sensor, the direct memory access unit, the storage unit, and the external communication unit, respectively; and the industrial camera is used to implement the steps in the above method.
[0007] The aforementioned data processing method and industrial camera for industrial cameras, in the first round of data processing after the image acquisition function is enabled, the processing unit configures the first DMA channel and starts the sensor, and waits for the first DMA channel to complete the transmission before entering the next round of data processing; after configuration, the first DMA channel can transmit the image data acquired by the started sensor in this round to the storage unit, so that in the first round of data processing after the image acquisition function is enabled, the image data in this round does not need to be transferred through the processing unit. The processing unit only needs to configure the first DMA channel to accurately manage the buffer of the image data in this round, ensuring the reliability of the first round of data processing after the image acquisition function is enabled.
[0008] In each subsequent round of data processing after the first round, the processing unit configures a first DMA channel and a second DMA channel, and waits for both channels to complete their transfers before proceeding to the next round. The second DMA channel, once configured, transfers the previous round's image data from the storage unit to the external communication unit. This ensures that in each subsequent round of data processing, neither the current nor the previous round's image data needs to be relayed through the processing unit. The processing unit only needs to configure the first and second DMA channels to precisely manage the buffering of the current round's image data and the external output of the previous round's image data, guaranteeing the reliability of each subsequent round of data processing.
[0009] Since the current round of image data is transmitted via the first DMA channel and the previous round of image data is transmitted via the second DMA channel, neither of which occupies the processing unit's computing resources, the processing unit can complete the target operation corresponding to the external command when it detects an external command to be processed during each round of data processing after the image acquisition function is enabled, while waiting for the first or second DMA channel to complete the transmission. This achieves parallel processing of external commands during the caching of the current round of image data or the output of the previous round of image data, thereby improving the efficiency of each round of data processing while ensuring the reliability of each round of data processing, and thus improving the data processing efficiency of the industrial camera. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is an application environment diagram of a data processing method for an industrial camera provided in an embodiment of this application.
[0012] Figure 2 This is a flowchart illustrating a data processing method for an industrial camera provided in an embodiment of this application.
[0013] Figure 3 This is an application environment diagram for another data processing method for an industrial camera provided in an embodiment of this application.
[0014] Figure 4 This is a structural block diagram of an industrial camera provided in an embodiment of this application.
[0015] Figure 5 This is an internal structure diagram of a host computer provided in an embodiment of this application. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0017] The data processing method for industrial cameras provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the industrial camera 102 includes a sensor, a processing unit, a direct memory access unit, a storage unit, and an external communication unit. The direct memory access unit includes a first DMA channel and a second DMA channel. The industrial camera 102 can communicate with the host computer 104 through the external communication unit.
[0018] The processing unit can configure the first DMA channel and start the sensor in the first round of data processing after the image acquisition function is enabled, and then proceed to the next round of data processing after the first DMA channel has completed its transfer. The sensor, once started, can acquire image data for each round. After configuration, the first DMA channel can transfer the image data acquired by the started sensor in the current round to the storage unit.
[0019] The processing unit can configure a first DMA channel and a second DMA channel in each subsequent round of data processing. After both the first and second DMA channels have completed their transfers, the next round of data processing can begin. The second DMA channel, once configured, can transfer the previous round of image data from the storage unit to the external communication unit. The external communication unit can then output the previous round of image data to the host computer 104.
[0020] In each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transfer, the processing unit can complete the target operation corresponding to the external instruction when it detects the external instruction to be processed.
[0021] The host computer 104 may include at least one of a terminal or a server. The terminal may be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices may include smartwatches, smart bracelets, head-mounted devices, etc. The server may be a standalone server or a server cluster consisting of multiple servers.
[0022] In one exemplary embodiment, such as Figure 2 The diagram shows a flowchart of a data processing method for an industrial camera, which is applied to... Figure 1 The process of processing the industrial camera 102 is used as an example for illustration, including the following steps 202 to 206.
[0023] Step 202: In the first round of data processing after the image acquisition function is enabled, the first DMA channel is configured and the sensor is started, and the next round of data processing is started after the first DMA channel completes the transfer; wherein, after configuration, the first DMA channel is used to transfer the image data acquired by the started sensor in this round to the storage unit.
[0024] It's understandable that a DMA channel is a direct memory access channel. Direct Memory Access (DMA) enables data transfer between peripherals and memory. The first DMA channel is a direct memory access channel from a sensor to a storage unit, belonging to the category of DMA channels from peripherals to memory.
[0025] For example, the processing unit can detect the status of each preset flag bit in each round of data processing. If the status of each preset flag bit indicates that this round is the first round after the image acquisition function is enabled, the first DMA channel is configured and the sensor is started, and the next round of data processing is entered after the first DMA channel transfer is completed.
[0026] In some embodiments, in order to ensure that the image data acquired by the sensor is cached in a timely manner, the processing unit may configure the first DMA channel in the first round of data processing after the image acquisition function is enabled, and then start the sensor.
[0027] In some embodiments, the processing unit can obtain the first transmission parameters for the current round of data processing during the first round of data processing after the image acquisition function is enabled, write the first transmission parameters into the first register group corresponding to the first DMA channel to configure the first DMA channel and start the sensor. The first DMA channel transmits the image data acquired by the sensor in this round to the storage unit based on the parameters in the first register group.
[0028] In some embodiments, the first transmission parameter may include the address of a free buffer within the storage unit. The processing unit may write the address of the free buffer into the address register in the first register group. The first DMA channel may sequentially write the current round of image data acquired by the sensor into the storage unit starting from the address in the address register, thereby transferring the current round of image data from the sensor to the storage unit.
[0029] In some embodiments, the direct memory access unit may include register groups corresponding to each DMA channel. The processing unit can read and write the register groups corresponding to the DMA channel to trigger data transfer for that DMA channel. The register groups may include a trigger register for triggering the transfer, an address register for specifying an address, and a data volume register for specifying the amount of data to be transferred, etc.
[0030] It is understandable that for a DMA channel from a peripheral to memory, the address register needs to be filled with the destination address. This allows the DMA channel to write data from the peripheral sequentially into memory starting from the destination address when the trigger register indicates that a transfer should be started, until the amount of data written reaches the amount of data in the data register. For a DMA channel from memory to a peripheral, the address register needs to be filled with the source address. This allows the DMA channel to read data from memory sequentially from the source address and transfer it to the peripheral sequentially when the trigger register indicates that a transfer should be started, until the amount of data read reaches the amount of data in the data register.
[0031] Specifically, the processing unit can write the startup parameters to the trigger register in the first register group, write the address of the free buffer to the address register in the first register group, and write the number of bytes of image data per round to the data volume register in the first register group, thereby configuring the first DMA channel. The number of bytes of image data per round is fixed and can be, but is not limited to, the number of bytes of one frame of image data.
[0032] In some embodiments, the processing unit may send a trigger signal to the sensor to trigger the sensor to continuously acquire image data in each round, thereby activating the sensor.
[0033] In some embodiments, the processing unit may be configured with a signal generation module, which sends a trigger signal to the sensor to trigger the sensor to continuously acquire image data in each round, thereby activating the sensor.
[0034] In some embodiments, the processing unit may be, but is not limited to, a single-core processor. Specifically, the processing unit may be an embedded soft core.
[0035] Step 204: In each round of data processing after the first round, configure the first DMA channel and the second DMA channel, and wait for the first DMA channel and the second DMA channel to complete the transmission before entering the next round of data processing; wherein, after configuration, the second DMA channel is used to transmit the image data of the previous round in the storage unit to the external communication unit.
[0036] It is understandable that the second DMA channel is a direct memory access channel from the storage unit to the external communication unit, belonging to the DMA channel from memory to peripherals.
[0037] For example, the processing unit can detect the status of each preset flag bit in each round of data processing. If the status of each preset flag bit indicates that this round is the round after the first round, the first DMA channel and the second DMA channel are configured, and the next round of data processing is entered after both the first DMA channel and the second DMA channel have completed their transmissions.
[0038] In some embodiments, the processing unit may, in each subsequent round of data processing, acquire the first transmission parameters for that round and write them into the first register group corresponding to the first DMA channel to configure the first DMA channel. It may also acquire the second transmission parameters for that round and write them into the second register group corresponding to the second DMA channel to configure the second DMA channel. After both the first and second DMA channels have completed their transmissions, the unit proceeds to the next round of data processing.
[0039] In some embodiments, the second transmission parameter may include the address of the non-free buffer containing the previous round of image data within the storage unit. The processing unit may write the address of the non-free buffer into the address register in the second register group. The second DMA channel may sequentially read the previous round of image data from the storage unit starting from the address in the address register and transmit the previous round of image data to the external communication unit, thereby realizing the transmission of the previous round of image data from the storage unit to the external communication unit.
[0040] In some embodiments, the processing unit can write the startup parameters into the trigger register in the second register group, write the address of the non-free buffer into the address register in the second register group, and write the number of bytes of image data per round into the data volume register in the second register group to configure the second DMA channel.
[0041] In some embodiments, the external communication unit may be, but is not limited to, at least one of an Ethernet controller, a wireless network unit, or a serial communication unit.
[0042] In some embodiments, in order to ensure that the image data from the previous round is output in a timely manner, the processing unit may configure the second DMA channel first and then the first DMA channel in each round of data processing after the first round.
[0043] Step 206: In each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transfer, when an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed.
[0044] It is understandable that data processing in industrial cameras mainly consists of two levels: processing external commands and processing acquired image data. Once the image acquisition function is enabled, both external command processing and acquired image data processing are involved simultaneously. To avoid resource access conflicts and ensure data processing efficiency, external commands are processed intermittently while the processing unit waits for the first or second DMA channel transfer to complete after the image acquisition function is enabled.
[0045] For example, in the first round of data processing after the image acquisition function is enabled, the processing unit can configure the first DMA channel and start the sensor, then detect whether there is an external instruction to be processed. When the external instruction to be processed is detected, after completing the target operation corresponding to the external instruction, the processing unit can poll the first transmission status of the first DMA channel until the first transmission status indicates that the transmission is completed, and then proceed to the next round of data processing.
[0046] In each round of data processing after the first round, the processing unit can configure the first DMA channel and the second DMA channel, detect whether there is an external instruction to be processed, and when an external instruction to be processed is detected, after completing the target operation corresponding to the external instruction, poll the first transmission status of the first DMA channel and poll the second transmission status of the second DMA channel until both the first transmission status and the second transmission status indicate that the transmission is completed, and then enter the next round of data processing.
[0047] In the above-mentioned data processing method for industrial cameras, in the first round of data processing after the image acquisition function is enabled, the processing unit configures the first DMA channel and starts the sensor, and waits for the first DMA channel to complete the transmission before entering the next round of data processing. After configuration, the first DMA channel can transmit the image data acquired by the started sensor in this round to the storage unit. This realizes that in the first round of data processing after the image acquisition function is enabled, the image data in this round does not need to be transferred through the processing unit. The processing unit only needs to configure the first DMA channel to accurately manage the buffer of the image data in this round, ensuring the reliability of the first round of data processing after the image acquisition function is enabled.
[0048] In each subsequent round of data processing after the first round, the processing unit configures a first DMA channel and a second DMA channel, and waits for both channels to complete their transfers before proceeding to the next round. The second DMA channel, once configured, transfers the previous round's image data from the storage unit to the external communication unit. This ensures that in each subsequent round of data processing, neither the current nor the previous round's image data needs to be relayed through the processing unit. The processing unit only needs to configure the first and second DMA channels to precisely manage the buffering of the current round's image data and the external output of the previous round's image data, guaranteeing the reliability of each subsequent round of data processing.
[0049] Since the current round of image data is transmitted via the first DMA channel and the previous round of image data is transmitted via the second DMA channel, neither of which occupies the processing unit's computing resources, the processing unit can complete the target operation corresponding to the external command when it detects an external command to be processed during each round of data processing after the image acquisition function is enabled, while waiting for the first or second DMA channel to complete the transmission. This achieves parallel processing of external commands during the caching of the current round of image data or the output of the previous round of image data, thereby improving the efficiency of each round of data processing while ensuring the reliability of each round of data processing, and thus improving the data processing efficiency of the industrial camera.
[0050] In some embodiments, when an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed, including: when an unprocessed external instruction is detected in the external communication unit, configuring a third DMA channel; wherein, after configuration, the third DMA channel is used to transmit the external instruction to the processing unit; retrieving the external instruction from the storage unit and completing the target operation corresponding to the external instruction.
[0051] It is understandable that the third DMA channel is a direct memory access channel from the external communication unit to the processing unit, belonging to the DMA channel from peripherals to memory.
[0052] For example, the processing unit can detect whether the receive buffer of the external communication unit is empty. If it is not empty, it means that there are unprocessed external instructions. At this time, the third DMA channel is configured by reading and writing the third register group corresponding to the third DMA channel. After the third DMA channel transfer is completed, the external instructions are retrieved from the storage unit and the target operation corresponding to the external instructions is completed.
[0053] In some embodiments, the storage unit may include an instruction buffer. The processing unit may write startup parameters to the trigger register in the third register group, write the address of the instruction buffer to the address register in the third register group, and write the number of bytes of the external instruction to the data register in the third register group to configure the third DMA channel.
[0054] In some embodiments, the processing unit may retrieve external instructions from the instruction buffer.
[0055] In some embodiments, the external command may include at least one of an image acquisition command or an acquisition stop command. The target operation corresponding to the image acquisition command may include enabling the image acquisition function. The target operation corresponding to the acquisition stop command may include disabling the image acquisition function and disabling the sensor.
[0056] In some embodiments, enabling the image acquisition function can be achieved by setting the state of each preset flag bit to match the state of the first round after the image acquisition function is enabled. The processing unit can detect the state of each preset flag bit in each round of data processing. When the state of each preset flag bit indicates that this round is the first round after the image acquisition function is enabled, the first round of data processing after the image acquisition function is enabled is performed.
[0057] Disabling the image acquisition function can be achieved by setting the state of each preset flag bit to match the state of the round before the image acquisition function was enabled. When the state of each preset flag bit indicates that the current round is a round before the image acquisition function was enabled, the data processing of each round before the image acquisition function was enabled is performed.
[0058] In some embodiments, during the first round of data processing after the image acquisition function is enabled, if the target operation has not disabled the image acquisition function, the processing unit can set the state of each preset flag bit to match the state of the round following the first round after the image acquisition function is enabled, so that the next round is regarded as the round following the first round after the image acquisition function is enabled. It can be understood that the first round after the image function is enabled and the rounds following the first round are all considered rounds after the image acquisition function is enabled.
[0059] In each round of data processing after the image acquisition function is enabled, if the target operation disables the image acquisition function, the state of each preset flag bit will be set to the state that matches the round before the image acquisition function was enabled, so as to make the next channel the round before the image acquisition function was enabled.
[0060] In some embodiments, the third DMA channel can transmit an external instruction to the processing unit after configuration. It is understood that, to avoid excessively long instruction processing time in each round of data processing, which could affect the caching efficiency of each round of image data in the next round and the output efficiency of the previous round of image data, the processing unit can process only one external instruction in each round of data processing.
[0061] In this embodiment, when an unprocessed external instruction is detected in the external communication unit, a third DMA channel is configured. The third DMA channel is used to transmit the external instruction to the processing unit after configuration. The external instruction is retrieved from the storage unit, and the target operation corresponding to the external instruction is completed. The processing unit only needs to configure the third DMA channel to realize the automatic transmission of external instructions and respond after the external instruction is transmitted, which greatly saves the computing resources of the processing unit.
[0062] In some embodiments, completing the target operation corresponding to the external instruction includes: completing the target operation corresponding to the external instruction includes: executing the target operation corresponding to the external instruction; writing the response data generated for the external instruction to the storage unit; after the target operation is completed, configuring a fourth DMA channel; the fourth DMA channel is used to transmit the response data in the storage unit to the external communication unit after configuration.
[0063] It is understandable that the fourth DMA channel is the DMA channel from the storage unit to the external communication unit, which belongs to the DMA channel from memory to peripherals.
[0064] For example, the storage unit includes an acknowledgment buffer. The processing unit can execute the target operation corresponding to the external instruction, write the acknowledgment data corresponding to the external instruction into the acknowledgment buffer, and configure the fourth DMA channel by reading and writing the fourth register group after the target operation is completed.
[0065] In some embodiments, the processing unit can write the startup parameters into the trigger register of the fourth register group, write the address of the acknowledgment buffer into the address register of the fourth register group, and write the number of bytes of acknowledgment data into the data volume register of the fourth register group to configure the fourth DMA channel.
[0066] In this embodiment, the target operation corresponding to the external instruction is executed; the response data generated in response to the external instruction is written to the storage unit; after the target operation is completed, the fourth DMA channel is configured; the fourth DMA channel is used to transmit the response data in the storage unit to the external communication unit after configuration. The processing unit only needs to configure the fourth DMA channel to realize the automatic transmission of response data, which greatly saves the computing resources of the processing unit.
[0067] In some embodiments, during each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transmission, when an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed, including: during each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transmission, when an external instruction to be processed is detected, if the external instruction is an acquisition stop instruction, then the image acquisition function and the sensor are turned off.
[0068] For example, in each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel to complete the transfer, when an external command to be processed is detected, if the external command is an acquisition stop command, the sensor is turned off and the state of each preset flag bit is set to the state that matches the round before the image acquisition function is enabled, so that the next round of this round is taken as the round before the image acquisition function is enabled, thereby turning off the image acquisition function.
[0069] In this embodiment, during each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transmission, if an external command to be processed is detected, and if the external command is a stop acquisition command, then the image acquisition function and the sensor are turned off. This enables the processing of external commands to be interspersed while the processing unit is waiting for the first DMA channel or the second DMA channel to complete the transmission, and the image acquisition function and the sensor can be turned off in a timely manner, avoiding the waste of computing resources.
[0070] In some embodiments, the method further includes: in each round of data processing before the image acquisition function is activated, when an external instruction to be processed is detected, after completing the target operation corresponding to the external instruction, proceeding to the next round of data processing.
[0071] It can be understood that the data processing flow of an industrial camera can be divided into three rounds: data processing before the image acquisition function is activated, the first round of data processing after the image acquisition function is activated, and the subsequent rounds of data processing. The distinction between the first round after the image acquisition function is activated and the subsequent rounds is primarily due to the fact that the second DMA channel transmits the image data already cached in the storage unit. The first DMA channel needs to transmit one more round of image data than the second DMA channel. This requires the first DMA channel to independently complete the transmission of one round of image data in the first round. Therefore, the second DMA channel can transmit data simultaneously with the first DMA channel in each subsequent round. Furthermore, since the sensor can continuously acquire image data in each round, it only needs to be activated in the first round; there is no need to activate the sensor again in each subsequent round.
[0072] In some embodiments, the processing unit may detect the state of each preset flag bit in each round of data processing. If the state of each preset flag bit indicates that the current round is the round before the image acquisition function is activated, then each round of data processing before the image acquisition function is activated is performed.
[0073] In some embodiments, each preset flag bit includes a data acquisition start flag bit and an upload start flag bit. The processing unit can detect the data acquisition start flag bit and the upload start flag bit in each round of data processing.
[0074] When the acquisition start flag is valid, the processing unit can indicate that this is the first round of data processing after the image acquisition function is enabled, and execute the first round of data processing after the image acquisition function is enabled. In the first round of data processing after the image acquisition function is enabled, the acquisition start flag is set to invalid. If the target operation has not disabled the image acquisition function, the upload start flag is set to valid, and the next round of data processing begins after the first DMA channel transfer is completed.
[0075] When the upload start flag is valid, the processing unit indicates that this round is the first round after the image acquisition function is enabled, and executes data processing for each round after the first round. In each round of data processing after the first round, the upload start flag is set to invalid. If the target operation has not disabled the image acquisition function, the upload start flag is reset to valid, and the next round of data processing begins after the first DMA channel transfer is completed.
[0076] When both the acquisition start flag and the upload start flag are invalid, the processing unit can indicate that this round is the round before the image acquisition function is enabled, and perform data processing for each round before the image acquisition function is enabled.
[0077] In this embodiment, during each round of data processing before the image acquisition function is activated, when an external command to be processed is detected, the target operation corresponding to the external command is completed before proceeding to the next round of data processing. Before the image acquisition function is activated, the processing unit only needs to process the external command, which can ensure the data processing efficiency of the industrial camera.
[0078] In some embodiments, in each round of data processing before the image acquisition function is activated, when an external instruction to be processed is detected, after completing the target operation corresponding to the external instruction, the next round of data processing is entered, including: in each round of data processing before the image acquisition function is activated, when an external instruction to be processed is detected, if the external instruction is an image acquisition instruction, the image acquisition function is activated and the next round of data processing is entered.
[0079] For example, in each round of data processing before the image acquisition function is turned on, when an external command to be processed is detected, if the external command is an image acquisition command, the processing unit sets each preset flag bit to a state that matches the first round after the image acquisition function is turned on, so that after the image acquisition function is turned on, the next round of data processing can be entered.
[0080] In some embodiments, each preset flag bit includes a data acquisition start flag bit. A valid data acquisition start flag bit corresponds to the first round of data acquisition after the image acquisition function is enabled.
[0081] In this embodiment, during each round of data processing before the image acquisition function is activated, if an external command to be processed is detected and the external command is an image acquisition command, the image acquisition function is activated and the next round of data processing begins. This allows the first DMA channel to be configured and the sensor to be started in a timely manner in the next round of data processing, so as to realize the acquisition and caching of image data and ensure the data processing efficiency of the industrial camera.
[0082] In some embodiments, if the external instruction is an image acquisition instruction, after enabling the image acquisition function, the next round of data processing is entered, including: if the external instruction is an image acquisition instruction, after enabling the image acquisition function by setting the acquisition start flag to be valid, the next round of data processing is entered; the method further includes: in each round of data processing, when the acquisition start flag is valid, the first round of data processing after the image acquisition function is enabled is executed.
[0083] For example, the processing unit may execute a series of steps in the first round of data processing after the image acquisition function is enabled when the acquisition start flag is detected to be valid in each round of data processing.
[0084] It's understandable that setting more flags could further subdivide the initial data processing after image acquisition is enabled into steps corresponding to different preset flags, thus improving the flexibility of data processing. For example, preset flags could include a cache start flag, an acquisition start flag, a command response flag, and a cache flag. The states corresponding to the initial processing before image acquisition are enabled could include "Cache start flag is valid" and "Acquisition start flag is valid."
[0085] Specifically, if the external instruction is an image acquisition instruction, the processing unit can enable the image acquisition function by setting the cache start flag and the acquisition start flag to be valid, and then proceed to the next round of data processing. In each round of data processing, the processing unit can sequentially traverse the cache start flag, the acquisition start flag, the instruction response flag, and the cache flag.
[0086] When the cache start flag is valid during iteration, the first DMA channel is configured, and the flag in the cache is set to valid before iteration continues. When the acquisition start flag is reached, if an external command to be processed is detected, the command response flag is set to an active level. If the acquisition start flag is valid, the acquisition start flag is set to invalid and the sensor is started before iteration continues.
[0087] When the instruction acknowledge flag is valid during traversal, the instruction acknowledge flag is set to invalid, the third DMA channel is configured, and when the third DMA channel transfer is complete, the external instruction is retrieved from the instruction buffer. After completing the target operation corresponding to the external instruction and writing the corresponding acknowledge data into the acknowledge buffer, the fourth DMA channel is configured. After waiting for the fourth DMA channel transfer to complete, the traversal continues.
[0088] When the flag bit in the cache is valid, the flag bit in the cache is set to invalid. The first transmission status of the first DMA channel is polled until the first transmission status indicates that the transmission is complete. Then the polling stops and the next round of data processing begins.
[0089] In some embodiments, the processing unit can set the acquisition start flag to valid by setting the level of a preset flag bit to an active level. The active level can be either high or low.
[0090] In this embodiment, if the external command is an image acquisition command, the image acquisition function is enabled by setting the acquisition start flag to be valid, and then the next round of data processing is entered. In each round of data processing, when the acquisition start flag is valid, the first round of data processing after the image acquisition function is enabled is executed. The acquisition start flag can be used to manage the first round of data processing after the image acquisition function is enabled, thus ensuring the efficiency of industrial camera data processing.
[0091] In some embodiments, the method further includes: in the first round of data processing after the image acquisition function is enabled, setting the acquisition start flag to invalid; in each round of data processing after the image acquisition function is enabled, if the target operation has not disabled the image acquisition function, setting the upload start flag to valid; in each round of data processing, when the upload start flag is valid, performing each round of data processing after the first round.
[0092] For example, the processing unit may execute a series of steps in each round of data processing after the first round when the upload start flag is detected to be valid.
[0093] It's understandable, but it's also possible to improve the flexibility of data processing by setting more flags, further subdividing each subsequent round of data processing into steps corresponding to different preset flags. For example, the preset flags could include an upload start flag, a cache start flag, an acquisition start flag, a command response flag, a cache in progress flag, a cache complete flag, a data transmission flag, and an upload in progress flag. The state corresponding to the first round before the image acquisition function is activated could include a cache start flag being valid and an acquisition start flag being valid.
[0094] Specifically, in each round of data processing, the processing unit can sequentially traverse the upload start flag, cache start flag, acquisition start flag, instruction response flag, cache flag, data transmission flag, and upload flag.
[0095] When the upload start flag is valid during iteration, it is set to invalid, the second DMA channel is configured, and the upload in progress flag is set to valid before continuing iteration. When the cache start flag is valid during iteration, the first DMA channel is configured, and the cache in progress flag is set to valid before continuing iteration. When the acquisition start flag is reached, if an external command to be processed is detected, the command response flag is set to an active level. If the acquisition start flag is valid, it is set to invalid and the sensor is started before continuing iteration.
[0096] When the instruction acknowledge flag is valid during traversal, the instruction acknowledge flag is set to invalid, the third DMA channel is configured, and when the third DMA channel transfer is complete, the external instruction is retrieved from the instruction buffer. After completing the target operation corresponding to the external instruction and writing the corresponding acknowledge data into the acknowledge buffer, the fourth DMA channel is configured. After waiting for the fourth DMA channel transfer to complete, the traversal continues.
[0097] When the flag bit in the cache is valid during traversal, the flag bit in the cache is set to invalid. The first transmission status of the first DMA channel is polled until the first transmission status indicates that the transmission is complete. Then the polling stops, the cache completion flag bit is set to valid, and the traversal continues.
[0098] When the data transmission flag is valid during traversal, if the cache completion flag is valid, the valid level of the cache completion flag is cleared, and the upload start flag is set to valid before continuing traversal. If the cache completion flag is invalid, traversal continues directly.
[0099] When the upload flag is valid during the traversal, the valid level of the upload flag is cleared. The second transmission status of the second DMA channel is polled until the second transmission status indicates that the transmission is complete. Then, the polling stops and the next round of data processing begins.
[0100] In this embodiment, during the first round of data processing after the image acquisition function is enabled, the acquisition start flag is set to invalid. During each round of data processing after the image acquisition function is enabled, if the target operation has not disabled the image acquisition function, the upload start flag is set to valid. During each round of data processing, when the upload start flag is valid, each subsequent round of data processing is executed. By precisely controlling the validity of the acquisition start flag and the upload start flag, the data processing efficiency of the industrial camera can be guaranteed.
[0101] In some embodiments, the storage unit includes data buffers; each data buffer includes a free buffer and a non-free buffer where the previous round of image data is located; configuring a first DMA channel and a second DMA channel includes: configuring the first DMA channel based on the address of the free buffer; configuring the second DMA channel based on the address of the non-free buffer.
[0102] For example, the storage unit includes data buffers, instruction buffers, and response buffers.
[0103] The processing unit can write the startup parameters into the trigger register in the first register group, write the address of the free buffer into the address register in the first register group, and write the number of bytes of image data in each round into the data volume register in the first register group to configure the first DMA channel.
[0104] The processing unit can write the startup parameters into the trigger register in the second register group, write the address of the non-free buffer into the address register in the second register group, and write the number of bytes of image data in each round into the data volume register in the second register group to configure the second DMA channel.
[0105] The processing unit can write startup parameters to the trigger register in the third register group, write the address of the instruction buffer to the address register in the third register group, and write the number of bytes of external instructions to the data register in the third register group, thereby configuring the third DMA channel.
[0106] The processing unit can write the startup parameters to the trigger register of the fourth register group, write the address of the acknowledgment buffer to the address register of the fourth register group, and write the number of bytes of acknowledgment data to the data volume register of the fourth register group, thereby configuring the fourth DMA channel.
[0107] In some embodiments, each round of image data may be, but is not limited to, one frame of image data. Each data buffer may be used to cache one frame of image data.
[0108] In this embodiment, the storage unit includes data buffers; each data buffer includes a free buffer and a non-free buffer containing the image data from the previous round; a first DMA channel is configured based on the address of the free buffer; and a second DMA channel is configured based on the address of the non-free buffer. Each data buffer in the storage unit supports parallel data transmission between the first and second DMA channels, implementing a multi-buffering mechanism to ensure the data processing efficiency of the industrial camera.
[0109] In some embodiments, such as Figure 3 The diagram illustrates an application environment for another data processing method for industrial cameras. The processing unit interacts with other units by running software programs. The host computer runs an application program compatible with the industrial camera. The data transceiver unit is responsible for implementing data transmission and reception functions. Data transmission and reception includes the transmission of image data for each round, as well as the transmission of external commands and response data. These data transmission and reception require collaboration between the direct memory access unit and the external communication unit.
[0110] Each round of image data acquired by the sensor is transferred from the direct memory access unit to the storage unit. The image data cached in the storage unit is then transferred from the direct memory access unit to the external communication unit. Subsequently, the external communication unit can upload each round of image data to the host computer.
[0111] The host computer receives external commands issued by the application program through the external communication unit, which then transfers them to the storage unit via the direct memory access unit. The processing unit then processes the external commands using the application program and writes the corresponding response data to the storage unit. The response data in the storage unit is then transferred to the external communication unit by the direct memory access unit, and finally uploaded to the host computer by the external communication unit.
[0112] In some embodiments, a direct memory access unit may include at least one direct memory access controller. It is understood that each direct memory access controller may support at least one DMA channel.
[0113] In some embodiments, the state of each preset flag bit is used to indicate the data processing flow to be executed in each round of data processing. It can be understood that the data processing flow of an industrial camera can be divided into three types: each round of data processing before the image acquisition function is activated, the first round of data processing after the image acquisition function is activated, and each round of data processing after the first round. Accordingly, each preset flag bit can be adaptively set, as long as the state of each preset flag bit can distinguish the above three data processing flows.
[0114] Specifically, each preset flag may include at least one of the following: cache start flag, acquisition start flag, instruction response flag, cache in flag, cache complete flag, data transmission flag, upload in flag, or upload start flag.
[0115] The states that correspond to the first round after the image acquisition function is enabled are: cache start flag is valid, acquisition start flag is valid, and data transmission flag is valid.
[0116] The corresponding states for each subsequent round are: upload start flag valid, cache start flag valid, data collection start flag invalid, and data transmission flag valid.
[0117] The state that matches the first round after the image function is enabled is: all preset flags are invalid.
[0118] In each round of data processing, the processing unit can sequentially traverse the upload start flag, cache start flag, acquisition start flag, instruction response flag, cache flag, data transmission flag, and upload flag.
[0119] When the upload start flag is valid, clear the valid level of the upload start flag, obtain the address of the non-free buffer where the previous round of image data is located, write the start parameters to the trigger register in the second register group, write the address of the non-free buffer to the address register in the second register group, and write the number of bytes of image data in each round to the data volume register in the second register group to configure the second DMA channel. After setting the upload start flag to valid, continue traversing.
[0120] If the upload start flag is invalid during iteration, continue iterating.
[0121] When the cache start flag is valid during traversal, the address of the free buffer is obtained, the start parameters are written to the trigger register in the first register group, the address of the free buffer is written to the address register in the first register group, and the number of bytes of image data in each round is written to the data volume register in the first register group to configure the first DMA channel. After setting the flag in the cache to be valid, the traversal continues.
[0122] If the cache start flag encountered during iteration is invalid, continue iterating.
[0123] When the acquisition start flag is valid, clear its level and start the sensor. When an external command to be processed is detected, set the command response flag to a valid level and continue the iteration. When the acquisition start flag is invalid, simply set the command response flag to a valid level when an external command to be processed is detected and continue the iteration.
[0124] When the instruction acknowledge flag is valid during traversal, clear the valid level of the instruction acknowledge flag, configure the third DMA channel, and after completing the target operation corresponding to the external instruction and generating the corresponding acknowledge data when an external instruction is obtained, configure the fourth DMA channel, wait for the fourth DMA channel to complete the transfer, and continue traversal.
[0125] When the flag bit in the cache is valid during traversal, clear the valid level of the flag bit in the cache, poll the first transmission status of the first DMA channel until the first transmission status indicates that the transmission is complete, stop polling, set the cache completion flag bit to valid, and then continue traversal.
[0126] If the flag in the cache is invalid during iteration, continue iterating.
[0127] When the data transmission flag is valid during traversal, if the cache completion flag is valid, the valid level of the cache completion flag is cleared, and the upload start flag is set to valid before continuing traversal. If the cache completion flag is invalid, traversal continues directly.
[0128] Continue iterating if the data transmission flag bit encountered during iteration is invalid.
[0129] When the upload flag is valid during the traversal, the valid level of the upload flag is cleared. The second transmission status of the second DMA channel is polled until the second transmission status indicates that the transmission is complete. Then, the polling stops and the next round of data processing begins.
[0130] It is understood that in this embodiment, all data processing flows are divided into seven steps corresponding to seven flag bits that are traversed sequentially. The three data processing flows of the industrial camera are realized through the valid and invalid states of the seven flag bits. It should be noted that, based on this embodiment, more flag bits can be set to further refine the steps and improve the flexibility of data processing, or fewer flag bits can be set to aggregate different steps together without frequently traversing different flag bits, reducing the overhead of flag bit detection. That is, the specific settings of each preset flag bit are not limited to the flag bits provided in this embodiment.
[0131] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0132] Based on the same inventive concept, this application also provides an industrial camera for implementing the data processing method of the industrial camera described above. The solution provided by this industrial camera is similar to the implementation described in the above method; therefore, the specific limitations of one or more industrial camera embodiments provided below can be found in the limitations of the data processing method of the industrial camera described above, and will not be repeated here.
[0133] In one exemplary embodiment, such as Figure 4 As shown, an industrial camera 400 is provided, including: a sensor 402 and a field-programmable gate array (FPGA) unit 404. The FPGA unit includes a processing unit 406, a direct memory access unit (DMI) 408, a storage unit 410, and an external communication unit 412. The DMI 408 includes a first DMA channel, a second DMA channel, a third DMA channel, and a fourth DMA channel. The DMI 408 is connected to the sensor 402, the storage unit 410, and the external communication unit 412, respectively. The processing unit 406 is connected to the sensor 402, the DMI 408, the storage unit 410, and the external communication unit 412, respectively.
[0134] In some embodiments, the processing unit 406 is configured to configure the first DMA channel and start the sensor 402 in the first round of data processing after the image acquisition function is enabled, and to enter the next round of data processing after waiting for the first DMA channel to complete the transmission; in each round of data processing after the first round, the first DMA channel and the second DMA channel are configured, and to enter the next round of data processing after both the first DMA channel and the second DMA channel have completed the transmission; in each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transmission, when an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed.
[0135] The direct memory access unit 408 is used to transfer the current round of image data acquired by the sensor 402 after startup to the storage unit 410 through the first DMA channel after the first DMA channel is configured.
[0136] The direct memory access unit 408 is used to transfer the image data from the previous round to the external communication unit 412 through the second DMA channel after the second DMA channel is configured.
[0137] In some embodiments, sensor 402 is configured to continuously acquire image data for each round after startup.
[0138] In some embodiments, the processing unit 406 is further configured to configure a third DMA channel when an unprocessed external instruction is detected in the external communication unit 412; the direct memory access unit 408 is configured to transfer the external instruction to the storage unit 410 through the third DMA channel after the third DMA channel is configured; the processing unit 406 is further configured to obtain the external instruction from the storage unit 410 and complete the target operation corresponding to the external instruction.
[0139] In some embodiments, the processing unit 406 is further configured to execute the target operation corresponding to the external instruction; write the response data generated for the external instruction to the storage unit 410; configure the fourth DMA channel after the target operation is completed; and the direct memory access unit 408 is configured to transmit the response data in the storage unit 410 to the external communication unit 412 through the fourth DMA channel after the fourth DMA channel is configured.
[0140] In some embodiments, the processing unit 406 is further configured to, during each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transfer, when an external instruction to be processed is detected, if the external instruction is an acquisition stop instruction, then disable the image acquisition function and the sensor 402.
[0141] In some embodiments, the processing unit 406 is further configured to, in each round of data processing before the image acquisition function is activated, when an external instruction to be processed is detected, complete the target operation corresponding to the external instruction and then proceed to the next round of data processing.
[0142] In some embodiments, the processing unit 406 is further configured to, in each round of data processing before the image acquisition function is activated, if an external instruction to be processed is detected and the external instruction is an image acquisition instruction, then activate the image acquisition function and proceed to the next round of data processing.
[0143] In some embodiments, the processing unit 406 is further configured to, if the external instruction is an image acquisition instruction, enable the image acquisition function by setting the acquisition start flag to be valid, and then proceed to the next round of data processing; in each round of data processing, when the acquisition start flag is valid, the first round of data processing after the image acquisition function is enabled is executed.
[0144] In some embodiments, the processing unit 406 is further configured to set the acquisition start flag to invalid in the first round of data processing after the image acquisition function is enabled; and to set the upload start flag to valid in each round of data processing after the image acquisition function is enabled if the target operation has not closed the image acquisition function; and to execute each round of data processing after the first round when the upload start flag is valid in each round of data processing.
[0145] In some embodiments, the storage unit 410 includes data buffers; each data buffer includes a free buffer and a non-free buffer where the previous round of image data is located; the processing unit 406 is further configured to configure a first DMA channel based on the address of the free buffer; and configure a second DMA channel based on the address of the non-free buffer.
[0146] In some embodiments, storage unit 410 is used to cache image data, external instructions, and response data for each round.
[0147] Each unit in the aforementioned industrial camera can be implemented entirely or partially through software, hardware, or a combination thereof. These units can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each unit.
[0148] In one exemplary embodiment, a host computer is provided, the internal structure of which can be shown in the following diagram. Figure 5As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it sends external commands to the industrial camera to instruct the camera to implement a data processing method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0149] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0150] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0151] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0152] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0153] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0154] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0155] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data processing method for an industrial camera, characterized in that, Applied to the processing unit, including: In the first round of data processing after the image acquisition function is enabled, the first DMA channel is configured and the sensor is started, and the next round of data processing is started after the first DMA channel completes the transfer; wherein, after configuration, the first DMA channel is used to transfer the image data acquired by the started sensor in this round to the storage unit. In each round of data processing after the first round, the first DMA channel and the second DMA channel are configured, and the next round of data processing is entered after both the first DMA channel and the second DMA channel have completed their transmissions; wherein, after configuration, the second DMA channel is used to transmit the image data of the previous round in the storage unit to the external communication unit; In each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transfer, when an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed.
2. The method according to claim 1, characterized in that, When an external instruction to be processed is detected, the target operation corresponding to the external instruction is completed, including: When an unprocessed external instruction is detected in the external communication unit, a third DMA channel is configured; wherein, the third DMA channel is used to transmit the external instruction to the storage unit after configuration; The external instruction is retrieved from the storage unit, and the target operation corresponding to the external instruction is completed.
3. The method according to claim 2, characterized in that, The completion of the target operation corresponding to the external instruction includes: Execute the target operation corresponding to the external instruction; The response data generated in response to the external command is written to the storage unit; After the target operation is completed, a fourth DMA channel is configured; the fourth DMA channel is used to transmit the response data in the storage unit to the external communication unit after configuration.
4. The method according to claim 1, characterized in that, In each round of data processing after the image acquisition function is activated, while waiting for the first DMA channel or the second DMA channel to complete the transfer, when an external command to be processed is detected, the target operation corresponding to the external command is completed, including: In each round of data processing after the image acquisition function is enabled, while waiting for the first DMA channel or the second DMA channel to complete the transfer, if an external command to be processed is detected, and if the external command is an acquisition stop command, then the image acquisition function and the sensor are turned off.
5. The method according to claim 1, characterized in that, The method further includes: In each round of data processing before the image acquisition function is activated, when the external instruction to be processed is detected, the target operation corresponding to the external instruction is completed before proceeding to the next round of data processing.
6. The method according to claim 5, characterized in that, In each round of data processing before the image acquisition function is activated, when the external command to be processed is detected, after completing the target operation corresponding to the external command, the next round of data processing begins, including: In each round of data processing before the image acquisition function is activated, if the external command to be processed is detected and the external command is an image acquisition command, then the image acquisition function is activated and the next round of data processing begins.
7. The method according to claim 6, characterized in that, If the external command is an image acquisition command, then after activating the image acquisition function, the next round of data processing begins, including: If the external command is an image acquisition command, then after setting the acquisition start flag to be valid to enable the image acquisition function, the next round of data processing will begin. The method further includes: In each round of data processing, when the acquisition start flag is valid, the first round of data processing after the image acquisition function is enabled is executed.
8. The method according to claim 7, characterized in that, The method further includes: In the first round of data processing after the image acquisition function is enabled, the acquisition start flag is set to invalid. In each round of data processing after the image acquisition function is enabled, if the target operation does not disable the image acquisition function, the upload start flag is set to be valid. In each round of data processing, when the upload start flag is valid, each subsequent round of data processing is executed.
9. The method according to any one of claims 1 to 8, characterized in that, The storage unit includes data buffers; each data buffer includes a free buffer and a non-free buffer containing the previous round of image data; configuring the first DMA channel and the second DMA channel includes: Configure the first DMA channel based on the address of the free buffer; Configure the second DMA channel based on the address of the non-free buffer.
10. An industrial camera, characterized in that, The industrial camera includes a sensor and a field-programmable gate array (FPGA); the FPGA includes a processing unit, a direct memory access unit (DMI), a storage unit, and an external communication unit; the DMI includes a first DMA channel, a second DMA channel, a third DMA channel, and a fourth DMA channel. The direct memory access unit is connected to the sensor, the storage unit, and the external communication unit, respectively; the processing unit is connected to the sensor, the direct memory access unit, the storage unit, and the external communication unit, respectively; the industrial camera is used to implement the steps of the method according to any one of claims 1 to 9.