Image processing method and apparatus, embedded device, and computer-readable storage medium
By using the reconfigurable computing unit in the embedded device to calculate the background image and the Nth frame image, the problem of real-time motion detection on the embedded device in traditional technology is solved, and efficient moving object detection is achieved.
Patent Information
- Application Number
- PCT/CN2023/135245
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-13
- Filing Date
- 2023-11-29
- Publication Date
- 2024-09-19
AI Technical Summary
It is difficult for traditional video surveillance control systems to achieve real-time motion detection on embedded devices, and the CPU occupancy rate is high, resulting in a long time consumption.
By using the reconfigurable computing unit in the embedded device to calculate the background image and the Nth frame image, update the background image, and use the efficient computing power of the reconfigurable computing unit to reduce the processor workload and achieve real-time moving object detection.
It effectively reduces the processor occupancy rate and motion detection time-consuming in embedded devices, ensuring real-time moving object detection on embedded devices.
Smart Images

Figure CN2023135245_19092024_PF_FP_ABST
Abstract
Description
Image processing method and device, embedded device and computer-readable storage medium Technical Field
[0001] The present application relates to the field of face recognition technology, and more specifically, to an image processing method, an image processing apparatus, an embedded device, and a non-volatile computer-readable storage medium. Background Art
[0002] Traditional video surveillance control systems simply display the signals from each camera on a monitor in the main control room. Determining the dynamics of the scene requires visual observation by the operator, a time-consuming and labor-intensive process. Therefore, the introduction of motion detection technology is essential. However, due to the generally high resolution of current surveillance videos, real-time detection is difficult to achieve when used in embedded devices, and the central processing unit (CPU) utilization rate is relatively high.
[0003] Summary of the Invention
[0004] Embodiments of the present application provide an image processing method, an image processing apparatus, an embedded device, and a non-volatile computer-readable storage medium.
[0005] The image processing method of the embodiment of the present application includes acquiring multiple frames of images and using the first frame of the image as a background image; and inputting the background image and the Nth frame of the image into a reconfigurable computing unit of an embedded device to calculate a result image, and updating the background image based on the Nth frame of the image and the background image. The result image is used for motion detection of moving objects, where N is a positive integer greater than 1.
[0006] The image processing device according to an embodiment of the present application includes a first acquisition module and a calculation module. The first acquisition module is configured to acquire multiple frames of images and use the first frame as a background image. The calculation module is configured to input the background image and the Nth frame of image into a reconfigurable computing unit of an embedded device to calculate a result image and update the background image based on the Nth frame of image and the background image. The result image is used for motion detection of moving objects, where N is a positive integer greater than 1.
[0007] The embedded device according to an embodiment of the present application includes a processor and a reconfigurable computing unit. The processor is configured to acquire multiple frames of images and use the first frame as a background image; and input the background image and the Nth frame of image into the reconfigurable computing unit. The reconfigurable computing unit is configured to calculate a result image based on the background image and the Nth frame of image, and to update the background image based on the Nth frame of image and the background image. The result image is used for motion detection of moving objects, where N is a positive integer greater than 1.
[0008] The non-volatile computer-readable storage medium of an embodiment of the present application contains a computer program. When the computer program is executed by one or more processors, the processor performs the following image processing method: acquiring multiple frames of images and using the first frame of the image as a background image; and inputting the background image and the Nth frame image into a reconfigurable computing unit of an embedded device to calculate a result image, and updating the background image based on the Nth frame image and the background image. The result image is used for motion detection of moving objects, where N is a positive integer greater than 1.
[0009] In the image processing method, image processing apparatus, embedded device, and non-volatile computer-readable storage medium of the embodiments of the present application, a reconfigurable computing unit calculates an input background image and an Nth frame image to obtain a result image and update the background image. The reconfigurable computing unit has high processing efficiency and fast calculation speed, which can reduce the workload (i.e., occupancy) of the processor in the embedded device and shorten the motion detection time, thereby ensuring that motion detection can be performed in real time on the embedded device.
[0010] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0012] FIG1 is a schematic flow chart of an image processing method according to certain embodiments of the present application;
[0013] FIG2 is a schematic diagram of an image processing device according to certain embodiments of the present application;
[0014] FIG3 is a schematic plan view of an embedded device according to certain embodiments of the present application;
[0015] FIG4 is a schematic diagram of a scene of an image processing method according to certain embodiments of the present application;
[0016] FIG5 is a schematic flow chart of an image processing method according to certain embodiments of the present application;
[0017] FIG6 is a schematic diagram of a scene of an image processing method according to certain embodiments of the present application;
[0018] FIG7 is a schematic flow chart of an image processing method according to certain embodiments of the present application;
[0019] FIG8 is a schematic diagram of a scene of an image processing method according to certain embodiments of the present application;
[0020] FIG9 is a flow chart of an image processing method according to certain embodiments of the present application;
[0021] FIG10 is a schematic flow chart of an image processing method according to certain embodiments of the present application;
[0022] FIG11 is a schematic diagram illustrating a connection state between a non-volatile computer-readable storage medium and a processor according to certain embodiments of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and should not be understood as limiting the embodiments of the present application.
[0024] Referring to Figures 1 to 3, an embodiment of the present application provides an image processing method. The image processing method includes the following steps:
[0025] 01: Get multiple frames of images and use the first frame as the background image;
[0026] 03: Input the background image and the Nth frame image to the reconfigurable computing unit 30 of the embedded device 100 to calculate the result image, and update the background image according to the Nth frame image and the background image. The result image is used for motion detection of moving objects, and N is a positive integer greater than 1.
[0027] Please refer to Figures 2 and 3. An embodiment of the present application provides an image processing device 10. The image processing device 10 includes a first acquisition module 11 and a calculation module 12. The image processing method of the embodiment of the present application can be applied to the image processing device 10. The first acquisition module 11 and the calculation module 12 are used to execute step 01 and step 03, respectively. That is, the first acquisition module 11 is used to acquire multiple frames of images and use the first frame image as the background image. The calculation module 12 is used to input the background image and the Nth frame image to the reconfigurable computing unit 30 of the embedded device 100 to calculate the result image, and to update the background image based on the Nth frame image and the background image. The result image is used for motion detection of moving objects, where N is a positive integer greater than 1.
[0028] Please refer to Figure 3. The embodiment of the present application also provides an embedded device 100. The image processing method of the embodiment of the present application can be applied to the embedded device 100. The embedded device 100 includes a processor 20 and a reconfigurable computing unit 30. The processor 20 is used to execute step 01 and part of step 03. The reconfigurable computing unit 30 is used to execute step 03. That is, the processor 20 is used to acquire multiple frames of images and use the first frame image as the background image; and input the background image and the Nth frame image to the reconfigurable computing unit 30 of the embedded device 100. The reconfigurable computing unit 30 is used to calculate a result image based on the background image and the Nth frame image, and to update the background image based on the Nth frame image and the background image. The result image is used for motion detection of moving objects, and N is a positive integer greater than 1.
[0029] The embedded device 100 further includes a housing 40 and a camera 50. The housing 40 can be used to mount functional modules of the embedded device 100, such as a display device, an imaging device, a power supply device, and a communication device, so that the housing 40 provides protection for the functional modules, such as dustproof, drop-proof, and waterproof. The camera 50 is used to capture images. The embedded device 100 can be a mobile phone, a digital camera, a smart watch, a head-mounted display device, a game console, a robot, and the like. As shown in FIG3 , the embodiment of the present application is described using the embedded device 100 as an example of a mobile phone. It is understood that the specific form of the embedded device 100 is not limited to a mobile phone.
[0030] Specifically, the camera 50 embedded in the device can capture images or videos, and the processor 20 can obtain multiple frames of images captured by the camera 50 and use the first frame as the background image. For example, if the camera 50 captures 10 frames of images, the first frame is the background image.
[0031] Next, the processor 20 inputs the background image and the Nth frame image into the reconfigurable computing unit (RCU) 30 of the embedded device 100, where the RCU 30 calculates the resulting image and updates the background image. N is a positive integer greater than 1, meaning that the Nth frame image is at least the second frame image.
[0032] The reconfigurable computing unit 30 is an RCU (Reconfigurable Computing Unit) device. Specifically, the reconfigurable computing unit 30, or RCU, is a computing unit in the embedded device 100 other than the processor 20 (Central Processing Unit, CPU). The RCU combines the advantages of the processor 20 and the application-specific integrated circuit (ASIC), providing efficient and flexible computing capabilities.
[0033] It can be understood that the reconfigurable computing unit 30 (RCU) can specifically realize the functions of calculating the result image of the image and updating the background image compared to the processor 20 (CPU) of the embedded device 100, and the calculation speed of this function is faster and the processing efficiency is higher than that of the CPU.
[0034] In an embodiment of the present application, the reconfigurable computing unit 30 may be one or more processors, controllers or chips having a communication interface capable of implementing a communication protocol, and may also include a memory and related interfaces, a system transmission bus, etc. if necessary; the processor, controller or chip executes program-related codes to implement corresponding functions.
[0035] In this way, in the embedded device 100, the reconfigurable computing unit 30 is used to calculate the result image of the background image and the Nth frame image, and when the background image is updated according to the Nth frame image and the background image, the processing speed is faster to ensure that the motion detection function can run in real time in the embedded device 100.
[0036] More specifically, when the reconfigurable computing unit 30 calculates the result image of the background image and the Nth frame image, the pixel value of each pixel in the result image can be obtained by calculating the difference between the pixel values of all pixels in the background image and the pixels in the Nth frame image corresponding to the background image position and taking the absolute value.
[0037] It can be understood that the greater the difference in pixel value between the pixels in the Nth frame image and the background image, the greater the pixel value of the pixel in the result image. The greater the difference, the greater the change in the Nth frame image compared to the background image, that is, the greater the probability of detecting an image change, that is, the occurrence of object motion. In this way, after the reconfigurable computing unit 30 calculates the result image, the embedded device 100 can perform motion detection on the moving object based on the pixel values of the result image, thereby achieving real-time motion detection on the embedded device 100.
[0038] In addition, the reconfigurable calculation unit 30 can also update the background image according to the Nth frame image and the background image. The reconfigurable calculation unit 30 can update the background image in a weighted manner.
[0039] For example, when the reconfigurable computing unit 30 updates the background image based on the second frame image and the background image, the pixel value of each pixel in the updated background image = α*pixel value of the corresponding pixel in the background image + (1-α)*pixel value of the corresponding pixel in the second frame image.
[0040] Furthermore, referring to Figure 4 , the background image is P1, the second frame image is P2, and the updated background image is P3. Pixel X1 in background image P1 corresponds to pixel X2 in second frame image P2 and pixel X3 in updated background image P3. It can be understood that the pixel value of pixel X3 = α*pixel value of X1 + (1-α)*pixel value of X2.
[0041] The weight α is a pre-set empirical value. Generally, α is close to 1, such as 0.8, 0.9, etc., which means that the pixels in the background image have a larger weight to ensure that the movement of the moving object in the Nth frame will not affect the update of the background image.
[0042] It should be noted that the background image is continuously updated. For example, when the processor 20 inputs the background image and the second frame image, the reconfigurable computing unit 30 updates the background image based on the background image and the second frame image. Then, the next time the processor 20 inputs the background image and the third frame image, the input background image will be the background image updated based on the background image and the second frame image. Similarly, when the processor 20 continues to input the background image and the fourth frame image, the input background image will be the background image updated based on the background image (the background image updated based on the background image and the second frame image) and the third frame image.
[0043] Similarly, when the reconfigurable computing unit 30 calculates the result image, the background image used is the background image updated last time. If it is the first time to calculate the result image, the background image is the first frame image.
[0044] In the image processing method, image processing apparatus 10, and embedded device 100 of the embodiments of the present application, a reconfigurable computing unit 30 calculates the input background image and the Nth frame image to obtain a result image and update the background image. Due to the high processing efficiency and fast computing speed of the reconfigurable computing unit 30, the workload (i.e., occupancy) of the processor 20 in the embedded device 100 can be reduced, and the time consumption of motion detection can be reduced, thereby ensuring that motion detection can be performed in real time on the embedded device 100.
[0045] Referring to FIG. 2 , FIG. 3 and FIG. 5 , in some embodiments, part of step 03 : inputting the background image and the Nth frame image to the reconfigurable computing unit 30 of the embedded device 100 to calculate the result image includes the following steps:
[0046] 031: According to the memory capacity of the reconfigurable computing unit 30, the background image is divided into at least one first image block, and the Nth frame image is divided into at least one second image block, with the first image blocks and the second image blocks corresponding to each other in a one-to-one manner;
[0047] 033: inputting the corresponding first image block and the second image block into the reconfigurable computing unit 30 in sequence to generate at least one third image block according to the pixel value difference between the corresponding pixels in the corresponding first image block and the second image block; and
[0048] 035: Generate a result image according to the third image block.
[0049] In some embodiments, the computing module 12 is configured to perform step 031, step 033, and step 035. That is, the computing module 12 is configured to divide the background image into at least one first image block and the Nth frame image into at least one second image block according to the memory capacity of the reconfigurable computing unit 30, with the first image block and the second image block corresponding to each other; sequentially input the corresponding first image block and the second image block into the reconfigurable computing unit 30 to generate at least one third image block according to the pixel value difference between the corresponding pixels in the corresponding first image block and the second image block; and generate a result image according to the third image block.
[0050] In certain embodiments, the processor 20 is configured to execute step 031 and a portion of step 033, and the reconfigurable computing unit 30 is configured to execute a portion of step 033 and step 035. Specifically, the processor 20 is configured to divide the background image into at least one first image block and the Nth frame image into at least one second image block, based on the memory capacity of the reconfigurable computing unit 30, with the first image block and the second image block corresponding to each other; and sequentially input the corresponding first image block and the second image block into the reconfigurable computing unit 30. The reconfigurable computing unit 30 is configured to generate at least one third image block based on the pixel value difference between corresponding pixels in the corresponding first image block and the second image block; and generate a result image based on the third image block.
[0051] Specifically, the processor 20 may further divide the background image into at least one first image block according to the memory capacity of the reconfigurable computing unit 30, such as dividing the background image into 1, 2, 3 or more first image blocks.
[0052] More specifically, since the memory capacity of the reconfigurable computing unit 30 is relatively small, in the process of calculating the result image, the background image needs to be divided into at least one first image block according to the memory capacity of the reconfigurable computing unit 30 .
[0053] For example, the reconfigurable computing unit 30 can only compute an image with a resolution of 100*100 during one computing process, and the processor 20 divides the background image into at least one first image block with a size of 100*100.
[0054] For another example, the reconfigurable computing unit 30 may include multiple memory modules with sizes of 100*100, 80*80, and 50*50, respectively. The processor 20 then separates the first image blocks into multiple blocks of sizes of 100*100, 80*80, and 50*50, respectively, in order of memory size. The multiple first image blocks of sizes of 100*100, 80*80, and 50*50, respectively, may be referred to as a group. The reconfigurable computing unit 30 may divide the background image into multiple groups, each group containing multiple first image blocks of sizes of 100*100, 80*80, and 50*50. It will be appreciated that the sizes of the multiple first image blocks may be the same or different.
[0055] Similarly, the processor 20 may divide the Nth frame image into at least one second image block. For ease of calculation, the sizes of the second image block and the first image block correspond one to one.
[0056] Next, the processor 20 may sequentially input the corresponding first image block and the second image block into the reconfigurable computing unit 30 for computing. The corresponding first image block and the corresponding second image block refer to the position of the first image block in the background image being the same as the position of the second image block in the Nth frame image.
[0057] Specifically, the reconfigurable calculation unit 30 may generate a third image block based on the pixel difference between corresponding pixels in the first image block and the second image block. The pixel value of each pixel in the third image block may be the absolute value of the pixel difference between corresponding pixels in the first image block and the second image block, to ensure that the pixel value of each pixel in the third image block is normal.
[0058] As shown in Figure 6, the first image block is Q1, the second image block is Q2, and the third image block is Q3. Pixel Y1 in the first image block Q1 corresponds to pixel Y2 in the second image block Q2. Therefore, the pixel value of pixel Y3 in the third image block Q3 can be obtained by the absolute value of the difference between pixel Y1 and pixel Y2.
[0059] In this way, according to the number of the first image blocks and the second image blocks, the reconstructible calculation unit 30 can generate a corresponding number of third image blocks, thereby generating a result image according to the third image blocks.
[0060] More specifically, after the reconfigurable computing unit 30 generates at least one third image block, it may copy the at least one third image block to the memory of the processor 20 of the embedded device 100, thereby using the at least one third image block as a result image. When the reconfigurable computing unit 30 generates multiple third image blocks, it may also copy the multiple third image blocks to the memory of the processor 20 of the embedded device 100, thereby splicing the multiple third image blocks into a result image. The order in which the multiple third image blocks are spliced may be determined based on the position of the first image block that generated the corresponding third image block within the background image.
[0061] Referring to FIG. 2 , FIG. 3 and FIG. 7 , in some embodiments, part of step 03: updating the background image according to the Nth frame image and the background image, includes the steps of:
[0062] 037: Input the corresponding first image block and the second image block into the reconfigurable computing unit 30 in sequence to generate at least one fourth image block based on the sum of the weighted values of the pixel values of the corresponding pixels in the corresponding first image block and the second image block; and 039: Update the corresponding first image block in the background image according to the fourth image block.
[0063] In some embodiments, the calculation module 12 is configured to perform steps 037 and 039. The calculation module 12 is configured to sequentially input the corresponding first image block and the second image block into the reconfigurable calculation unit 30 to generate at least one fourth image block based on the sum of weighted values of pixel values of corresponding pixels in the corresponding first image block and the second image block; and update the corresponding first image block in the background image based on the fourth image block.
[0064] In some embodiments, the processor 20 is configured to perform part of step 037, and the reconfigurable computing unit 30 is configured to perform part of step 037 and step 039. That is, the processor 20 is configured to sequentially input the corresponding first image block and the second image block into the reconfigurable computing unit 30. The reconfigurable computing unit 30 is configured to generate at least one fourth image block based on the sum of the weighted values of the pixel values of the corresponding pixels in the corresponding first image block and the second image block; and update the corresponding first image block in the background image based on the fourth image block.
[0065] Specifically, after the processor 20 generates at least one first image block of the background image and at least one second image block of the N-th frame image, the processor 20 may sequentially input the corresponding first image block and second image block to the reconfigurable computing unit 30. Sequential input may mean that the processor 20 inputs the first image block and the second image block into the reconfigurable computing unit 30 from left to right and then from top to bottom based on the position of the first image block in the background image and the position of the second image block in the N-th frame image. Sequential input may also mean that the processor 20 inputs the first image block and the second image block into the reconfigurable computing unit 30 from top to bottom and then from left to right based on the position of the first image block in the background image and the position of the second image block in the N-th frame image.
[0066] After the corresponding first image block and the corresponding second image block are input to the reconfigurable calculation unit 30 , the reconfigurable calculation unit 30 may further update the background image according to the corresponding first image block and the corresponding second image block.
[0067] More specifically, the reconfigurable calculation unit 30 may generate a fourth image block based on the weighted sum of the pixel values of corresponding pixels in the corresponding first image block and the second image block. It will be understood that the pixel value of each pixel in the fourth image block is the sum of the product of the pixel value of the pixel in the first image block and the corresponding weight, and the product of the pixel value of the pixel in the second image block and the corresponding weight.
[0068] As shown in Figure 8, the first image block is M1, the second image block is M2, and the fourth image block is M3. Pixel Z1 in the first image block M1 corresponds to pixel Z2 in the second image block M2. Therefore, the pixel value of pixel Z3 in the fourth image block M3 that corresponds to pixel Z1 is equal to the sum of the weighted values of pixels Z1 and Z2. For example, Z3 = α*Z1 + (1-α)*Z2. The weight α is a pre-set empirical value.
[0069] Finally, after the reconfigurable computing unit 30 generates at least one fourth image block, it can be understood that each fourth image block corresponds to a first image block. The reconfigurable computing unit 30 can then use the fourth image block to update the corresponding first image block in the background image. Simply put, the reconfigurable computing unit 30 replaces the pixel values of all pixels in each first image block in the background image with the pixel values of all pixels in the corresponding fourth image block to complete the background image update.
[0070] In some embodiments, after the reconfigurable computing unit 30 calculates and obtains at least one fourth image block, the reconfigurable computing unit 30 may also copy the fourth image block to the memory of the processor 20 of the embedded device 100, and use the fourth image block to replace the corresponding first image block in the background image to obtain an updated background image.
[0071] Referring to FIG. 2 , FIG. 3 , and FIG. 9 , in some embodiments, part of step 037 of generating at least one fourth image block according to the sum of weighted values of pixel values of corresponding pixels in the corresponding first image block and the second image block further includes the steps of:
[0072] 0371: Generate a pixel value of a third pixel according to a sum of a first product of a preset first weight and a pixel value of a first pixel in a first image block, and a second product of a preset second weight and a pixel value of a second pixel corresponding to the first pixel in a second image block corresponding to the first image block; and
[0073] 0373: Generate a fourth image block according to the pixel value of the third pixel.
[0074] In some embodiments, the calculation module 12 is configured to perform steps 0371 and 0373. The calculation module 12 is configured to generate a pixel value of a third pixel based on a sum of a first product of a preset first weight and a pixel value of a first pixel in the first image block, and a second product of a preset second weight and a pixel value of a second pixel corresponding to the first pixel in a second image block corresponding to the first image block; and generate a fourth image block based on the pixel value of the third pixel.
[0075] In some embodiments, the reconfigurable computing unit 30 is configured to perform steps 0371 and 0373. That is, the reconfigurable computing unit 30 generates a pixel value of a third pixel based on a sum of a first product of a preset first weight and a pixel value of a first pixel in a first image block, and a second product of a preset second weight and a pixel value of a second pixel corresponding to the first pixel in a second image block corresponding to the first image block; and generates a fourth image block based on the pixel value of the third pixel.
[0076] Specifically, in the process of the reconfigurable computing unit 30 generating the fourth image block, the reconfigurable computing unit 30 can calculate the pixel value of the third pixel based on the first product of the preset first weight and the pixel value of the first pixel in the first image block, and the second product of the preset second weight and the pixel value of the second pixel corresponding to the first pixel in the second image block corresponding to the first image block.
[0077] The first weight and the second weight are empirically set, and the sum of the first weight and the second weight is 1. For example, if the first weight is 0.8, the second weight is 0.2. For another example, if the first weight is 0.9, the second weight is 0.1. The number of third pixels is the same as the number of first pixels in the first image block and the number of second pixels in the second image block.
[0078] It can be understood that, assuming the first weight is α and the second weight is β, then β = 1-α. The pixel value of the first pixel is A1, the pixel value of the second pixel is A2, and the pixel value of the third pixel is A3 = α*A1+β*A2 = α*A1+(1-α)*A2.
[0079] In this way, the reconfigurable calculation unit 30 calculates the pixel values of the plurality of third pixels corresponding one-to-one to the plurality of first pixels, thereby generating a fourth image block based on the pixel values of the plurality of third pixels. The position of the third pixel in the fourth image block can be determined based on the position of the first pixel corresponding to the third pixel in the first image block.
[0080] Please refer to FIG. 2 , FIG. 3 and FIG. 10 . The image processing method according to the embodiment of the present application further includes the following steps:
[0081] 05: Obtain a third image block whose sum of pixel values is greater than a preset threshold as a motion image block; and
[0082] 07: Adjust the first weight and the second weight according to the number of motion image blocks. The number of motion image blocks is inversely proportional to the first weight, and the number of motion image blocks is directly proportional to the second weight.
[0083] In certain embodiments, the image processing device 10 further includes a second acquisition module 13 and an adjustment module 14. The second acquisition module 13 is configured to execute step 05, and the adjustment module 14 is configured to execute step 07. Specifically, the second acquisition module 13 is configured to acquire a third image block whose sum of pixel values is greater than a preset threshold value as a motion image block. The adjustment module 14 adjusts the first weight and the second weight based on the number of motion image blocks. The number of motion image blocks is inversely proportional to the first weight, and the number of motion image blocks is directly proportional to the second weight.
[0084] In some embodiments, the reconfigurable computing unit 30 is configured to perform steps 05 and 07. That is, the reconfigurable computing unit 30 is configured to obtain a third image block having a sum of pixel values greater than a preset threshold as a motion image block; and adjust the first weight and the second weight according to the number of motion image blocks, wherein the number of motion image blocks is inversely proportional to the first weight, and the number of motion image blocks is directly proportional to the second weight.
[0085] Specifically, after generating at least one third image block based on the pixel value differences between corresponding pixels in the first and second image blocks, the reconstructible calculation unit 30 may further determine whether the sum of the pixel values is greater than a preset threshold, thereby selecting the third image block having a pixel value greater than the preset threshold as a motion image block. The preset threshold is a manually set empirical value.
[0086] More specifically, when the moving object does not move in the Nth frame image, theoretically, the absolute value of the difference in pixel values between the second image block generated by the Nth frame image and the first image block generated by the background image should be approximately 0. However, when the moving object does move in the Nth frame image, the absolute value of the difference in pixel values between the second image block generated by the Nth frame image and the first image block generated by the background image will be greater than 0. Therefore, whether the Nth frame image has moved can be determined by the pixel values of the pixels in the third image block or by the sum of the pixel values of all pixels in the third image block.
[0087] It can be understood that when the sum of the pixel values of all pixels in the third image block is greater than the preset threshold, it indicates that the moving object in the third image block moves, and the reconstructible calculation unit 30 can regard the third image block as a moving image block.
[0088] In this way, the reconfigurable calculation unit 30 can calculate the number of moving image blocks in all third image blocks. When the number of moving image blocks is large, it means that the moving object in the Nth frame image has moved, that is, the Nth frame image has undergone a significant change. In this case, when updating the background image, the weight of the Nth frame image needs to be increased accordingly, that is, the second weight of the second image block needs to be increased.
[0089] In summary, after the reconfigurable calculation unit 30 calculates the number of moving image blocks, it can adjust the first weight of the first image block and the second weight of the second image block based on the number of moving image blocks, thereby changing the weights occupied by the background image and the Nth frame image when updating the background image. It can be understood that the number of moving image blocks is inversely proportional to the first weight, while the number of moving image blocks is directly proportional to the second weight.
[0090] For example, the first weight is initially set to 0.8 and the second weight is 0.2. If the number of third image blocks is 100 and the number of motion image blocks is 10, it means that the motion image blocks account for a small proportion of all third image blocks. In this case, the first weight can be increased to 0.9 and the second weight can be reduced to 0.1. If the number of motion image blocks is 70, it means that there are many moving parts in the Nth frame image. In this case, the first weight can be reduced to 0.3 and the second weight can be increased to 0.7.
[0091] In this way, by judging the number of motion image blocks, the proportion of the changed area in the result image generated based on the background image and the Nth frame image can be judged, so as to flexibly adjust the weights of the background image and the Nth frame image when updating the background image to ensure accurate updating of the background image, thereby ensuring high accuracy when detecting the motion of the moving object through the result image.
[0092] In an embodiment of the present application, the first acquisition module 11, the calculation module 12, and the second acquisition module 13 can each be one or more processors, controllers, or chips with a communication interface capable of implementing a communication protocol. If necessary, they can also include memory and related interfaces, a system transmission bus, etc.; the processors, controllers, or chips execute program-related code to implement corresponding functions. Alternatively, an alternative solution is that the first acquisition module 11, the calculation module 12, and the second acquisition module 13 share an integrated chip or a shared processor, controller, memory, or other device. The shared processor, controller, or chip executes program-related code to implement corresponding functions.
[0093] 11 , an embodiment of the present application further provides a non-volatile computer-readable storage medium 300 containing a computer program 301. When the computer program 301 is executed by one or more processors 20, the one or more processors 20 execute the image processing method of any of the above embodiments.
[0094] For example, when the computer program 301 is executed by one or more processors 20, the processor 20 performs the following image processing method:
[0095] 01: Get multiple frames of images and use the first frame as the background image;
[0096] 03: Input the background image and the Nth frame image to the reconfigurable computing unit 30 of the embedded device 100 to calculate the result image, and update the background image according to the Nth frame image and the background image. The result image is used for motion detection of moving objects, and N is a positive integer greater than 1.
[0097] For another example, when the computer program 301 is executed by one or more processors 20, the processors 20 perform the following image processing method:
[0098] 031: According to the memory capacity of the reconfigurable computing unit 30, the background image is divided into at least one first image block, and the Nth frame image is divided into at least one second image block, with the first image blocks and the second image blocks corresponding to each other in a one-to-one manner;
[0099] 033: inputting the corresponding first image block and the second image block into the reconfigurable computing unit 30 in sequence to generate at least one third image block according to the pixel value difference between the corresponding pixels in the corresponding first image block and the second image block; and
[0100] 035: Generate a result image according to the third image block.
[0101] In the description of this specification, the reference terms "certain embodiments", "in an example", "exemplarily", etc. mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are mutually inconsistent.
[0102] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.
[0103] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. An image processing method, characterized in that: The image processing method comprises: Acquire multiple frames of images, and use the first frame of the image as a background image; and The background image and the Nth frame image are input to a reconfigurable computing unit of an embedded device to calculate a result image, and the background image is updated according to the Nth frame image and the background image. The result image is used for motion detection of moving objects, and N is a positive integer greater than 1.
2. The image processing method according to claim 1, characterized in that: The step of inputting the background image and the Nth frame image to a reconfigurable computing unit of an embedded device to calculate a result image includes: According to the memory capacity of the reconfigurable computing unit, the background image is divided into at least one first image block, and the Nth frame image is divided into at least one second image block, and the first image block and the second image block correspond to each other one by one; inputting the corresponding first image block and the corresponding second image block into the reconfigurable computing unit in sequence, so as to generate at least one third image block according to the pixel value difference between the corresponding pixels in the corresponding first image block and the corresponding second image block; The result image is generated according to the third image block.
3. The image processing method according to claim 2, characterized in that: Generating the result image according to the third image block comprises: The third image block is copied to a memory of a processor of the embedded device to generate the result image.
4. The image processing method according to claim 2, characterized in that: The updating of the background image according to the Nth frame image and the background image comprises: inputting the corresponding first image block and the corresponding second image block into the reconfigurable computing unit in sequence, so as to generate at least one fourth image block according to the sum of weighted values of pixel values of corresponding pixels in the corresponding first image block and the second image block; The first image block corresponding to the background image is updated according to the fourth image block.
5. The image processing method according to claim 4, characterized in that: The generating at least one fourth image block according to the sum of weighted values of pixel values of corresponding pixels in the first image block and the second image block comprises: According to a first product of a preset first weight and a pixel value of a first pixel in the first image block, and a preset second weight and an image value of a second pixel corresponding to the first pixel in the second image block corresponding to the first image block, The sum of the second products of the pixel values generates a pixel value of a third pixel; The fourth image block is generated according to the pixel value of the third pixel.
6. The image processing method according to claim 5, characterized in that: Also includes: Acquire the third image block whose sum of pixel values is greater than a preset threshold as a motion image block; The first weight and the second weight are adjusted according to the number of the motion image blocks, the number of the motion image blocks is inversely proportional to the first weight, and the number of the motion image blocks is directly proportional to the second weight.
7. The image processing method according to claim 4, characterized in that: The updating of the first image block corresponding to the background image according to the fourth image block comprises: The fourth image block is copied to the memory of the processor of the embedded device, and the first image block corresponding to the background image is replaced by the fourth image block to obtain the updated background image.
8. An image processing device, characterized in that: include: A first acquisition module, the first acquisition module is used to acquire multiple frames of images and use the first frame of the image as a background image; A computing module, wherein the computing module is used to input the background image and the Nth frame image into a reconfigurable computing unit of an embedded device to calculate a result image, and to update the background image according to the Nth frame image and the background image, wherein the result image is used for motion detection of a moving object, and N is a positive integer greater than 1.
9. An embedded device, characterized in that: It includes a processor and a reconfigurable computing unit, the processor is used to obtain multiple frames of images and use the first frame of the image as a background image; and input the background image and the Nth frame image into the reconfigurable computing unit; the reconfigurable computing unit is used to calculate a result image according to the background image and the Nth frame image, and update the background image according to the Nth frame image and the background image, the result image is used for motion detection of moving objects, and N is a positive integer greater than 1.
10. The embedded device according to claim 9, characterized in that: The processor is used to divide the background image into at least one first image block and the Nth frame image into at least one second image block according to the memory capacity of the reconfigurable computing unit, and the first image blocks and the second image blocks correspond to each other one by one; the corresponding first image blocks and the second image blocks are input into the reconfigurable computing unit in sequence; the reconfigurable computing unit is used to generate at least one third image block according to the pixel value difference between the corresponding pixels in the corresponding first image block and the second image block; and the result image is generated according to the third image block.
11. The embedded device according to claim 10, characterized in that: The reconfigurable computing unit is used to copy the third image block to the memory of the processor; and the processor is used to generate the result image according to the third image block.
12. The embedded device according to claim 10, characterized in that: The processor is used to input the corresponding first image block and the second image block into the reconfigurable computing unit in sequence; the reconfigurable computing unit is used to generate at least one fourth image block according to the sum of weighted values of pixel values of corresponding pixels in the corresponding first image block and the second image block; and update the corresponding first image block in the background image according to the fourth image block.
13. The embedded device according to claim 12, characterized in that: The reconfigurable calculation unit is used to generate a pixel value of a third pixel according to a sum of a first product of a preset first weight and a pixel value of a first pixel in the first image block, and a second product of a preset second weight and a pixel value of a second pixel corresponding to the first pixel in the second image block corresponding to the first image block; And generating the fourth image block according to the pixel value of the third pixel.
14. The embedded device according to claim 13, characterized in that: The reconfigurable computing unit is used to obtain the third image block whose sum of pixel values is greater than a preset threshold as a motion image block; and adjust the first weight and the second weight according to the number of the motion image blocks, the number of the motion image blocks is inversely proportional to the first weight, and the number of the motion image blocks is directly proportional to the second weight.
15. The embedded device according to claim 12, characterized in that: The reconfigurable computing unit is used to copy the fourth image block to the memory of the processor of the embedded device, and use the fourth image block to replace the first image block corresponding to the background image to obtain the updated background image.
16. A non-volatile computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by one or more processors, the image processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for implementing H.264 deblocking filter algorithm based on reconfigurable technique
CN102572430A
Moving object detection method and system
CN107330916A
Motion detection method and device, computer equipment and storage medium
CN111462155A
Moving target detection method, system and device and storage medium
CN115330834A
Image processing method and device, embedded equipment and computer readable storage medium
CN116229327A
