Image detection method and device, equipment, storage medium and program product
By adaptively adjusting the hyperparameters of optical flow calculation and using motion semantic separation techniques, the problems of perception distortion and insufficient target recognition in complex motion scenes by sparse optical flow methods are solved, achieving efficient micro-motion detection and background interference suppression, and improving the accuracy and real-time performance of motion detection.
Patent Information
- Application Number
- CN202510912509.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-07-02
AI Technical Summary
Existing sparse optical flow methods suffer from perceptual distortion and insufficient moving target recognition capabilities in complex motion scenarios. In particular, when detecting distant targets, the feature point density is insufficient, making it difficult to capture micron-level motion displacements. Furthermore, the lack of a priori recognition mechanism for moving targets makes it impossible to distinguish between human motion and background interference, resulting in a decrease in the signal-to-noise ratio of motion signals.
By adaptively adjusting the hyperparameters of optical flow calculation, including the number of feature points and the size of the optical flow window, and dynamically adjusting them based on the target region and distance, it is possible to ensure that the target object has a similar number of feature points and motion sensitivity under different distances and target proportions. Combined with motion semantic separation technology, a dynamic mask is constructed to reduce background interference.
It achieves a balance between improving computational efficiency and detection effect while maintaining the real-time performance of sparse optical flow, adapts to changes in target distance, and improves the accuracy and anti-interference capability of micro-motion detection.
Smart Images

Figure CN120807589A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Example embodiments of the present disclosure generally relate to the field of image detection, and more particularly, to a method, an apparatus, an electronic device, a computer readable storage medium and a computer program product for image detection. BACKGROUND
[0002] Optical flow is a motion detection method based on the spatio-temporal characteristics of image sequences. The core principle is to establish the correspondence between consecutive images to calculate the motion information of objects by analyzing the temporal variation and inter-frame correlation of pixels between adjacent frames. As a standard paradigm in the field of motion detection, this method has been widely used in human motion perception, including biological feature analysis such as breath monitoring and gesture recognition. SUMMARY
[0003] In a first aspect of the present disclosure, a method for image detection is provided. The method comprises: determining a target region in which a target object is located in a current frame image of the target object acquired by an image acquisition device and a distance from the image acquisition device to the target object based on the current frame image. Determining the hyperparameters currently used 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, the size of the optical flow window. Performing optical flow calculation on the adjacent frame image 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 image. And performing motion detection on the target object based on the displacement.
[0004] In a second aspect of the present disclosure, an apparatus for image detection is provided. The apparatus comprises: an identification module configured to determine a target region in which a target object is located in a current frame image of the target object acquired by an image acquisition device and a distance from the image acquisition device to the target object based on the current frame image. An adjustment module configured to determine the hyperparameters currently used 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, the size of the optical flow window. A calculation module configured to perform optical flow calculation on the adjacent frame image 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 image. And a detection module configured to perform motion detection on the target object based on the displacement.
[0005] In a third aspect of the present 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. The instructions, when executed by the at least one processing unit, cause the electronic device to perform the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer readable storage medium is provided. The medium has stored thereon a computer program which, when executed by a processor, implements the method of the first aspect.
[0007] In a fifth aspect of the present disclosure, a computer program product is provided. The product comprises a computer program which, when executed by a processor, implements the method according to the first aspect of the present disclosure.
[0008] It should be understood that all statements herein made regarding the examples described in this section are intended to be illustrative of the key and important features of the embodiments of the present disclosure and it is not intended that the scope of the present disclosure be limited to such features. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0009] The above-mentioned and other features and advantages of various implementations of the present disclosure will become more apparent from the following description referring to the accompanying drawings. In the drawings, like reference numerals refer to like elements, wherein:
[0010] Figure 1 a schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;
[0011] Figure 2 a flowchart showing a method for image detection according to some embodiments of the present disclosure;
[0012] Figure 3 a schematic structural block diagram showing an apparatus for image detection according to certain embodiments of the present disclosure; and
[0013] Figure 4 a block diagram of a computing device in which one or more embodiments of the present disclosure can be implemented. DETAILED DESCRIPTION
[0014] Embodiments of the present disclosure will be described below in greater detail with reference to the accompanying drawings. While some embodiments of the present disclosure are illustrated in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be interpreted as being limited to the embodiments set forth herein; rather, these embodiments are provided so as to more completely and thoroughly understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are merely for illustrative purposes and should not be construed as limiting the scope of the present disclosure.
[0015] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, i.e., "including but not limited to." The term "based on" should be understood as "based at least in part 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 be included below.
[0016] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0017] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0018] For example, in response to receiving a user's active request, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information, so that the user can independently choose whether to provide personal information to the electronic device, application, server or storage medium and other software or hardware that performs the operation of the technical solution of the present disclosure based on the prompt message.
[0019] As an optional but non-limiting implementation, in response to receiving a user's active request, a prompt message may be sent to the user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. Furthermore, the pop-up window may also include a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0020] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the embodiments of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the embodiments of the present disclosure.
[0021] Figure 1 1 shows a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. Figure 1 As shown, the example environment 100 may include an electronic device 110 and an image acquisition device 120. The electronic device 110 may be deployed with a detection application 112.
[0022] In example environment 100, electronic device 110 can use detection application 112 to perform detection on images captured by image acquisition device 120, such as human body detection and motion detection. Exemplarily, detection application 112 may be one or more, for example, detection application 112 may include a human body recognition application, an optical flow calculation application, and a motion detection application. When one detection application 112 is included, detection application 112 may implement multiple functions such as human body recognition, optical flow calculation, and motion detection.
[0023] The image acquisition device 120 can be, for example, various cameras, video cameras, and other image acquisition devices. The image acquisition device 120 and the electronic device 110 communicate with each other, thereby sending the image acquired by the image acquisition device 120 to the electronic device 110 for detection. It should be understood that the image acquisition device 120 can exist independently of the electronic device 110 or can be integrated into the electronic device 110. For example, the image acquisition device 120 is an image acquisition device that the electronic device 110 itself has or is integrated with. Exemplarily, the image acquisition device 120 can be an RGBD camera device that can continuously acquire RGB images and depth maps of the target object.
[0024] The electronic device 110 may include any computing system with computing capabilities, such as various computing devices / systems, terminal devices, server devices, etc. The terminal device may be any type of mobile terminal, fixed terminal, or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a handheld computer, a portable game terminal, a VR / AR device, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device, or any combination thereof, including accessories and peripherals of these devices or any combination thereof.
[0025] The electronic device 110 may also be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. Server-side devices may include, for example, computing systems / servers such as mainframes, edge computing nodes, computing devices in a cloud environment, and the like.
[0026] It should be understood that the structure and function of the various elements in the environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of the present disclosure.
[0027] As briefly mentioned earlier, the optical flow method is a commonly used motion detection method. The outstanding advantage of this method lies in its adaptability to complex motion scenes. For example, when a motion scene lacks prior knowledge of a moving target (such as an unpredictable motion model or difficult-to-define target features), the detection accuracy of large displacement motion can be effectively improved by constructing a dense optical flow field combined with a pyramid layering algorithm. This pixel-level motion analysis mode shows high detection accuracy in both foreground segmentation and target tracking tasks, but the cost is the significant algorithm complexity that leads to large computational resource consumption and limited real-time processing performance.
[0028] To optimize the timeliness of the optical flow method, the current mainstream improvement scheme adopts a feature detection joint strategy: by extracting key feature points of an image to construct a sparse optical flow field, the operation efficiency can be improved by 1-2 orders of magnitude. Although sparse optical flow can greatly improve the operation efficiency by reducing the calculation density of feature points, it has two core defects: first, the sparse optical flow adopts a static feature point detection mechanism (fixed sampling number), which causes perception distortion when the distance of a target object changes - due to the perspective effect, a long-distance target object is spatially compressed, resulting in insufficient spatial density of feature points, making it difficult to capture micron-level motion displacement. Second, in the human motion detection scene, the pure optical flow driven scheme lacks a priori recognition mechanism of the moving target, and cannot distinguish between human motion and background interference (such as a floating curtain and moving scenery), resulting in a significant reduction in the signal-to-noise ratio of the motion signal. This technical limitation essentially reflects the inherent contradiction of the sparse optical flow framework: the conflict between the loss of feature point density brought by efficiency optimization and the requirement of complete motion perception. Especially in complex dynamic scenes, the fixed feature point strategy is difficult to adapt to changes in target size and lacks motion semantic understanding ability, resulting in a double attenuation of detection sensitivity and anti-interference ability in actual application. That is, this strategy faces the inherent limitation of uncontrollable spatial distribution of feature points, which may cause feature representation missing in the detection task of a specific moving target, resulting in a decrease in motion trajectory estimation accuracy. This trade-off between accuracy and efficiency constitutes a key optimization issue in the practical application of the optical flow method.
[0029] In view of this, embodiments of the present disclosure provide an improved solution for image detection. In the solution, based on a current frame image of a target object acquired by an image acquisition device, a target region in which the target object is located in the current frame image and a distance from the image acquisition device to the target object are determined. Based on the target region and the distance, a hyperparameter currently used to perform optical flow calculation is determined, the hyperparameter including at least one of: a number of feature points, a size of an optical flow window. Based on the hyperparameter currently used to perform optical flow calculation, optical flow calculation is performed on a neighboring frame image after the current frame image acquired by the image acquisition device to determine a displacement of the target object in the neighboring frame image. And motion detection is performed on the target object based on the displacement. In this way, in micro-motion detection, the balance between calculation efficiency and effect can be achieved while maintaining the real-time advantage of sparse optical flow.
[0030] Some example embodiments of the present disclosure will be described below with continued reference to the drawings.
[0031] Figure 2 A flowchart of a process 200 for image detection according to some embodiments of the present disclosure is shown. The process 200 can be implemented at the electronic device 110. For ease of discussion, the process 200 will be described with reference to the electronic device 110 of Figure 1
[0032] At block 210, the electronic device 110 can determine, based on a current frame image of a target object acquired by an image acquisition device 120, a target region in which the target object is located in the current frame image and a distance from the image acquisition device to the target object.
[0033] The image acquisition device 120 acquires images of the target object and sends them to the electronic device 110. The electronic device 110 performs image detection, such as motion detection, based on the images of the target object. As an example, in some embodiments of the present disclosure, the electronic device 110 performs micro-motion detection on the target object based on the images of the target object acquired by the image acquisition device 120. The target object may, for example, be a person, or an animal, or various targets. As an example, in some embodiments of the present disclosure, the target object is a person.
[0034] The images of the target object acquired by the image acquisition device 120 can include various types of images. In some embodiments of the present disclosure, the images of the target object can include grayscale images or color images, such as RGB images, of the target object. In some embodiments of the present disclosure, the images of the target object can also include depth maps of the target object, through which the distance (or depth) between the image acquisition device 120 and the target object can be acquired.
[0035] Taking human body detection as an example, after obtaining the grayscale image 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 body detection model or algorithm (for example, yolov11). After determining the target region where the target object is located, the electronic device 110 can crop the target region from the image of the target object based on the target region, thereby determining the size of the target region. Exemplarily, the focal length and the principal point of the image acquisition device 120 can be represented as f and (cx, cy) respectively. Assuming that the horizontal / width dimension and the height dimension of the image of the target object are set as 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 dimension and the height dimension of the target region respectively.
[0036] After determining the target region and its size, the electronic device 110 can determine the distance from the image acquisition device 120 to the target object based on the target region. Exemplarily, the electronic device 110 can take the median value of the depth in the target region in the depth map of the target object as the depth distance D of the target object, i.e., the distance from the image acquisition device 120 to the target object. It should be understood that taking the median value of the depth in the target region as the depth distance D of the target object is only an example, and in other embodiments, other values can also be taken as the depth distance D of the target object. For example, the average value of the depth in the target region is taken as the depth distance D of the target object. It should be noted that the median value of the depth in the target region in this document refers to the value of the depth in the target region that is in the middle value.
[0037] It should be understood that the target region of the target object in the depth map and the color image or the grayscale image is the same or substantially the same, so in some embodiments of the present disclosure, the target region of the target object is determined based on the color image or the grayscale image, without the need to perform target detection on the depth map to determine the target region.
[0038] It should also be understood that in the present disclosure, since micro-motion detection is used, the target region of the target object in the image is assumed or considered to be substantially unchanged, so in some embodiments of the present disclosure, only the current frame image of the target object is subjected to target detection and depth distance determination, and subsequent frame images are no longer subjected to this operation. Exemplarily, the current frame image can be the first frame image or other suitable frame image. As an example, the current frame image can be the image corresponding to the frame before the start of motion detection or optical flow calculation.
[0039] At block 220, the electronic device 110 can determine the hyperparameters currently used to perform 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, the optical flow window size.
[0040] In the embodiments of the present disclosure, in order to achieve a balance between computational efficiency and effect while maintaining the real-time advantage of sparse optical flow, 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 there are similar numbers of feature points (sampling points) and similar motion sensitivities on the target object under different distances and different target proportions.
[0041] Specifically, in the embodiments of the present disclosure, after determining the target region where the target object is located, the electronic device 110 first determines the pixel proportion of the target region relative to the image of the target object. Exemplarily, the pixel proportion of the target region 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] After determining the pixel proportion and the distance from the image acquisition device to the target object, the electronic device 110 determines the hyperparameters currently used for performing optical flow calculation based on the pixel proportion and the distance from the image acquisition device to the target object. For example, the hyperparameters currently used for performing optical flow calculation can be determined by adjusting the reference hyperparameters based on the pixel proportion and the distance from the image acquisition device to the target object and the reference pixel proportion and the reference distance. Exemplarily, the hyperparameters can include the number of feature points and the size of the optical flow window.
[0045] For the number of feature points, since the optical flow method based on sparse points, the number of feature points directly affects the accuracy of optical flow judgment. In the same size image, the more feature points sampled, the smaller the motion that can be observed. Similarly, for the same number of optical flow feature points, the larger the proportion of the target object in the image, the more feature points that can hit the target. In the embodiments of the present disclosure, in order to ensure that there are similar numbers of sampling points on the target object regardless of how far the target object is from the image acquisition device or how large the proportion of the target object occupying the image of the target object is, the number of feature points currently used for optical flow calculation can be adaptively adjusted based on the pixel proportion and the distance from the image acquisition device to the target object and the reference pixel proportion and the reference distance.
[0046] Exemplarily, the number of feature points is determined based on the following formula (2):
[0047]
[0048] where maxCorners represents the number of feature points used for performing optical flow calculation, base_corners is the basic number of feature points, D base represents the reference distance, D represents the distance, and rbase denotes a reference distance, D area denotes a reference scale, r base denotes a reference distance, D base denotes a reference distance, D base The reference distance and the reference scale can be set as needed.
[0049] The number of feature points is determined by formula (2), so that when the image acquisition device is far away from the target object, or the target object occupies a small proportion in the image, the number of feature points increases, so that the optical flow method can observe the more subtle movement of the target object.
[0050] For the size of the optical flow window, the size of the optical flow window affects the sensitivity of the optical flow calculation. The smaller the optical flow window, the higher the sensitivity of the optical flow calculation. And due to the existence of perspective relationship, the farther the distance between the target object and the image acquisition device, the smaller the pixel change in the image caused by the same amplitude of movement, so the size of the optical flow window needs to be adjusted correspondingly to improve the sensitivity of the movement judgment.
[0051] Exemplarily, the size of the optical flow window is determined based on the following formula (3).
[0052]
[0053] wherein winSize denotes the current size of the optical flow window, winSize base denotes a reference distance, D base denotes a reference distance, D base The reference distance and the reference scale can be set as needed.
[0054] The size of the optical flow window is determined by the above formula (3), so that when the target object is close to the image acquisition device, the size of the optical flow window will become larger. When the target object is far away from the image acquisition device, the size of the optical flow window will become smaller. In this way, the sensitivity of the optical flow method to the movement of the target object can be kept consistent with the change of the distance.
[0055] In the embodiments of the present disclosure, by dynamically adjusting the hyperparameters currently used for optical flow calculation based on the distance (D) between the target object and the image acquisition device and the pixel proportion of the target object in the image, the image detection sensitivity can adapt to the change of the physical distance of the target object, and the balance of the calculation efficiency and effect is realized.
[0056] At block 230, the electronic device 110 performs optical flow calculation on the adjacent frame image after the current frame image captured by the image capturing device based on the hyperparameters currently used for performing optical flow calculation to determine the displacement of the target object in the adjacent frame image.
[0057] When the hyperparameters currently used for performing optical flow calculation are determined, the electronic device 110 performs optical flow calculation on all preset feature points based on the hyperparameters currently used for performing optical flow calculation to determine the displacement of all preset feature points, and determines the displacement of the target object in the adjacent frame image based on the displacement of the feature points in the preset region that satisfy the preset condition. It should be understood that the number of preset feature points is the number determined by the electronic device 110 based on formula (2). Exemplarily, the corner points in the image can be used as the preset feature points. Exemplarily, the preset region is a 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 excluded.
[0058] In some embodiments of the present disclosure, the displacement of the target object can be determined by first sorting the displacement of the feature points in the preset region, and then determining the displacement of the target object in the adjacent frame image based on the average displacement of the feature points whose displacement is in the preset ranking.
[0059] Exemplarily, the displacement of the target object can be determined by calculating the average displacement of the feature points in the preset region whose displacement is in the top 10%.
[0060] At block 240, the electronic device 110 can perform motion detection on the target object based on the displacement. Exemplarily, the electronic device 110 can perform motion detection on the target object based on a pixel movement threshold. The electronic device 110 can determine that the target object has motion in response to determining that the displacement exceeds the pixel movement threshold, or determine that the target object has no motion 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, the electronic device 110 can determine that the target object has motion, for example, micro-motion. When the displacement of the target object does not exceed the pixel movement threshold, the electronic device 110 can determine that the target object has no motion, for example, no micro-motion.
[0061] Further, in some embodiments of the present disclosure, in order to ensure that the target object at different distances has the same pixel movement threshold, the electronic device 110 can dynamically adjust the pixel movement threshold based on the distance D between the target object and the image capturing 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] Exemplarily, 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, Δx physical
[0065] represents a predetermined physical movement threshold. By determining the pixel movement threshold through the above formula (4), the motion detection consistency at different distances can be ensured.
[0066] The method for image inspection proposed by the embodiments of the present disclosure has the following advantages: 1. For the detection misalignment problem of a long-distance target, the feature point density of the target region is dynamically adjusted through the perspective projection compensation algorithm, which ensures the solvability of micro-limb movement. 2. The motion semantic separation technology is adopted, and a dynamic mask is constructed through statistical analysis of the background optical flow vector field, thereby reducing the false alarm rate of non-target motion interference. This spatio-temporal adaptive computing paradigm balances the computational efficiency and effect while maintaining the real-time advantage 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] As Figure 3 shown, the apparatus 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, based on a current frame image of a target object acquired by an image acquisition device, a target region in which the target object is located in the current frame image and a distance from the image acquisition device to the target object. The adjustment module 320 is configured to determine, based on the target region and the distance, a hyperparameter currently used for performing optical flow calculation, the hyperparameter including at least one of the following: a number of feature points, an optical flow window size. The calculation module 330 is configured to perform optical flow calculation on a neighboring frame image after the current frame image acquired by the image acquisition device based on the hyperparameter currently used for performing optical flow calculation, to determine a displacement of the target object in the neighboring frame image. The detection module 340 is configured to perform motion detection on the target object based on the displacement.
[0069] In some embodiments of the present disclosure, the current frame image includes a grayscale image or a color image of the target object, and the identification module 310 is further configured to perform target object detection on the grayscale image or the color image of the target object to determine the target region in which the target object is located in the grayscale image or the color image.
[0070] In some embodiments of the present disclosure, the current frame image comprises a depth map of the target object, and the identifying module 310 is further configured to determine the distance from the image acquisition device to the target object based on a median value of the depth within the target region in the depth map.
[0071] In some embodiments of the present disclosure, the adjusting module 320 can be further configured to determine, based on the target region, a pixel ratio of the target region relative to the current frame image; and determine the hyperparameters currently used for performing the optical flow calculation based on the pixel ratio and the distance.
[0072] In some embodiments of the present disclosure, the adjusting module 320 can be further configured to determine, in response to determining the reference pixel ratio and the reference distance, the reference hyperparameters; and adjust the reference hyperparameters based on the pixel ratio and the distance and the reference pixel ratio and the reference distance, thereby determining the hyperparameters currently used for performing the optical flow calculation.
[0073] In some embodiments of the present disclosure, the calculating module 330 is further configured to determine the number of feature points based on formula (2).
[0074] In some embodiments of the present disclosure, the calculating module 330 is further configured to determine the size of the optical flow window based on formula (3).
[0075] In some embodiments of the present disclosure, the calculating module 330 is further configured to perform optical flow calculation on all the preset feature points based on the hyperparameters currently used for performing the optical flow calculation, determine the displacement of all the preset feature points; and determine the displacement of the target object in the adjacent frame image based on the displacement of the feature points within the preset region that satisfy the preset condition.
[0076] In some embodiments of the present disclosure, the preset region is a region obtained by expanding the target region outward by a preset proportion.
[0077] In some embodiments of the present disclosure, the calculating module 330 is further configured to sort the displacement of the feature points within the preset region; and determine the displacement of the target object in the adjacent frame image based on the mean value of the displacement of the feature points whose displacement is in a preset ranking.
[0078] In some embodiments of the present disclosure, the detecting module 340 is further configured to determine that the target object generates motion in response to determining that the displacement exceeds the pixel movement threshold; or determine that the target object does not generate motion in response to determining that the displacement does not exceed the pixel movement threshold.
[0079] In some embodiments of the present disclosure, the detecting module 340 is further configured to determine the pixel movement threshold based on a predetermined physical movement threshold and the distance.
[0080] In some embodiments of the disclosure, the detection module 340 is further configured to determine the pixel movement threshold based on equation (4).
[0081] The units and / or modules included in the apparatus 300 can be implemented utilizing various means 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, e.g., machine executable instructions stored on a storage medium. In addition to or alternatively, some or all of the units and / or modules in the apparatus 300 can be implemented at least partially by one or more hardware logic components. As an example and not by way of limitation, example 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), system-on-a-chip (SOCs), complex programmable logic devices (CPLDs), etc.
[0082] It should be understood that one or more steps in the above methods can be performed by an appropriate electronic device or combination of electronic devices. Such an electronic device or combination of electronic devices may, for example, include Figure 1 the electronic device 110 of
[0083] Figure 4 A block diagram of an electronic device 500 in which one or more embodiments of the disclosure can be implemented is shown. It should be understood that Figure 4 the electronic device 400 shown is merely an example 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 implement the electronic device 110 of Figure 1 or the apparatus 300 of Figure 3 .
[0084] As shown in Figure 4 , the electronic device 400 is in the form of a general electronic device. Components of the electronic device 400 can include, but are not limited to, one or more processors or processing units 410, a memory 420, a storage device 430, one or more communication units 440, one or more input devices 450, and one or more output devices 460. The processing units 410 can be actual or virtual processors and are capable of performing various processing according to programs stored in the memory 420. In a multi-processor system, multiple processing units perform computer-executable instructions in parallel to improve the parallel processing capability of the electronic device 400.
[0085] Electronic device 400 typically includes a plurality of computer storage media. Such media can be any available media that is located either internally or externally to electronic device 400, including, but not limited to, memory 420, removable storage 430, and / or non-removable storage 440. Storage media can include volatile, nonvolatile, removable, and / or non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules, or other data. Memory 420 can be a volatile memory (e.g., random access memory (RAM), cache, etc.), non-volatile memory (e.g., read only memory (ROM), Electrically Programmable Read Only Memory (EPROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory, etc.), or some combination thereof. Storage 430 can be a removable storage media and can include a machine readable medium, such as a flash drive, magnetic disk, or any other medium that can be used to store information and / or data and that can be accessed by electronic device 400.
[0086] Electronic device 400 can further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown, a disk drive and / or a CD drive can be provided for reading from or writing to a removable, non-removable, volatile, or non-volatile media such as a CD, DVD, or other media. In these cases, each drive can be connected to the bus (not shown) by one or more data media interfaces. Memory 420 can include a computer program product 425 having one or more program modules configured to carry out the various methods or actions of the various embodiments of the present disclosure. Figure 4
[0087] Communication unit 440 enables communications with other electronic devices over a communication medium. Additionally, the functionality of the components of electronic device 400 can be implemented in a single computing cluster or a plurality of computer machines that are capable of communicating with one another over a communication connection. As such, 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 nodes.
[0088] Input device 450 can be one or more input devices, such as a mouse, a keyboard, a trackball, etc. Output device 460 can be one or more output devices, such as a display, a speaker, a printer, etc. Electronic device 400 can also communicate with one or more external devices (not shown) such as a storage device, a display device, etc. through communication unit 440, with one or more devices that enable a user to interact with electronic device 400, or with any devices (e.g., a network card, a modem, etc.) that enable electronic device 400 to communicate with one or more other electronic devices. Such communication can be carried out via an input / output (I / O) interface (not shown).
[0089] According to an example implementation of the present disclosure, a computer readable storage medium is provided having computer executable instructions stored thereon, where the computer executable instructions are executed by a processor to implement the method described above. According to an example implementation of the present disclosure, a computer program product is also provided that is tangibly stored on a non-transitory computer readable medium and includes computer executable instructions, where the computer executable instructions are executed by a processor to implement the method described above.
[0090] The computer readable program instructions can also 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 apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0091] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium. The instructions stored on the computer readable storage medium can be used to program a computer, a programmable data processing apparatus, and / or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0092] The computer readable program instructions can also 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 apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0093] The computer program product of the present disclosure can have a signal including said computer program. This signal can be electronic, electromagnetic, optical, or any other suitable type of signal. Such a signal can be provided through a communication connection, such as electrical wiring, optical fiber, wireless interface, etc. Examples of computer program products include computer program implemented on a personal computer, server, or other networked device. A non-transitory computer readable medium, such as a floppy disk, CD-ROM, DVD-ROM, Blu-ray Disc, hard disk drive, or any other suitable non-transitory computer readable medium can store the computer program product.
[0094] Various implementations of the disclosure have been described in detail above. The foregoing description is exemplary and explanatory only, and is not intended to be exhaustive or to limit various implementations of the disclosure to the precise forms disclosed. Many modifications and variations are possible in light of the above teachings without departing from the scope and spirit of the disclosure. It is intended that the scope of the disclosure be limited only by the claims and the equivalents thereof. The use of the terms "including," "containing," "comprising," "having," "in involving," "portions," "elements," "components," "steps," "phases," "processes," "operations," "steps," "stages," "procedures," "methods," "mechanisms," "devices," "systems," "apparatuses," "units," "means," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "
Claims
1. A method for image detection, comprising: Based on a current frame image of the target object acquired by an image acquisition device, determining a target area where the target object is located in the current frame image and a distance from the image acquisition device to the target object; Determining a hyperparameter currently used to perform optical flow calculation based on the target area and the distance, the hyperparameter comprising 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 subsequent to the current frame image acquired by the image acquisition device based on the hyperparameters currently used to perform optical flow calculation, so as to determine the displacement of the target object in the adjacent frame images; as well as Motion detection is performed on the target object based on the displacement.
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 area where the target object is located in the current frame image comprises: Target object detection is performed on the grayscale image or color image of the target object to determine the target area where the target object is located in the grayscale image 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 area comprises: The distance from the image acquisition device to the target object is determined based on a median value of the depth within the target area in the depth map.
4. The method according to claim 1, wherein determining a hyperparameter currently used to perform optical flow calculation based on the target area and the distance comprises: Based on the target area, determining a pixel ratio of the target area relative to the current frame image; as well as A hyperparameter currently used to perform optical flow calculation is determined based on the pixel ratio and the distance.
5. The method according to claim 4, wherein determining a hyperparameter currently used to perform optical flow calculation based on the pixel ratio and the distance comprises: Determine the reference pixel ratio and reference distance, as well as the benchmark hyperparameters; as well as The benchmark hyperparameters are adjusted based on the pixel ratio and the distance as well as the reference pixel ratio and the reference distance, thereby determining the hyperparameters currently used to perform optical flow calculation.
6. The method according to claim 5, wherein determining the hyperparameters currently used to perform the optical flow calculation 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, thereby determining the number of feature points currently used to perform optical flow calculation.
7. The method according to claim 5, wherein determining the hyperparameters currently used to perform optical flow calculation comprises: The basic optical flow window size is adjusted based on the distance and the reference distance, thereby determining a current optical flow window size currently used to perform optical flow calculation.
8. The method according to claim 1, wherein performing optical flow calculation on adjacent frame images subsequent to the current frame image acquired by the image acquisition device based on the hyperparameters currently used to perform optical flow calculation to determine the displacement of the target object in the adjacent frame images comprises: Performing optical flow calculation on all preset feature points based on the hyperparameters currently used to perform optical flow calculation, and determining the displacement of all preset feature points; as well as The displacement of the target object in the adjacent frame images is determined based on the displacement of the feature point within the preset area whose displacement meets the preset conditions. 9 . The method according to claim 8 , wherein the preset area is an area obtained by expanding the target area outward by a preset proportion.
10. The method according to claim 8, wherein determining the displacement of the target object in the adjacent frame images based on the displacement of the feature point within the preset area whose displacement meets a preset condition comprises: Sorting the displacements of the feature points within the preset area; as well as The displacement of the target object in the adjacent frame images is determined based on an average of the displacements of the feature points whose displacements are before a preset ranking.
11. The method according to claim 1 , wherein performing motion detection on the target object based on the displacement comprises: In response to determining that the displacement exceeds a pixel movement threshold, determining that the target object has moved; 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.
12. The method according to claim 11, wherein performing motion detection on the target object based on the displacement further comprises: The pixel movement threshold is determined based on a predetermined physical movement threshold, the distance, and a focal length of the image acquisition device.
13. A device for image detection, comprising: a recognition module configured to determine, based on a current frame image of the target object acquired by an image acquisition device, a target area where the target object is located in the current frame image and a distance from the image acquisition device to the target object; An adjustment module is configured to determine a hyperparameter currently used to perform optical flow calculation based on the target area and the distance, wherein the hyperparameter includes 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 calculation on adjacent frame images subsequent to the current frame image acquired by the image acquisition device based on the hyperparameters currently used to perform optical flow calculation, so as to determine the displacement of the target object in the adjacent frame images; as well as A detection module is configured to perform motion detection on the target object based on the displacement.
14. An electronic device, characterized in that: The electronic device comprises: 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, the instructions causing the electronic device to perform the method according to any one of claims 1 to 12 when executed by the at least one processing unit.
15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the method according to any one of claims 1 to 12.
16. A computer program product, characterized in that The computer program product is tangibly stored in a computer storage medium and comprises computer-executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Target detection method, apparatus and device, and readable medium
CN119445078A
Method and device for detecting position of mobile object, and computer product
US20070124060A1
Image processing method, terminal, and storage medium
WO2019042404A1
KR20250056114A