Method, apparatus, device, storage medium and program product for image detection
By adaptively adjusting the hyperparameters of optical flow calculation and using motion semantic separation technology, the problems of high computational resource consumption and insufficient detection accuracy of optical flow method in complex motion scenarios are solved, and efficient and accurate micro-motion detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2026-04-14
Smart Images

Figure CN120807589B_ABST
Abstract
Description
Technical Field
[0001] The exemplary embodiments disclosed herein generally relate to the field of image detection technology, and more specifically, to methods, apparatus, electronic devices, computer-readable storage media, and computer program products for image detection. Background Technology
[0002] Optical flow is a motion detection method based on the spatiotemporal features of image sequences. Its core principle is to establish correspondences between consecutive images by analyzing the temporal variation patterns of pixels between adjacent frames and the inter-frame correlation, thereby inferring object motion information. As a standard paradigm in the field of motion detection, this method has wide applications in human motion perception, with typical scenarios including biometric analysis such as respiratory monitoring and gesture recognition. Summary of the Invention
[0003] In a first aspect of this disclosure, a method for image detection is provided. The method includes: determining a target region in the current frame image of a target object, and the distance from the image acquisition device to the target object, based on a current frame image of the target object acquired by an image acquisition device; determining hyperparameters for performing optical flow calculation based on the target region and the distance, the hyperparameters including at least one of the following: the number of feature points and the size of the optical flow window; performing optical flow calculation on adjacent frame images following the current frame image acquired by the image acquisition device based on the hyperparameters used for performing the optical flow calculation, to determine the displacement of the target object in the adjacent frame images; and performing motion detection on the target object based on the displacement.
[0004] In a second aspect of this disclosure, an apparatus for image detection is provided. The apparatus includes: a recognition module configured to determine a target region in a current frame image of a target object acquired by an image acquisition device and a distance from the image acquisition device to the target object; an adjustment module configured to determine hyperparameters for performing optical flow calculations based on the target region and the distance, the hyperparameters including at least one of the following: the number of feature points and the size of the optical flow window; a calculation module configured to perform optical flow calculations on adjacent frame images following the current frame image acquired by the image acquisition device based on the hyperparameters used for performing the optical flow calculations, to determine the displacement of the target object in the adjacent frame images; and a detection module configured to perform motion detection on the target object based on the displacement.
[0005] In a third aspect of this disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the electronic device to perform the method of the first aspect.
[0006] In a fourth aspect of this disclosure, a computer-readable storage medium is provided. The medium stores a computer program that, when executed by a processor, implements the method of the first aspect.
[0007] In a fifth aspect of this disclosure, a computer program product is provided. The product includes a computer program, wherein when executed by a processor, the computer program implements the method according to a first aspect of this disclosure.
[0008] It should be understood that the description in this section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0009] The above and other features, advantages, and aspects of various implementations of this disclosure will become more apparent in the following detailed description, taken in conjunction with the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0010] Figure 1 A schematic diagram of an example environment in which embodiments of the present disclosure can be implemented is shown;
[0011] Figure 2 A flowchart of a method for image detection according to some embodiments of the present disclosure is shown;
[0012] Figure 3 A schematic structural block diagram of an apparatus for image detection according to certain embodiments of the present disclosure is shown; and
[0013] Figure 4 A block diagram of a computing device in which one or more embodiments of the present disclosure may be implemented is shown. Detailed Implementation
[0014] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0015] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0016] It should be noted that the acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0017] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure through appropriate means in accordance with relevant laws and regulations, and user authorization should be obtained.
[0018] For example, in response to receiving a user's active request, a prompt message is sent to the user to clearly inform the user that the requested operation will require the acquisition and use of the user's personal information, thereby enabling the user to choose whether to provide personal information to the software or hardware such as electronic devices, applications, servers or storage media that perform the operation of the technical solution disclosed herein, based on the prompt message.
[0019] As an optional but non-restrictive implementation, in response to a user's active request, a prompt message can be sent to the user, for example, via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose whether to "agree" or "disagree" to provide personal information to the electronic device.
[0020] It is understood that the above notification and user authorization acquisition process is merely illustrative and does not constitute a limitation on the embodiments of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the embodiments of this disclosure.
[0021] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. For example... Figure 1 As shown, example environment 100 may include electronic device 110 and image acquisition device 120. Electronic device 110 may be used to deploy detection application 112.
[0022] In example environment 100, electronic device 110 can utilize detection application 112 to perform detection on images acquired by image acquisition device 120, such as human detection and motion detection. Exemplarily, detection application 112 can be one or more, including applications such as human recognition, optical flow calculation, and motion detection. When a single detection application 112 is included, it can perform various functions such as human recognition, optical flow calculation, and motion detection.
[0023] Image acquisition device 120 can be, for example, various cameras, camcorders, or other image acquisition devices. Image acquisition device 120 communicates with electronic device 110, thereby sending images acquired by image acquisition device 120 to electronic device 110 for detection. It should be understood that image acquisition device 120 can exist independently of electronic device 110 or can be integrated into electronic device 110. For example, image acquisition device 120 can be an image acquisition device that is inherent to or integrated into electronic device 110. Exemplarily, image acquisition device 120 can be an RGBD camera device that can continuously acquire RGB images and depth maps of the target object.
[0024] Electronic device 110 may include any computing system with computing capabilities, such as various computing devices / systems, terminal devices, server devices, etc. Terminal devices may be any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, handheld computers, portable gaming terminals, VR / AR devices, personal communication system (PCS) devices, personal navigation devices, personal digital assistants (PDAs), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio receivers, e-book devices, gaming devices, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof.
[0025] Electronic device 110 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. Server-side equipment may include computing systems / servers, such as mainframes, edge computing nodes, computing devices in cloud environments, and so on.
[0026] It should be understood that the structure and function of the various elements in environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure.
[0027] As briefly mentioned earlier, optical flow is a commonly used motion detection method. Its key advantage lies in its adaptability to complex motion scenes. For example, when the motion scene lacks prior knowledge of the moving target (e.g., unpredictable motion models or difficult-to-define target features), a dense optical flow field combined with a pyramid hierarchical algorithm can effectively improve the detection accuracy of large displacement motions. This pixel-level motion analysis mode exhibits high detection accuracy in both foreground segmentation and target tracking tasks, but at the cost of significant algorithmic complexity leading to high computational resource consumption and limited real-time processing performance.
[0028] To optimize the timeliness of optical flow methods, current mainstream improvement schemes employ a joint feature detection strategy: by extracting key feature points from images to construct a sparse optical flow field, computational efficiency can be improved by 1-2 orders of magnitude. While sparse optical flow can significantly improve computational efficiency by reducing feature point computation density, it suffers from two core drawbacks: First, the static feature point detection mechanism (fixed sampling number) of sparse optical flow leads to perceptual distortion when the distance to the target object changes—distant targets experience spatial compression due to perspective effects, resulting in insufficient feature point spatial density and difficulty in capturing micrometer-level motion displacement. Second, in human motion detection scenarios, pure optical flow-driven schemes lack a priori recognition mechanism for moving targets, failing to distinguish between human motion and background interference (such as fluttering curtains or moving objects), thus significantly reducing the signal-to-noise ratio of motion signals. This technical limitation essentially reflects the inherent contradiction of the sparse optical flow framework: the irreconcilable conflict between the feature point density loss resulting from efficiency optimization and the requirement for complete motion perception. Especially in complex dynamic scenes, the fixed feature point strategy struggles to adapt to changes in target scale and lacks motion semantic understanding capabilities, leading to a dual decline in detection sensitivity and anti-interference ability in practical applications. Specifically, this strategy faces the inherent limitation of uncontrollable spatial distribution of feature points, potentially resulting in missing feature representations in specific moving target detection tasks, leading to decreased accuracy in trajectory estimation. This trade-off between accuracy and efficiency constitutes a key optimization challenge in the practical application of optical flow methods.
[0029] In view of this, embodiments of this disclosure provide an improved scheme for image detection. In this scheme, based on the current frame image of the target object acquired by the image acquisition device, the target region where the target object is located in the current frame image and the distance from the image acquisition device to the target object are determined. Based on the target region and distance, hyperparameters for performing optical flow calculations are determined, including at least one of the following: the number of feature points and the size of the optical flow window. Based on the hyperparameters used for performing optical flow calculations, optical flow calculations are performed on adjacent frame images after the current frame image acquired by the image acquisition device to determine the displacement of the target object in the adjacent frame images. Motion detection of the target object is then performed based on the displacement. Thus, a balance between computational efficiency and performance can be achieved in micro-motion detection while maintaining the real-time advantages of sparse optical flow.
[0030] The following description will continue with reference to the accompanying drawings, which will provide some exemplary embodiments of this disclosure.
[0031] Figure 2 A flowchart of a process 200 for image detection according to some embodiments of the present disclosure is shown. Process 200 can be implemented at electronic device 110. For ease of discussion, reference will be made to... Figure 1 The process 200 is described by electronic device 110.
[0032] At box 210, electronic device 110 can determine the target area where the target object is located in the current frame image and the distance from the image acquisition device to the target object based on the current frame image of the target object acquired by image acquisition device 120.
[0033] Image acquisition device 120 acquires an image of the target object and sends it to electronic device 110. Electronic device 110 performs image detection, such as motion detection, based on the image of the target object. As an example, in some embodiments of this disclosure, electronic device 110 performs micro-motion detection on the target object based on the image of the target object acquired by image acquisition device 120. The target object can be, for example, a person, or various other targets such as animals. As an example, in some embodiments of this disclosure, the target object is a person.
[0034] The image of the target object acquired by the image acquisition device 120 can include various types of images. In some embodiments of this disclosure, the image of the target object can include a grayscale image or a color image of the target object, such as an RGB image. In some embodiments of this disclosure, the image of the target object can also include a depth map of the target object, through which the distance (or depth) between the image acquisition device 120 and the target object can be obtained.
[0035] Taking human detection as an example, after acquiring a grayscale or color image of the target object, the electronic device 110 can determine the human body region in the image, i.e., the target region where the target object is located, through a preset human detection model or algorithm (e.g., YOLOv11). Once the target region is determined, the electronic device 110 can extract the target region from the image of the target object based on the target region, thereby determining the size of the target region. For example, the focal length and principal point of the image acquisition device 120 can be represented as f and (cx, cy), respectively. Assuming the horizontal / width and height dimensions of the target object's image are set to W and H, respectively, the target region can be represented as [x, y, w, h], where x and y are parameters corresponding to the principal point, and w and h are the horizontal / width and height dimensions of the target region, respectively.
[0036] Once the target area and its size are determined, the electronic device 110 can determine the distance from the image acquisition device 120 to the target object based on the target area. For example, the electronic device 110 can use the median depth of the target area in the depth map of the target object as the depth distance D of the target object, which is also the distance from the image acquisition device 120 to the target object. It should be understood that using the median depth of the target area as the depth distance D of the target object is only an example; in other embodiments, other values can be used as the depth distance D of the target object. For example, the average depth of the target area can be used as the depth distance D of the target object. It should be noted that, in this document, the median depth of the target area refers to a value where the depth in the target area is at the middle value.
[0037] It should be understood that the target area of the target object is the same or substantially the same in the depth map and the color map or grayscale map. Therefore, in some embodiments of this disclosure, the target area of the target object is determined based on the color map or grayscale map without performing target detection on the depth map to determine the target area.
[0038] It should also be understood that, in this disclosure, because it is used for micro-motion detection, the target region of the target object in the image is assumed or considered to be substantially unchanged. Therefore, in some embodiments of this disclosure, target detection and depth distance determination are performed only on the current frame image of the target object, and this operation is not performed on subsequent frame images. Exemplarily, the current frame image may be, for example, the first frame image or other suitable frame image. As an example, the current frame image may be the image corresponding to the frame before motion detection or optical flow calculation begins.
[0039] At box 220, electronic device 110 can determine the hyperparameters currently used to perform optical flow calculations based on the target region and distance. The hyperparameters include at least one of the following: number of feature points and size of optical flow window.
[0040] In this embodiment of the disclosure, in order to maintain the real-time advantage of sparse optical flow while achieving a balance between computational efficiency and effect, the hyperparameters used for optical flow calculation are adaptively adjusted based on the target region and the distance from the image acquisition device to the target object, so that the target object has a similar number of feature points (sampling points) and similar motion sensitivity under different distances and different target proportions.
[0041] Specifically, in this embodiment of the disclosure, after determining the target area where the target object is located, the electronic device 110 first determines the pixel ratio of the target area relative to the target object's image. For example, the pixel ratio of the target area can be based on the following formula (1).
[0042]
[0043] Where wh represents the size of the target region, and WH represents the size of the image of the target object.
[0044] Once the pixel ratio and the distance from the image acquisition device to the target object are determined, the electronic device 110 determines the hyperparameters currently used for performing optical flow calculations based on these parameters. For example, the hyperparameters can be adjusted based on the pixel ratio, the distance from the image acquisition device to the target object, a reference pixel ratio, and a reference distance to determine the current hyperparameters used for performing optical flow calculations. Exemplarily, the hyperparameters may include the number of feature points and the size of the optical flow window.
[0045] Regarding the number of feature points, since optical flow is based on sparse points, the number of feature points directly affects the accuracy of optical flow determination. In an image of the same size, the more feature points sampled, the smaller the motion that can be detected. Similarly, with the same number of optical flow feature points, the larger the proportion of the target object in the image, the more feature points can be hit on the target. In this embodiment, to ensure that regardless of the distance between the target object and the image acquisition device, and regardless of the proportion of the target object in the image, there is a similar number of sampling points on the target object, the number of feature points used for optical flow calculation can be adaptively adjusted based on the pixel ratio, the distance from the image acquisition device to the target object, and the reference pixel ratio and reference distance to determine the current number of feature points for optical flow calculation.
[0046] For example, the number of feature points is determined based on the following formula (2):
[0047]
[0048] Where maxCorners represents the number of feature points used to perform optical flow calculations, base_corners is the base number of feature points, and D base D represents the reference distance, and r represents the distance.base Indicates the reference ratio, r area This represents the pixel percentage of the target region relative to the image. For example, the reference distance can be set to 1, and the reference ratio can be set to 0.25. It should be understood that the values of the reference distance and reference ratio are merely exemplary, and any suitable values can be used as needed.
[0049] By determining the number of feature points using formula (2), the number of feature points can be increased when the image acquisition device is far from the target object or when the target object occupies a small proportion in the image, so as to ensure that the optical flow method can observe the movement of the target object in more subtle ways.
[0050] Regarding the size of the optical flow window, it affects the sensitivity of optical flow calculation. A smaller optical flow window results in higher sensitivity. Furthermore, due to perspective, the farther the target object is from the image acquisition device, the smaller the fluctuation in pixel changes in the image for the same amplitude of movement. Therefore, it is necessary to reduce the size of the optical flow window accordingly to improve the sensitivity of motion detection.
[0051] For example, the size of the optical flow window is determined based on the following formula (3).
[0052]
[0053] Where winSize represents the current optical flow window size, winSize base D represents the size of the basic optical flow window. base The reference distance is represented by D, where D represents the distance from the target object to the image acquisition device. For example, the reference distance can be set to 1. It should be understood that the value of the reference distance is merely exemplary and can be any suitable value as needed. winSize base You can make appropriate settings as needed.
[0054] The optical flow window size is determined by formula (3) above, ensuring that the window size increases when the target object is close to the image acquisition device and decreases when the target object is far from the image acquisition device. This ensures that the sensitivity of the optical flow method to the target object's motion remains consistent with distance.
[0055] In the embodiments of this disclosure, the hyperparameters used for optical flow calculation are dynamically adjusted based on the distance (D) between the target object and the image acquisition and the pixel ratio of the target object in the image, so that the image detection sensitivity can adapt to the change of the physical distance of the target object, thereby achieving a balance between computational efficiency and effect.
[0056] At box 230, electronic device 110 performs optical flow calculations on adjacent frame images after the current frame image acquired by the image acquisition device based on the hyperparameters currently used to perform the optical flow calculation, in order to determine the displacement of the target object in the adjacent frame images.
[0057] Once the hyperparameters used for optical flow calculation are determined, the electronic device 110 performs optical flow calculations on all preset feature points based on the hyperparameters used for optical flow calculation, and determines the displacement of all preset feature points; and determines the displacement of the target object in adjacent frame images based on the displacement of feature points within the preset region that satisfy preset conditions. It should be understood that the number of preset feature points is the number determined by the electronic device 110 based on formula (2). For example, corner points in the image can be used as preset feature points. For example, the preset region is the region obtained by expanding the target region outward by a preset proportion. For example, the region obtained by expanding the target region outward by 10% can be used as the preset region, which can be represented as [1.1w, 1.1h]. In this way, since the displacement of the target object is determined based on the target region, the interference of background motion on motion detection or determination can be largely eliminated.
[0058] In some embodiments of this disclosure, the displacement of the target object can be determined by the following process: first, sorting the displacements of feature points within a preset region; then, determining the displacement of the target object in adjacent frame images based on the average displacement of feature points whose displacements are ranked higher than the preset values.
[0059] For example, the displacement of a target object can be determined by calculating the average displacement of the feature points in the first 10% of the preset area.
[0060] At box 240, electronic device 110 can perform motion detection on a target object based on displacement. For example, electronic device 110 can perform motion detection on the target object based on a pixel movement threshold. Electronic device 110 can determine that the target object has moved in response to determining that the displacement exceeds the pixel movement threshold; or determine that the target object has not moved in response to determining that the displacement does not exceed the pixel movement threshold. That is, when the displacement of the target object exceeds the pixel movement threshold, electronic device 110 can determine that the target object has moved, for example, a micro-motion has occurred. When the displacement of the target object does not exceed the pixel movement threshold, electronic device 110 can determine that the target object has not moved, for example, no micro-motion has occurred.
[0061] Furthermore, in some embodiments of this disclosure, in order to ensure that the target object has the same pixel movement threshold at different distances, the electronic device 110 can dynamically adjust the pixel movement threshold based on the distance D between the target object and the image acquisition device. For example, the electronic device 110 can determine the current pixel movement threshold based on a predetermined physical movement threshold and the distance D.
[0062] For example, the pixel movement threshold is determined based on the following formula (4):
[0063]
[0064] Where T represents the pixel movement threshold, f represents the focal length of the image acquisition device, and Δx physical
[0065] This represents the predetermined physical movement threshold. By determining the pixel movement threshold using the above formula (4), the consistency of motion detection at different distances can be ensured.
[0066] The image inspection method proposed in this disclosure has the following advantages: First, to address the problem of inaccurate detection of distant targets, the feature point density of the target region is dynamically adjusted through a perspective projection compensation algorithm to ensure the resolvability of subtle limb movements. Second, a motion semantic separation technique is employed, using statistical analysis of the background optical flow vector field to construct a dynamic mask, thereby reducing the false alarm rate of non-target motion interference. This spatiotemporally adaptive computational paradigm achieves a balance between computational efficiency and performance while maintaining the real-time advantages of sparse optical flow.
[0067] Figure 3 A schematic structural block diagram of an apparatus for image acquisition according to certain embodiments of the present disclosure is shown.
[0068] like Figure 3 As shown, the device 300 includes an identification module 310, an adjustment module 320, a calculation module 330, and a detection module 340. The identification module 310 is configured to determine the target region of the target object in the current frame image acquired by the image acquisition device, as well as the distance from the image acquisition device to the target object, based on the target region and the distance. The adjustment module 320 is configured to determine the hyperparameters used for performing optical flow calculations based on the target region and the distance. The hyperparameters include at least one of the following: the number of feature points and the size of the optical flow window. The calculation module 330 is configured to perform optical flow calculations on adjacent frame images after the current frame image acquired by the image acquisition device based on the hyperparameters used for performing optical flow calculations, to determine the displacement of the target object in the adjacent frame images. The detection module 340 is configured to perform motion detection on the target object based on the displacement.
[0069] In some embodiments of this disclosure, the current frame image includes a grayscale image or a color image of the target object, and the recognition module 310 is further configured to perform target object detection on the grayscale image or color image of the target object to determine the target region where the target object is located in the grayscale image or color image.
[0070] In some embodiments of this disclosure, the current frame image includes a depth map of the target object, and the recognition module 310 is further configured to determine the distance from the image acquisition device to the target object based on the median depth within the target region of the depth map.
[0071] In some embodiments of this disclosure, the adjustment module 320 may also be configured to determine the pixel ratio of the target region relative to the current frame image based on the target region; and to determine the hyperparameters currently used to perform optical flow calculations based on the pixel ratio and distance.
[0072] In some embodiments of this disclosure, the adjustment module 320 may also be configured to, in response to determining a reference pixel percentage and a reference distance, and a reference hyperparameter; and to adjust the reference hyperparameter based on the pixel percentage and distance and the reference pixel percentage and reference distance, thereby determining the hyperparameter currently used to perform optical flow calculations.
[0073] In some embodiments of this disclosure, the calculation module 330 is also configured to determine the number of feature points based on formula (2).
[0074] In some embodiments of this disclosure, the calculation module 330 is also configured to determine the size of the optical flow window based on formula (3).
[0075] In some embodiments of this disclosure, the calculation module 330 is further configured to perform optical flow calculations on all preset feature points based on the hyperparameters currently used to perform optical flow calculations, and determine the displacement of all preset feature points; and to determine the displacement of the target object in adjacent frame images based on the displacement of feature points within a preset region that satisfy preset conditions.
[0076] In some embodiments of this disclosure, the preset region is the region obtained by expanding the target region outward by a preset ratio.
[0077] In some embodiments of this disclosure, the calculation module 330 is further configured to sort the displacements of feature points within a preset region; and to determine the displacement of the target object in the adjacent frame image based on the average displacement of feature points whose displacements precede those in the preset ranking.
[0078] In some embodiments of this disclosure, the detection module 340 is further configured to determine that the target object has moved in response to determining that the displacement exceeds the pixel movement threshold; or to determine that the target object has not moved in response to determining that the displacement does not exceed the pixel movement threshold.
[0079] In some embodiments of this disclosure, the detection module 340 is also configured to determine a pixel movement threshold based on a predetermined physical movement threshold and distance.
[0080] In some embodiments of this disclosure, the detection module 340 is also configured to determine a pixel movement threshold based on formula (4).
[0081] The units and / or modules included in device 300 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units and / or modules can be implemented using software and / or firmware, such as machine-executable instructions stored on a storage medium. In addition to or as an alternative to machine-executable instructions, some or all of the units and / or modules in device 300 can be implemented at least partially by one or more hardware logic components. By way of example and not limitation, exemplary types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0082] It should be understood that one or more steps in the above methods can be performed by suitable electronic devices or combinations of electronic devices. Such electronic devices or combinations of electronic devices may include, for example, […]. Figure 1 Electronic device 110.
[0083] Figure 4 A block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented is shown. It should be understood that... Figure 4 The electronic device 400 shown is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. Figure 4 The electronic device 400 shown can be used to achieve Figure 1 Electronic devices 110 or Figure 3 Device 300.
[0084] like Figure 4 As shown, electronic device 400 is in the form of a general-purpose electronic device. Components of electronic device 400 may include, but are not limited to, one or more processors or processing units 410, memory 420, storage device 430, one or more communication units 440, one or more input devices 450, and one or more output devices 460. Processing unit 410 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 420. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of electronic device 400.
[0085] Electronic device 400 typically includes multiple computer storage media. Such media can be any available media accessible to electronic device 400, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 420 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 430 can be removable or non-removable media and can include machine-readable media, such as flash drives, disks, or any other media that can be used to store information and / or data and can be accessed within electronic device 400.
[0086] Electronic device 400 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 4 As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 420 may include computer program product 425 having one or more program modules configured to perform various methods or actions of various embodiments of this disclosure.
[0087] Communication unit 440 enables communication with other electronic devices via a communication medium. Additionally, the functionality of components of electronic device 400 can be implemented using a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, electronic device 400 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0088] Input device 450 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 460 can be one or more output devices, such as a monitor, speaker, printer, etc. Electronic device 400 can also communicate with one or more external devices (not shown) via communication unit 440 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with electronic device 400, or with any device that enables electronic device 400 to communicate with one or more other electronic devices (e.g., network card, modem, etc.). Such communication can be performed via input / output (I / O) interface (not shown).
[0089] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above.
[0090] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0091] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0092] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0093] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0094] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A method for image detection, comprising: Based on the current frame image of the target object acquired by the image acquisition device, determine the target region where the target object is located in the current frame image and the distance from the image acquisition device to the target object; Based on the target region and the distance, the hyperparameters used to perform optical flow calculations are determined, and the hyperparameters include at least one of the following: the number of feature points and the size of the optical flow window; Optical flow calculations are performed on adjacent frames after the current frame image acquired by the image acquisition device based on the hyperparameters currently used to perform optical flow calculations, so as to determine the displacement of the target object in the adjacent frame images; as well as Motion detection of the target object is performed based on the displacement. The hyperparameters used to perform optical flow calculations, determined based on the target region and the distance, include: Based on the target region, determine the pixel percentage of the target region relative to the current frame image; and The hyperparameters used to perform optical flow calculations are determined based on the pixel ratio and the distance. The hyperparameters used to perform optical flow calculations, determined based on the pixel ratio and the distance, include: Determine the reference pixel percentage and reference distance, as well as the baseline hyperparameters; and The baseline hyperparameters are adjusted based on the pixel ratio and the distance, as well as the reference pixel ratio and the reference distance, to determine the current hyperparameters used for performing optical flow calculations. The motion detection of the target object based on the displacement includes: The pixel movement threshold is determined based on a predetermined physical movement threshold, the distance, and the focal length of the image acquisition device; In response to determining that the displacement exceeds the pixel movement threshold, it is determined that the target object has generated motion; or In response to determining that the displacement does not exceed the pixel movement threshold, it is determined that the target object has not moved.
2. The method according to claim 1, wherein the current frame image includes a grayscale image or a color image of the target object, and determining the target region where the target object is located in the current frame image includes: Target object detection is performed on the grayscale or color image of the target object to determine the target region where the target object is located in the grayscale or color image.
3. The method according to claim 1, wherein the current frame image includes a depth map of the target object, and determining the distance from the image acquisition device to the target object based on the target region includes: The distance from the image acquisition device to the target object is determined based on the median depth within the target area in the depth map.
4. The method of claim 1, wherein determining the hyperparameters currently used to perform optical flow calculations comprises: The number of basic feature points is adjusted based on the pixel ratio and the distance, as well as the reference pixel ratio and the reference distance, to determine the current number of feature points used to perform optical flow calculations.
5. The method of claim 1, wherein determining the hyperparameters currently used to perform optical flow calculations comprises: The size of the base optical flow window is adjusted based on the distance and the reference distance to determine the current optical flow window size used to perform optical flow calculations.
6. The method of claim 1, wherein performing optical flow calculation on adjacent frames after the current frame image acquired by the image acquisition device based on the hyperparameters currently used for performing optical flow calculation, to determine the displacement of the target object in the adjacent frame images, comprises: Based on the hyperparameters currently used to perform optical flow calculations, optical flow calculations are performed on all preset feature points to determine the displacement of all preset feature points; as well as The displacement of the target object in the adjacent frame image is determined based on the displacement of feature points within a preset region that satisfy preset conditions.
7. The method according to claim 6, wherein the preset region is a region obtained by expanding the target region outward by a preset proportion.
8. The method according to claim 6, wherein determining the displacement of the target object in the adjacent frame image based on the displacement of feature points within a preset region that satisfy preset conditions includes: Sort the displacements of feature points within the preset area; as well as The displacement of the target object in the adjacent frame image is determined based on the average displacement of the feature points whose displacement is ranked before the preset value.
9. An apparatus for image detection, comprising: The recognition module is configured to determine the target region where the target object is located in the current frame image of the target object acquired by the image acquisition device, as well as the distance from the image acquisition device to the target object; The adjustment module is configured to determine the hyperparameters currently used to perform optical flow calculations based on the target region and the distance, the hyperparameters including at least one of the following: number of feature points, optical flow window size; The calculation module is configured to perform optical flow calculations on adjacent frame images after the current frame image acquired by the image acquisition device based on the hyperparameters currently used to perform the optical flow calculation, so as to determine the displacement of the target object in the adjacent frame images; as well as The detection module is configured to perform motion detection on the target object based on the displacement. The adjustment module is further configured to determine, based on the target region, the pixel percentage of the target region relative to the current frame image; and to determine, based on the pixel percentage and the distance, the hyperparameters currently used for performing optical flow calculations. The adjustment module is further configured to determine a reference pixel percentage and a reference distance, as well as a baseline hyperparameter; and to adjust the baseline hyperparameter based on the pixel percentage and the distance, and the reference pixel percentage and the reference distance, thereby determining the hyperparameters currently used for performing optical flow calculations. The detection module is further configured to determine the pixel movement threshold based on a predetermined physical movement threshold, the distance, and the focal length of the image acquisition device; and to determine that the target object has moved in response to determining that the displacement exceeds the pixel movement threshold. Alternatively, in response to determining that the displacement does not exceed the pixel movement threshold, it can be determined that the target object has not moved.
10. An electronic device, characterized in that, The electronic device includes: At least one processing unit; and At least one memory, coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by a processor to implement the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, The computer program product is tangibly stored in a computer storage medium and includes computer-executable instructions that, when executed by a device, cause the device to perform the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for detecting position of mobile object, and computer product
US20070124060A1
KR20250056114A