Image movement detection method and device for image shooting and storage medium
By segmenting the image blocks on the mobile smart terminal and adding anchor points, and detecting the phase movement value of the image blocks in combination with the phase correlation method, the problem of difficulty in quickly and accurately detecting the movement of the image captured picture in the prior art is solved, and efficient detection of overall and local movements and the robustness of illumination changes is achieved.
Patent Information
- Application Number
- CN202411829319.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-05-02
AI Technical Summary
The prior art is difficult to detect quickly and accurately whether the image capture screen is moving on a mobile smart terminal, especially when the light changes greatly, and it is difficult to detect overall and local movements simultaneously.
By dividing the images captured in the first and last two frames into image blocks with the same number and size, and adding anchor points to each image block, the phase movement value of each image block is counted by the phase correlation method to determine whether the image captured image is moved.
It realizes the rapid and accurate detection of the overall and local movement of the image-capturing image on the mobile smart terminal, and has high robustness adaptability to light changes.
Smart Images

Figure CN119919442A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and specifically provides a method, a device and a storage medium for detecting image motion in image shooting. Background Art
[0002] When using a mobile smart terminal (such as a mobile phone, tablet computer, etc.) to shoot an image, it is necessary to detect whether the shot picture is moving, and then prompt the user to keep stable to take a clear picture. The existing technical solutions for detecting whether the shot picture is moving are as follows:
[0003] 1. Background subtraction based method: This is the most intuitive method, which detects moving objects by subtracting the background frame from the current frame.
[0004] The main disadvantages of this solution are: it requires the background to be static or have a good background update mechanism; the requirement for a static background is difficult to meet in actual usage scenarios; and the background update mechanism is generally very time-consuming and difficult to deploy on mobile smart terminals.
[0005] 2. Optical flow method: Optical flow refers to the motion patterns of the surface of objects in image sequences. By analyzing the changes in these patterns, the movement of the objects can be inferred.
[0006] The main disadvantage of this scheme is that two basic assumptions are difficult to meet: (1) constant brightness; (2) small motion.
[0007] 3. Frame difference based method: This method detects motion by comparing the differences between consecutive frames. It is particularly effective for fast-moving objects.
[0008] The main disadvantages of this solution are that it may not be able to detect slow-moving objects and is very sensitive to lighting changes.
[0009] 4. Machine learning-based methods: These methods use training data to identify moving objects. For example, models trained using deep learning algorithms can effectively detect and classify objects in complex environments.
[0010] The main disadvantages of this solution are that it is time-consuming and not suitable for motion detection other than the target.
[0011] In view of this, the present invention patent is proposed. Summary of the invention
[0012] In view of the above technical problems, the purpose of the present invention is to quickly and accurately detect the motion of image captured on a smart mobile terminal, including the overall movement (change) or local movement (change) of the image, and to have high robustness to lighting changes.
[0013] The present invention provides a method, device and storage medium for detecting image motion in image capture, and specifically adopts the following technical solutions:
[0014] In a first aspect, the present invention provides a method for detecting image motion in image capture, comprising:
[0015] Acquire two consecutive frames of captured images;
[0016] Divide the two frames of captured images into blocks of the same number and size, and add anchor points to each block;
[0017] The phase correlation method is used to count the phase shift values of each image block in the two frames of images taken before and after to determine whether the image captured has moved.
[0018] As an optional embodiment of the present invention, in a method for detecting motion of an image captured by the present invention, the phase movement value of each image block in the two frames of captured images before and after is counted by the phase correlation method to determine whether the image captured has moved includes:
[0019] The phase correlation method is used to calculate the phase shift value S of each image block in the two frames of images taken before and after. i , where i = 1, 2, ..., n, and n is the same as the number of image blocks;
[0020] If the phase shift value S of all image blocks i All satisfy |S i |<φ, then it is judged that the image captured has not moved. If there is |S i |≥φ, it is determined that the image captured has moved, where φ is the preset minimum phase shift value.
[0021] As an optional embodiment of the present invention, in a method for detecting motion of an image captured by the present invention, if it is determined that the image captured has moved, the phase shift value S of each image block in the two frames of captured images before and after is obtained. i The maximum value among them is taken as the image movement value of the two frames of images taken before and after.
[0022] As an optional embodiment of the present invention, in a method for detecting motion of an image captured by the present invention, the phase movement value of each image block in the two frames of captured images before and after is counted by the phase correlation method includes:
[0023] Take the image block in the previous frame t-1 Perform Fourier transform to obtain Ga = DFT [block t-1], the corresponding image block in the subsequent frame image t Perform Fourier transform to obtain Gb = DFT[block t ];
[0024] Compute the cross power spectrum:
[0025] Calculate the inverse Fourier transform of the cross power spectrum: r = DFT-1[R];
[0026] Calculate the maximum value of r and apply the following formula in a window of w*w pixels centered at this position to obtain the sub-pixel precision position:
[0027]
[0028] Finally, (a, b) is the image block in the previous frame image. t-1 The image block corresponding to the image captured in the next frame t The phase shift value between .
[0029] As an optional implementation manner of the present invention, in a method for detecting motion in an image captured by the present invention, adding an anchor point in each image block includes:
[0030] Add K pixels with fixed pixel values at the set position of each image block as the anchor points of the image block;
[0031] Optionally, K pixels with fixed pixel values are added at the center of each image block as anchor points of the image block.
[0032] As an optional implementation manner of the present invention, in a method for detecting motion in an image captured by the present invention, dividing the captured images of the two frames before and after into image blocks of the same number and size comprises:
[0033] The long sides of the two frames of images are set to the preset image length value, and the short sides are scaled proportionally accordingly;
[0034] The two frames of captured images are divided into M continuous r*r image blocks according to the adjusted long sides, and the two frames of captured images are divided into N continuous r*r image blocks according to the adjusted short sides, where r is the side length of the image block set according to the preset image length value.
[0035] As an optional embodiment of the present invention, in a method for detecting motion of image capture of the present invention, in the process of dividing the two frames of captured images into N consecutive r*r image blocks according to the adjusted short sides, if the length L of the adjusted short sides of the two frames of captured images is not an integer multiple of r, then according to The maximum number of blocks that can be divided into blocks is determined, and then the redundant parts after the captured image is divided into blocks are discarded.
[0036] In a second aspect, the present invention provides a device for detecting image motion during image capture, comprising:
[0037] An image acquisition module acquires two consecutive frames of captured images;
[0038] The image block division module divides the two frames of images into blocks of the same number and size, and adds anchor points to each block;
[0039] The image motion judgment module uses the phase correlation method to count the phase shift values of each image block in the two frames of images taken before and after, and judges whether the image captured has moved.
[0040] In a third aspect, the present invention provides a computer-readable recording medium storing a computer-executable program, wherein when the computer-executable program is executed, the image capture screen motion detection method is implemented.
[0041] In a fourth aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store a computer executable program, and when the computer program is executed by the processor, the processor executes the image capture screen motion detection method.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] A method for detecting motion of captured images of the present invention divides two frames of captured images into image blocks of the same number and size, so that a phase correlation method can be applied to local changes of the image, and the motion detection of captured images is quickly and accurately performed on a mobile smart terminal, including the overall movement (change) or local movement (change) of the image.
[0044] A method for detecting motion in image capture of the present invention adds anchor points in each image block. Based on the characteristics of the phase correlation method, the method adds anchor points in the image block to resist light noise interference without affecting speed and accuracy. In this way, when detecting motion in image capture, the method has high robustness to changes in illumination. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A flowchart of a method for detecting motion in an image captured by a first embodiment of the present invention;
[0046] Figure 2 A schematic diagram of image segmentation in a method for detecting image motion in image capture according to a first embodiment of the present invention;
[0047] Figure 3 A schematic structural diagram of an electronic device according to a second embodiment of the present invention;
[0048] Figure 4 A schematic diagram of a computer-readable recording medium according to a second embodiment of the present invention. DETAILED DESCRIPTION
[0049] To make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be described clearly and completely in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them.
[0050] Therefore, the following detailed description of the embodiments of the present invention is not intended to limit the scope of the invention claimed for protection, but merely represents some embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features and technical solutions in the embodiments may be combined with each other.
[0052] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0053] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "upper", "lower", etc. is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the invention product is usually placed when in use, or the orientation or positional relationship commonly understood by those skilled in the art. Such terms are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0054] Embodiment 1
[0055] See also Figure 1 As shown, a method for detecting motion of an image captured in this embodiment includes:
[0056] Acquire two consecutive frames of captured images;
[0057] Divide the two frames of captured images into blocks of the same number and size, and add anchor points to each block;
[0058] The phase correlation method is used to count the phase shift values of each image block in the two frames of images taken before and after to determine whether the image captured has moved.
[0059] A method for detecting motion in image capture of the present embodiment divides the captured images of two frames into image blocks of the same number and size, so that the phase correlation method can be applied to local changes in the image, and the motion detection of image capture can be performed quickly and accurately on a mobile smart terminal, including the overall movement (change) or local movement (change) of the image.
[0060] In the present embodiment, a method for detecting motion in image capture is provided, and anchor points are added in each image block. Based on the characteristics of the phase correlation method, the interference of light noise is resisted by adding anchor points in the image block without affecting the speed and accuracy. In this way, when performing motion detection in image capture, the method has high robustness to changes in illumination.
[0061] The phase correlation method of this embodiment obtains the moving distance through the phase change of the images captured by adjacent frames in the frequency domain.
[0062] As an optional implementation manner of this embodiment, in a method for detecting motion of an image captured in this embodiment, the phase movement values of each image block in two frames of captured images before and after are counted by a phase correlation method to determine whether the image captured has moved includes:
[0063] The phase correlation method is used to calculate the phase shift value S of each image block in the two frames of images taken before and after. i , where i = 1, 2, ..., n, and n is the same as the number of image blocks;
[0064] If the phase shift value S of all image blocks i All satisfy |S i |<φ, then it is judged that the image captured has not moved. If there is |S i |≥φ, it is determined that the image captured has moved, where φ is the preset minimum phase shift value.
[0065] In this embodiment, the phase correlation method is used for each image block in the two frames of captured images, and the phase shift value S of each image block in the two frames of captured images is calculated. i , as long as there is |S i When |≥φ, it can be determined that the image captured has moved, and both the overall movement (change) and partial movement (change) of the image can be detected.
[0066] Specifically, the phase shift value S of each image block in the current and next two frames of captured images is i All satisfy |S i |≥φ, it is determined that the image captured has moved (changed) as a whole.
[0067] The phase shift value S of each image block in the current and next two frames of images i Simultaneous existence|S i |≥φ and |S i |<φ, it is determined that the captured image has partially moved (changed), and the image block where the local movement (change) has occurred in the image can be further located.
[0068] Furthermore, in a method for detecting motion of an image captured in this embodiment, if it is determined that the image captured has moved, the phase shift value S of each image block in the two frames of captured images before and after is obtained. i The maximum value among them is taken as the image movement value of the two frames of images taken before and after.
[0069] In a method for detecting motion of an image captured in this embodiment, the phase movement value of each image block in two frames of captured images before and after is counted by the phase correlation method, including:
[0070] Take the image block in the previous frame t-1 Perform Fourier transform to obtain Ga = DFT [block t-1 ], the corresponding image block in the subsequent frame image t Perform Fourier transform to obtain Gb = DFT[block t ];
[0071] Compute the cross power spectrum:
[0072] Calculate the inverse Fourier transform of the cross power spectrum: r = DFT-1[R];
[0073] Calculate the maximum value of r and apply the following formula in a window of w*w pixels centered at this position to obtain the sub-pixel precision position:
[0074]
[0075] Finally, (a, b) is the image block in the previous frame image. t-1 The image block corresponding to the image captured in the next frame t The phase shift value between .
[0076] As an optional implementation manner of this embodiment, in a method for detecting motion of an image captured by this embodiment, adding an anchor point in each image block includes:
[0077] Add K pixels with fixed pixel values at the set position of each image block as the anchor point of the image block. This can fundamentally improve the impact of noise without affecting speed and accuracy. Figure 2 As shown: In pure color areas such as positions 12 and 9, slight changes in light will cause drastic changes in position. Adding anchor points can effectively suppress this situation.
[0078] Optionally, K pixels with fixed pixel values are added at the center of each image block as anchor points of the image block.
[0079] As an optional implementation manner of this embodiment, in a method for detecting motion in image capture of this embodiment, dividing the captured images of the two frames before and after into image blocks of the same number and size comprises:
[0080] The long sides of the two frames of images are set to the preset image length value, and the short sides are scaled proportionally accordingly;
[0081] The two frames of captured images are divided into M continuous r*r image blocks according to the adjusted long sides, and the two frames of captured images are divided into N continuous r*r image blocks according to the adjusted short sides, where r is the side length of the image block set according to the preset image length value.
[0082] In a method for detecting motion in image capture of the present embodiment, when dividing an image into blocks, the long sides of the two frames of captured images are set to a preset image length value, and the side length r of the image block block is determined according to the preset image length value, r is set to be divisible by the preset image length value, and r should not be set to be larger than the adjusted short sides of the two frames of captured images, thereby ensuring that the captured image can be divided into multiple image blocks.
[0083] Furthermore, in a method for detecting motion in image capture of the present embodiment, when dividing the two captured images of the previous and next frames into image blocks of the same number and size, the more image blocks are divided, the higher the accuracy of the image motion detection is, but at the same time it will cause calculation pressure; if the number of divided image blocks is too small, the calculation speed is very fast, but the accuracy of the image motion detection may be reduced.
[0084] Therefore, in a method for detecting motion in image capture of the present embodiment, when dividing the captured images of the preceding and succeeding frames into image blocks of the same number and size, a corresponding threshold range of the number of image blocks is set according to each preset image length value, and an image block with the maximum side length r satisfying the threshold range of the number of image blocks is selected for image segmentation, thereby ensuring both the accuracy of the image motion detection and the calculation speed.
[0085] In the image motion detection method of an image shooting of the present embodiment, in the process of dividing the two frames of captured images into N consecutive r*r image blocks according to the adjusted short sides, if the length L of the adjusted short sides of the two frames of captured images is not an integer multiple of r, then according to Determine the maximum number of blocks that can be divided into blocks, and then discard the redundant parts after the captured image is divided into blocks. In this way, even if the captured image cannot be divided into blocks completely, the redundant parts are deleted, which does not affect the use of image motion detection. However, when the phase shift value of each block in the two frames of captured images is counted by the phase correlation method, the two frames of captured images need to be aligned.
[0086] A method for detecting motion of an image captured in this embodiment is described in detail as follows:
[0087] 1. Input the captured image and scale it in proportion to the long side of 256 and the short side of 256;
[0088] 2. The captured image is divided into continuous 32*32 image blocks. If it is not an integer multiple of 32, it will be discarded without affecting the use;
[0089] 3. Add an anchor point at the center of each image block (size is 5 cross-shaped pixels, pixel value is fixed), which can fundamentally improve the noise effect without affecting speed and accuracy. Figure 2 As shown; in pure color areas such as positions 12 and 9, slight changes in light will cause drastic changes in position. Adding anchor points can effectively suppress this situation.
[0090] 4. Use the phase correlation method to count the phase shift values of each image block in the previous and next frames and take the maximum value as the final shift value.
[0091] The present embodiment provides a method for detecting motion in an image captured by an image. The final test algorithm of the above example takes 12ms. It can effectively identify whether the tablet is placed on a shelf or held by hand, or only the hand is moving on the surface of the tablet, and is highly robust to changes in lighting.
[0092] This embodiment also provides a device for detecting image motion during image capture, including:
[0093] An image acquisition module acquires two consecutive frames of captured images;
[0094] The image block division module divides the two frames of images into blocks of the same number and size, and adds anchor points to each block;
[0095] The image motion judgment module uses the phase correlation method to count the phase shift values of each image block in the two frames of images taken before and after, and judges whether the image captured has moved.
[0096] The present invention provides a device for detecting motion of image shooting. The image block division module divides the captured images of the previous and next frames into image blocks of the same number and size. The image motion judgment module uses a phase correlation method to detect local changes in the image, and quickly and accurately performs image motion detection on a mobile smart terminal, including overall movement (change) or local movement (change) of the image.
[0097] In an image capture picture motion detection device of the present invention, an image block division module adds anchor points in each image block. Based on the characteristics of the phase correlation method, anchor points are added in the image block to resist light noise interference without affecting speed and accuracy. In this way, when performing image capture picture motion detection, the device has high robustness to illumination changes.
[0098] The phase correlation method of this embodiment obtains the moving distance through the phase change of the images captured by adjacent frames in the frequency domain.
[0099] As an optional implementation manner of this embodiment, in an image capture picture motion detection device of this embodiment, the picture motion judgment module uses a phase correlation method to count the phase movement values of each image block in the two frames of captured images before and after, and judges whether the image capture picture moves, including:
[0100] The phase correlation method is used to calculate the phase shift value S of each image block in the two frames of images taken before and after. i, where i = 1, 2, ..., n, and n is the same as the number of image blocks;
[0101] If the phase shift value S of all image blocks i All satisfy |S i |<φ, then it is judged that the image captured has not moved. If there is |S i |≥φ, it is determined that the image captured has moved, where φ is the preset minimum phase shift value.
[0102] The image motion determination module of this embodiment uses the phase correlation method for each image block in the two frames of captured images to calculate the phase shift value S of each image block in the two frames of captured images. i , as long as there is |S i When |≥φ, it can be determined that the image captured has moved, and both the overall movement (change) and partial movement (change) of the image can be detected.
[0103] Specifically, the phase shift value S of each image block in the current and next two frames of captured images is i All satisfy |S i |≥φ, it is determined that the image captured has moved (changed) as a whole.
[0104] The phase shift value S of each image block in the current and next two frames of images i Simultaneous existence|S i |≥φ and |S i |<φ, it is determined that the captured image has partially moved (changed), and the image block where the local movement (change) has occurred in the image can be further located.
[0105] Furthermore, in the image capture frame motion detection device of the present embodiment, if the frame motion judgment module judges that the image capture frame has moved, the phase shift value S of each image block in the two frames of captured images before and after is obtained. i The maximum value among them is taken as the image movement value of the two frames of images taken before and after.
[0106] In the present embodiment, a screen motion detection device for image shooting is provided, wherein the screen motion judgment module uses a phase correlation method to count the phase shift values of each image block in the two frames of captured images before and after, including:
[0107] Take the image block in the previous frame t-1 Perform Fourier transform to obtain Ga = DFT [block t-1 ], the corresponding image block in the subsequent frame image tPerform Fourier transform to obtain Gb = DFT[block t ];
[0108] Compute the cross power spectrum:
[0109] Calculate the inverse Fourier transform of the cross power spectrum: r = DFT-1[R];
[0110] Calculate the maximum value of r and apply the following formula in a window of w*w pixels centered at this position to obtain the sub-pixel precision position:
[0111]
[0112] Finally, (a, b) is the image block in the previous frame image. t-1 The image block corresponding to the image captured in the next frame t The phase shift value between .
[0113] As an optional implementation manner of this embodiment, in an image capture picture motion detection device of this embodiment, the image block division module adds an anchor point in each image block, including:
[0114] Add K pixels with fixed pixel values at the set position of each image block as the anchor point of the image block. This can fundamentally improve the impact of noise without affecting speed and accuracy. Figure 2 As shown: In pure color areas such as positions 12 and 9, slight changes in light will cause drastic changes in position. Adding anchor points can effectively suppress this situation.
[0115] Optionally, K pixels with fixed pixel values are added at the center of each image block as anchor points of the image block.
[0116] As an optional implementation manner of this embodiment, in an image capture frame motion detection device of this embodiment, the image block division module divides the captured images of the previous and next frames into image blocks of the same number and size, including:
[0117] The long sides of the two frames of images are set to the preset image length value, and the short sides are scaled proportionally accordingly;
[0118] The two frames of captured images are divided into M continuous r*r image blocks according to the adjusted long sides, and the two frames of captured images are divided into N continuous r*r image blocks according to the adjusted short sides, where r is the side length of the image block set according to the preset image length value.
[0119] In an image capture motion detection device of the present embodiment, when dividing the image into blocks, the image block division module sets the long sides of the two frames of captured images to a preset image length value, and determines the side length r of the image block block according to the preset image length value, r is set to be divisible by the preset image length value, and r should not be set to be larger than the adjusted short sides of the two frames of captured images, thereby ensuring that the captured image can be divided into multiple image blocks.
[0120] Furthermore, in an image capture motion detection device of the present embodiment, when the image block division module divides the two frames of captured images into image blocks of the same number and size, the more image blocks are divided, the higher the accuracy of the image motion detection is, but at the same time it will cause calculation pressure; if the number of divided image blocks is too small, the calculation speed is very fast, but the accuracy of the image motion detection may be reduced.
[0121] Therefore, when the image block division module of this embodiment divides the captured images of the previous and next two frames into image blocks of the same number and size, it sets the corresponding image block number threshold range according to each preset image length value, and selects the image block with the maximum side length r that meets the image block number threshold range for image division, so as to ensure both the accuracy of picture motion detection and the calculation speed.
[0122] In the present embodiment, a method for detecting motion in image capture is provided. In the process of dividing the image blocks of the two frames of captured images into N consecutive r*r image blocks according to the adjusted short sides, if the length L of the adjusted short sides of the two frames of captured images is not an integer multiple of r, then according to Determine the maximum number of blocks that can be divided into blocks, and then discard the redundant parts after the captured image is divided into blocks. In this way, even if the captured image cannot be divided into blocks completely, the redundant parts are deleted, which does not affect the use of image motion detection. However, when the phase shift value of each block in the two frames of captured images is counted by the phase correlation method, the two frames of captured images need to be aligned.
[0123] Embodiment 2
[0124] The following describes an electronic device embodiment of the present invention, which can be regarded as a specific physical implementation of the method and device embodiments of the present invention. The details described in the electronic device embodiment of the present invention should be regarded as a supplement to the above method or device embodiments; details not disclosed in the electronic device embodiment of the present invention can be implemented with reference to the above method or device embodiments.
[0125] Figure 3 It is a structural schematic diagram of an electronic device of an embodiment of the present invention, the electronic device includes a processor and a memory, the memory is used to store a computer executable program, when the computer program is executed by the processor, the processor executes a method for detecting image motion in image shooting according to the first embodiment.
[0126] like Figure 3 As shown, the electronic device is presented in the form of a general computing device. The processor may be one or more and work in coordination. The present invention does not exclude distributed processing, that is, the processor may be dispersed in different physical devices. The electronic device of the present invention is not limited to a single entity, but may also be the sum of multiple physical devices.
[0127] The memory stores a computer executable program, which is usually a machine-readable code. The computer-readable program can be executed by the processor to enable the electronic device to perform the method of the present invention, or at least part of the steps in the method.
[0128] The memory includes a volatile memory, such as a random access memory unit (RAM) and / or a cache memory unit, and may also be a non-volatile memory, such as a read-only memory unit (ROM).
[0129] Optionally, in this embodiment, the electronic device further includes an I / O interface, which is used for the electronic device to exchange data with an external device. The I / O interface can represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of a variety of bus structures.
[0130] It should be understood that Figure 3 The electronic device shown is only an example of the present invention, and the electronic device of the present invention may also include elements or components not shown in the above examples. For example, some electronic devices also include display units such as display screens, and some electronic devices also include human-computer interaction elements such as buttons, keyboards, etc. As long as the electronic device can execute the computer-readable program in the memory to implement the method of the present invention or at least part of the steps of the method, it can be considered as an electronic device covered by the present invention.
[0131] Figure 4 Schematic diagram of a computer readable recording medium according to an embodiment of the present invention. Figure 4As shown, a computer executable program is stored in a computer-readable recording medium, and when the computer executable program is executed, a method for detecting image motion in image capture according to the first embodiment of the present invention is implemented. The computer-readable recording medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable recording medium may also be any readable medium other than a readable recording medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, device, or device. The program code contained on the readable recording medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0132] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0133] Through the above description of the implementation mode, it is easy for those skilled in the art to understand that the present invention can be implemented by hardware capable of executing a specific computer program, such as the system of the present invention, and the electronic processing unit, server, client, mobile phone, control unit, processor, etc. contained in the system. The present invention can also be implemented by computer software that executes the method of the present invention, such as control software executed by a microprocessor, an electronic control unit, a client, a server, etc. However, it should be noted that the computer software that executes the method of the present invention is not limited to being executed by one or a specific hardware entity, and it can also be implemented in a distributed manner by unspecified specific hardware. For computer software, the software product can be stored in a computer-readable recording medium (which can be a CD-ROM, a USB flash drive, a mobile disk, etc.), and can also be distributed and stored on the network, as long as it enables the electronic device to execute the method according to the present invention.
[0134] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described in the present invention. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the above specific implementation methods. Therefore, any modification or equivalent replacement of the present invention; and all technical solutions and improvements thereof that do not depart from the spirit and scope of the invention are included in the scope of the claims of the present invention.
Claims
1. A method for detecting motion in an image capture, characterized in that: include: Acquire two consecutive frames of captured images; Divide the two frames of captured images into blocks of the same number and size, and add anchor points to each block; The phase correlation method is used to count the phase shift values of each image block in the two frames of images taken before and after to determine whether the image captured has moved.
2. The method for detecting motion of an image captured according to claim 1, characterized in that: The method of counting the phase shift values of each image block in the two frames of captured images before and after by the phase correlation method to determine whether the captured image has moved includes: The phase correlation method is used to calculate the phase shift value S of each image block in the two frames of images taken before and after. i , where i = 1, 2, ..., n, and n is the same as the number of image blocks; If the phase shift value S of all image blocks i All satisfy |S i |<φ, then it is judged that the image captured has not moved. If there is |S i |≥φ, it is determined that the image captured has moved, where φ is the preset minimum phase shift value.
3. The method for detecting motion of an image captured according to claim 2, characterized in that: If it is determined that the image captured has moved, the phase shift value S of each image block in the two frames of captured images before and after is obtained. i The maximum value among them is taken as the image movement value of the two frames of images taken before and after.
4. The method for detecting motion of an image captured according to claim 2, characterized in that: The phase correlation method is used to count the phase shift values of each image block in the two frames of captured images, including: Take the image block in the previous frame t-1 Perform Fourier transform to obtain Ga = DFT [block t-1 ], the corresponding image block in the subsequent frame image t Perform Fourier transform to obtain Gb = DFT[block t ]; Compute the cross power spectrum: Calculate the inverse Fourier transform of the cross power spectrum: r = DFT-1[R]; Calculate the maximum value of r and apply the following formula in a window of w*w pixels centered at this position to obtain the sub-pixel precision position: Finally, (a, b) is the image block in the previous frame image. t-1 The image block corresponding to the image captured in the next frame t The phase shift value between .
5. The method for detecting motion of an image captured according to claim 1, characterized in that: The adding of anchor points in each image block includes: Add K pixels with fixed pixel values at the set position of each image block as the anchor points of the image block; Optionally, K pixels with fixed pixel values are added at the center of each image block as anchor points of the image block.
6. The method for detecting motion of an image captured according to claim 1, characterized in that: The method of dividing the captured images of the two frames before and after into image blocks of the same number and size comprises: The long sides of the two frames of images are set to the preset image length value, and the short sides are scaled proportionally accordingly; The two frames of captured images are divided into M continuous r*r image blocks according to the adjusted long sides, and the two frames of captured images are divided into N continuous r*r image blocks according to the adjusted short sides, where r is the side length of the image block set according to the preset image length value.
7. The method for detecting motion of an image captured according to claim 6, characterized in that: In the process of dividing the two frames of captured images into N consecutive r*r image blocks according to the adjusted short sides, if the length L of the short sides of the two frames of captured images after adjustment is not an integer multiple of r, then according to The maximum number of blocks that can be divided into blocks is determined, and then the redundant parts after the captured image is divided into blocks are discarded.
8. A device for detecting motion of an image captured, characterized in that: include: An image acquisition module acquires two consecutive frames of captured images; The image block division module divides the two frames of images into blocks of the same number and size, and adds anchor points to each block; The image motion judgment module uses the phase correlation method to count the phase shift values of each image block in the two frames of images taken before and after, and judges whether the image captured has moved.
9. A computer-readable recording medium storing a computer-executable program, characterized in that: When the computer executable program is executed, the image capture picture motion detection method as described in any one of claims 1 to 7 is implemented.
10. An electronic device comprising a processor and a memory, characterized in that The memory is used to store a computer executable program. When the computer program is executed by the processor, the processor executes the image capture picture motion detection method as described in any one of claims 1 to 7.