A target searching method, device, apparatus and medium
By identifying regions with equal and adjacent pixel values as initial regions in the optical flow map, and incorporating neighboring regions into the initial regions according to a set gradient threshold range, the problem of poor target object search performance in the optical flow map is solved, and the search accuracy is improved.
Patent Information
- Application Number
- CN202310755538.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2043-06-21
AI Technical Summary
The existing technology for searching for target objects from optical flow maps is very ineffective.
The region where the target object is located is determined by identifying regions with equal and adjacent pixel values in the optical flow map as the initial region, and then incorporating neighboring regions into the initial region according to a set gradient threshold range.
It improves the accuracy of searching for both rigid and non-rigid objects, and enhances the search performance for target objects.
Smart Images

Figure CN116740147B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of target search technology, and in particular to a target search method, apparatus, device and medium. Background Technology
[0002] In an optical flow diagram, the pixel values of moving objects differ from those of non-moving objects in the background. Furthermore, the pixel values of different moving objects within the same optical flow diagram also vary significantly. This principle can be used to search for target objects within the optical flow diagram.
[0003] However, the existing technology has poor performance in searching for target objects from optical flow maps. Summary of the Invention
[0004] The main purpose of this application is to provide a target search method, apparatus, device and medium, which aims to solve the technical problem that the effect of searching for target objects from optical flow diagrams in the prior art is very poor.
[0005] To achieve the above objectives, the first aspect of this application provides a target search method, the method comprising:
[0006] Obtain optical flow maps;
[0007] Based on the pixel values of each pixel in the optical flow map, the region consisting of adjacent pixels with equal pixel values is determined as an initial region.
[0008] For each initial region, based on the pixel value of the initial region, the regions located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region are determined as neighboring regions;
[0009] The adjacent regions are incorporated into the initial region, and the adjusted initial region is determined as the region where the target object is located.
[0010] Optionally, before the step of determining an initial region composed of adjacent pixels with equal pixel values based on the pixel values of each pixel in the optical flow map, the method further includes:
[0011] Statistically analyze the frequency of occurrence of different pixel values in each pixel of the optical flow map;
[0012] The step of determining an initial region by identifying adjacent pixels with equal pixel values based on the pixel values of each pixel in the optical flow map includes:
[0013] For each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the region consisting of pixels whose pixel value is equal to the target pixel value and whose position is adjacent is determined as an initial region.
[0014] Optionally, before the step of determining an initial region consisting of pixels whose pixel value is equal to and adjacent to the target pixel value for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the method further includes:
[0015] Based on the frequency of occurrence of different pixel values in the optical flow map, the background in the optical flow map is excluded;
[0016] The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, where the region consisting of pixels whose pixel value is equal to the target pixel value and whose positions are adjacent to it, includes:
[0017] Based on the optical flow map after excluding the background, for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the region composed of pixels whose pixel value is equal to the target pixel value and whose position is adjacent is determined as an initial region.
[0018] Optionally, before the step of determining an initial region consisting of pixels whose pixel value is equal to and adjacent to the target pixel value for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the method further includes:
[0019] The frequency of occurrence of different pixel values in the optical flow map is sorted from largest to smallest.
[0020] The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, where the region consisting of pixels whose pixel value is equal to the target pixel value and whose positions are adjacent to it, includes:
[0021] For each target pixel value whose occurrence frequency is greater than a preset frequency threshold after sorting, the region consisting of pixels whose pixel value is equal to the target pixel value and whose position is adjacent is determined as an initial region.
[0022] Optionally, the step of determining an initial region consisting of pixels whose pixel values are equal to and adjacent to each target pixel value whose occurrence frequency is greater than a preset frequency threshold includes:
[0023] The frequency of occurrence of different pixel values in the optical flow map is traversed to obtain the coordinates of the pixel corresponding to each target pixel value that is greater than a preset frequency threshold;
[0024] An initial region is defined as the region whose area is greater than the area threshold, consisting of pixels with adjacent coordinates and pixel values equal to the target pixel value.
[0025] Optionally, the step of determining, for each initial region, regions located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region as neighboring regions, based on the pixel value of the initial region, includes:
[0026] Obtain the centroid of each initial region and the centroid of the regions surrounding the initial region; wherein the centroid of the initial region is the mean of all pixel coordinates within the initial region, and the centroid of the regions surrounding the initial region is the mean of all pixel coordinates in the regions surrounding the initial region;
[0027] Based on the centroid of the initial region and the centroid of the regions surrounding the initial region, the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region is obtained;
[0028] The region surrounding the initial region whose maximum absolute value of the gradient is less than a set gradient threshold is defined as the neighboring region.
[0029] Optionally, the step of obtaining the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region based on the centroid of the initial region and the centroid of the regions surrounding the initial region includes:
[0030] Based on the centroid of the initial region and the centroid of the region surrounding the initial region, obtain the equation of the straight line between the centroid of the initial region and the centroid of the region surrounding the initial region;
[0031] Based on the equation of the line, the absolute values of several gradients between the initial region and the regions surrounding the initial region are obtained;
[0032] Based on the absolute values of the aforementioned gradients, the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region is obtained.
[0033] Secondly, this application provides a target search device, the device comprising:
[0034] The acquisition module is used to acquire optical flow maps;
[0035] The first determining module is used to determine an initial region based on the pixel values of each pixel in the optical flow map, and to identify a region composed of adjacent pixels with equal pixel values.
[0036] The second determining module is used to determine, for each initial region, regions located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region as neighboring regions based on the pixel value of the initial region.
[0037] The third determining module is used to incorporate the neighboring region into the initial region and determine the adjusted initial region as the region where the target object is located.
[0038] Thirdly, this application provides an electronic device, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by the processor, they implement the target search method provided in this application.
[0039] Fourthly, this application provides a machine-readable storage medium storing machine-executable instructions, which, when executed by one or more processors, implement the target search method provided in this application.
[0040] Through the above technical solution, this application has at least the following beneficial effects:
[0041] This application proposes a target search method, apparatus, device, and medium. By focusing on the pixel values of each pixel in an optical flow diagram, an initial region is defined as a region consisting of adjacent pixels with equal pixel values. Then, for each initial region, based on its pixel values, a neighboring region is defined as a region whose pixel value variation compared to the initial region falls within a set gradient threshold range. This neighboring region is then incorporated into the initial region, and the adjusted initial region is determined as the region where the target object is located. Thus, based on the principle that pixels of the same object in the optical flow diagram have similar pixel values, by setting the gradient threshold range as a condition for filtering regions surrounding the initial region, regions corresponding to pixels with similar pixel values around the initial region can be more accurately incorporated into the initial region. This improves the accuracy of finding rigid or non-rigid objects, thereby enhancing the effectiveness of target object retrieval. Attached Figure Description
[0042] Figure 1 A flowchart illustrating a target search method provided in an embodiment of this application;
[0043] Figure 2 A schematic diagram of a dense optical flow map provided in an embodiment of this application;
[0044] Figure 3 A flowchart illustrating a specific execution method for step S12 provided in an embodiment of this application;
[0045] Figure 4 A flowchart illustrating a specific execution method for step S122 provided in an embodiment of this application;
[0046] Figure 5 This is a schematic diagram of the electronic device structure of the hardware operating environment involved in the embodiments of this application;
[0047] Figure 6 This is a schematic diagram of a target search device provided in an embodiment of this application.
[0048] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0049] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0050] There are two types of methods for generating optical flow maps: traditional methods and deep learning methods. Currently, the main methods for searching for target objects in optical flow maps include: direct thresholding, which involves directly finding different thresholds to binarize the color map. This works well for rigid objects, but for non-rigid objects, the pixel values in dense optical flow maps vary greatly due to the different motion speeds of different parts, resulting in poor performance.
[0051] Based on the above technical issues, please refer to Figure 1 The embodiments of this application provide a target search method, and the various steps of the method are described in detail below. The method includes:
[0052] S10: Obtain the optical flow map.
[0053] In this embodiment, optical flow is the instantaneous velocity of pixels moving on the imaging plane of a spatially moving object. It's a method that uses the temporal changes of pixels in an image sequence and the correlation between adjacent frames to find the correspondence between the previous and current frames, thereby calculating the motion information of objects between adjacent frames. Dense optical flow is an image registration method that performs point-by-point matching. Unlike sparse optical flow, which only targets a few feature points in an image, dense optical flow calculates the offset of all points in the image, thus forming a dense optical flow field. This dense optical flow field allows for pixel-level image registration, resulting in significantly better registration performance than sparse optical flow registration. Please refer to [reference needed]. Figure 2 , Figure 2 This is a schematic diagram of a dense optical flow map provided in an embodiment of this application. The optical flow map in this application mainly refers to a dense optical flow map. The optical flow map can be obtained by inputting video data into a deep learning model (such as MaskFlowNet). The pixel values of the pixels of moving objects in the optical flow map are different from the pixel values of the pixels of non-moving objects in the background, and the pixel values of the pixels of different moving objects in the same optical flow map also have significant differences. Using this principle, target objects can be searched from the optical flow map.
[0054] S11: Based on the pixel values of each pixel in the optical flow diagram, the region consisting of adjacent pixels with equal pixel values is determined as an initial region.
[0055] In this embodiment, the pixel values of the pixels of each object in the optical flow map may be different, and the same object is continuous in the optical flow map. Based on this principle, the region composed of pixels with equal and adjacent pixel values in the optical flow map is determined as an initial region, thus obtaining several initial regions in the optical flow map.
[0056] S12: For each initial region, based on the pixel value of the initial region, the region located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region is determined as a neighboring region.
[0057] In this embodiment, the set gradient threshold range is the range of pixel values gradient between a pre-preset initial region and the regions surrounding the initial region. For example, the gradient threshold can be set to 10. "Within the set gradient threshold range" means that the gradient of pixel values between the initial region and the regions surrounding the initial region is less than the set gradient threshold. This gradient threshold can be set according to the characteristics of the target object. For example, if the target object is a rigid object, since the pixel values of the pixels in different parts of a rigid object are not significantly different, the gradient threshold for the target object can be set relatively small. If the target object is a non-rigid object, since the pixel values of the pixels in different parts of a non-rigid object are significantly different, the gradient threshold for the target object can be set relatively large. Since the motion speed of different parts of the same object may be constant, the pixel values of the pixels of the same object in the optical flow map may be different, but the amount of change in the pixel values of the pixels of the same object in the optical flow map will be within a certain range. Therefore, the regions surrounding the initial region whose pixel value changes within the set gradient threshold range compared to the initial region are determined as neighboring regions. Thus, the same initial region may have several neighboring regions.
[0058] S13: Incorporate the neighboring region into the initial region, and determine the adjusted initial region as the region where the target object is located.
[0059] In this embodiment, the target object is the object to be searched from the optical flow map. The target object is a moving object, and it can be a rigid object or a non-rigid object. Since the gradient of pixel values between the initial region and the neighboring regions is within a set gradient threshold range, the pixel values of the pixels in the neighboring regions and the initial region are relatively close. The pixel values of the same object in the optical flow map are also relatively close. Therefore, the neighboring regions are merged into the corresponding initial region, and the adjusted initial region is determined as the region where the target object is located.
[0060] Based on the above technical solution, in this embodiment, when searching for a target object in the optical flow map, the pixel values of each pixel in the optical flow map are used as the research object. A region consisting of adjacent pixels with equal pixel values is determined as an initial region. Then, for each initial region, based on the pixel values of that initial region, regions surrounding that initial region whose pixel values differ from those of the initial region within a set gradient threshold range are determined as neighboring regions. These neighboring regions are then incorporated into the initial region, and the adjusted initial region is determined as the region where the target object is located. Thus, based on the principle that pixels of the same object in the optical flow map have similar pixel values, by setting the gradient threshold range as a condition for filtering regions surrounding the initial region, regions corresponding to pixels with similar pixel values around the initial region can be more accurately incorporated into the initial region. This improves the accuracy of finding rigid or non-rigid objects, thereby enhancing the effect of finding the target object.
[0061] In one possible implementation, before the step of determining an initial region composed of pixels with equal and adjacent pixel values based on the pixel values of each pixel in the optical flow map, the method further includes: counting the frequency of occurrence of different pixel values in each pixel of the optical flow map.
[0062] The step of determining an initial region by identifying a region composed of pixels with equal and adjacent pixel values based on the pixel values of each pixel in the optical flow map includes: for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, identifying an initial region composed of pixels whose pixel values are equal to the target pixel value and whose positions are adjacent.
[0063] In this embodiment, the frequency of occurrence refers to the number of times different pixel values appear in each pixel of the optical flow map. The preset frequency threshold is a threshold for the number of times different pixel values appear in the optical flow map. This frequency threshold can be set based on the characteristics of the target object. The frequency of occurrence of the pixel value can represent the area of the pixel-composed region in the optical flow map. For example, the pixel area corresponding to the frequency threshold can be set to 60x60, i.e., 3600.
[0064] Before determining the initial regions in the optical flow map, the frequency of occurrence of different pixel values in each pixel of the optical flow map is statistically analyzed. Specifically, the frequency of occurrence of different pixel values in each pixel of the optical flow map can be analyzed using a histogram. Then, the frequency of occurrence of the statistically analyzed pixel values is compared with a preset frequency threshold. If the frequency of occurrence of a pixel value is greater than the preset frequency threshold, then the pixel value of that pixel is taken as the target pixel value. In this way, several target pixel values can be obtained, and the regions formed by pixels in the optical flow map whose pixel values are equal to the target pixel values and whose positions are adjacent are determined as an initial region. Thus, several target pixel values will have several initial regions.
[0065] Therefore, by statistically analyzing the frequency of different pixel values in the optical flow map, it becomes easier to compare the frequency of pixel values in the optical flow map with a preset frequency threshold. This allows for more efficient acquisition of target pixel values greater than the preset frequency threshold, thus leading to a more efficient initial region. By using the preset frequency threshold as a comparison benchmark, regions corresponding to pixels in the optical flow map whose pixel values occur less frequently than the preset frequency threshold can be excluded. This allows for a more accurate identification of the initial region in the optical flow map, ultimately leading to a more accurate search for the target object's region.
[0066] In one possible implementation, before the step of determining an initial region consisting of pixels whose pixel value is equal to the target pixel value and whose position is adjacent to it for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the method further includes: excluding the background in the optical flow map based on the occurrence frequency of different pixel values in the optical flow map.
[0067] The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold and whose pixel value is equal to the target pixel value and whose position is adjacent includes: based on the optical flow map after excluding the background, determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold and whose pixel value is equal to the target pixel value and whose position is adjacent.
[0068] In this embodiment, since the background in the optical flow map is not part of the target object to be searched, it is first excluded. Specifically, the background in the optical flow map can be excluded based on the frequency of occurrence of different pixel values, or, if the pixel values of the background pixels are known, the background in the optical flow map can be excluded based on those pixel values. After excluding the background, the initial region is obtained by comparing the frequency of occurrence of pixel values in the optical flow map with a preset frequency threshold. Thus, excluding the background in the optical flow map reduces the computational load of comparing with the preset frequency threshold, thereby improving the efficiency of determining the initial region.
[0069] In one possible implementation, before the step of determining an initial region consisting of pixels whose pixel values are equal to and adjacent to the target pixel value for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the method further includes: sorting the occurrence frequencies of different pixel values in the optical flow map from largest to smallest.
[0070] The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold and whose pixel value is equal to the target pixel value and whose position is adjacent includes: for each target pixel value whose occurrence frequency is greater than a preset frequency threshold after sorting, determining an initial region for the region whose pixel value is equal to the target pixel value and whose position is adjacent.
[0071] In this embodiment, before determining the initial region, the occurrence frequency of different pixel values in the optical flow map is sorted from largest to smallest. Then, the pixel values are compared with a preset frequency threshold in descending order of occurrence frequency. Since the higher the occurrence frequency of a pixel value, the larger the area of the region composed of the corresponding pixel, by sorting the occurrence frequency of different pixel values in the optical flow map from largest to smallest, a relatively larger initial region can be found first. If the area of the target object being searched is relatively large, the region of the target object can be found more quickly.
[0072] In one possible implementation, the step of determining an initial region consisting of pixels whose pixel value is equal to and adjacent to the target pixel value for each target pixel value whose occurrence frequency is greater than a preset frequency threshold includes:
[0073] Step 1: Traverse the occurrence frequency of different pixel values in the optical flow map to obtain the coordinates of the pixel corresponding to each target pixel value that is greater than a preset frequency threshold.
[0074] In this embodiment, the frequency of occurrence of different pixel values in the optical flow map is compared with a preset frequency threshold by traversing the data, and the coordinates of the pixel corresponding to each target pixel value greater than the preset frequency threshold are obtained sequentially. This traversal method ensures that the frequency of occurrence of each pixel value in the optical flow map is compared with the preset frequency threshold, thus preventing omissions and increasing the reliability of searching for the target object region.
[0075] Step 2: Determine an initial region as the area of a region consisting of pixels with adjacent coordinates and pixel values equal to the target pixel value that is greater than the area threshold.
[0076] In this embodiment, the area threshold is a pre-set area of a region composed of several pixels with the same pixel value. The area threshold can be set according to the area of the region composed of pixels of the target object. For example, the area threshold can be set to half the area of the region composed of several pixels corresponding to a preset frequency threshold. After obtaining several target pixel values of pixels in the optical flow map, the area of the region composed of pixels with adjacent coordinates and pixel values equal to the target pixel value is compared with the area threshold. The region with an area greater than the area threshold is determined as an initial region. In this way, by filtering the regions composed of pixels with each target pixel value through the area threshold, the filtered region is used as the initial region, thus increasing the probability that the initial region obtained is a part of the target object, thereby enabling a more accurate search for the region where the target object is located in the optical flow map.
[0077] In one possible implementation, please refer to Figure 3 The step of determining, for each initial region, regions surrounding the initial region whose pixel values change within a set gradient threshold range compared to the initial region as neighboring regions, based on the pixel values of the initial region, includes:
[0078] S121: Obtain the centroid of each initial region and the centroid of the region surrounding the initial region; wherein the centroid of the initial region is the mean of all pixel coordinates within the initial region, and the centroid of the region surrounding the initial region is the mean of all pixel coordinates in the region surrounding the initial region.
[0079] In this embodiment, based on each initial region, multiple regions surrounding that initial region are obtained. Then, the average value of all pixel coordinates within each initial region is obtained, and this average value is used as the coordinates of the centroid of that initial region. Additionally, the average value of all pixel coordinates within each initial region's surrounding regions is obtained, and this average value is used as the coordinates of the centroid of the regions surrounding that initial region. For example, the initial region is denoted as G. i (i = 1, ...,), let R be the centroid of the initial region. i (i = 1, ...,), the centroid G_New of the region surrounding the initial region corresponding to the initial region. j (j=1,...,), where i represents the i-th initial region and j represents the j-th surrounding region of the initial region.
[0080] S122: Based on the centroid of the initial region and the centroid of the regions surrounding the initial region, obtain the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region.
[0081] In this embodiment, after obtaining the centroid of the initial region and the centroid of the region surrounding the initial region, several pixel gradients of the centroid of the initial region and the centroid of the surrounding region corresponding to the initial region can be obtained respectively, and the maximum absolute value of the several pixel gradients can be obtained.
[0082] S123: The region surrounding the initial region where the maximum absolute value of the gradient is less than the set gradient threshold is determined as the neighboring region.
[0083] In this embodiment, after obtaining the maximum absolute value of the pixels of the centroid of the initial region and the centroid of the surrounding region corresponding to the initial region, the maximum absolute value is compared with a set gradient threshold, and the region surrounding the initial region whose maximum absolute value is less than the set gradient threshold is determined as the neighboring region.
[0084] In this embodiment, the pixel gradient between the centroid of the initial region and the surrounding region corresponding to the initial region represents the degree of difference between the pixel values of the pixels in the initial region and the pixel values of the pixels in the surrounding region corresponding to the initial region. By comparing the maximum threshold of the pixels at the centroid of the initial region and the centroid of the surrounding region corresponding to the initial region with a preset gradient threshold, regions with large differences between the pixel values and the initial region can be excluded. Since the pixel value differences of the pixels in different parts of the target object will be within a certain range, the neighboring regions corresponding to the initial region can be obtained more accurately, which can ultimately improve the effect of searching for the target object in the region of the optical flow map.
[0085] In one possible implementation, please refer to Figure 4 The step of obtaining the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region based on the centroid of the initial region and the centroid of the regions surrounding the initial region includes:
[0086] S1221: Based on the centroid of the initial region and the centroid of the region surrounding the initial region, obtain the linear equation between the centroid of the initial region and the centroid of the region surrounding the initial region.
[0087] In this embodiment, by calculating the equation of a straight line from two points, the equation of a straight line between the centroid of the initial region and the centroid of the region surrounding the initial region can be obtained, and the pixel values of the pixels corresponding to the coordinates through which the straight line equation passes can be arranged into an array in order.
[0088] S1222: Based on the equation of the line, obtain the absolute values of several gradients between the initial region and the region surrounding the initial region.
[0089] In this embodiment, based on the linear equation, several gradients between the initial region and the neighboring region are obtained using the following formula:
[0090]
[0091] Among them, Grad ji [k] represents the gradient between the i-th initial region and the j-th surrounding region on the k-th coordinate of the linear equation; P k P represents the pixel value at the k-th coordinate on the equation of the line. k-1 d(k,k-1) represents the pixel value of the (k-1)th coordinate on the equation of the line; d(k,k-1) represents the distance between the kth and (k-1)th coordinates on the equation of the line.
[0092] After obtaining several pixel gradients of the initial region and the pixels of the surrounding region, the absolute values of the corresponding pixel gradients can be obtained.
[0093] S1223: Based on the absolute values of the several gradients, obtain the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region.
[0094] In this embodiment, after obtaining the absolute values of several pixel gradients of the pixels in the initial region and the surrounding region of the initial region, the maximum absolute value of the corresponding several pixel gradients can be obtained.
[0095] This embodiment uses the centroid of the initial region and the centroid of the region surrounding the initial region to determine a straight line, which can more accurately obtain the degree of change in pixel values between the initial region and the region surrounding the initial region, thereby more accurately obtaining the maximum absolute value of the gradient between the initial region and the region surrounding the initial region.
[0096] Furthermore, merging neighboring regions into the initial region yields a new initial region. This new initial region can then generate several new neighboring regions using the same method, which are then merged into the new initial region, and so on, until the initial region can no longer generate neighboring regions. At this point, the adjusted initial region is closer to the target object's region. Finally, a bounding box is used to enclose the target object's region, i.e.:
[0097] Box n =[min(R) n [0]), min(R) n [1]), max(R) n [0]), max(R) n [1])]
[0098] Among them, Box n R represents the bounding box of the nth target object. n[0] represents the coordinate values of all x-coordinates of the nth target object, R n [1] Describes the coordinate values of all y-coordinates of the nth target object, min(R n [0]) represents the minimum coordinate value of the bounding box of the nth target object on the x-axis, min(R) n [1]) represents the minimum coordinate value of the bounding box of the nth target object on the y-axis, max(R) n [0]) represents the maximum coordinate value of the bounding box of the nth target object on the x-axis, max(R n [1]) represents the maximum coordinate value of the bounding box of the nth target object on the y-axis.
[0099] This embodiment also provides an electronic device that can be used to run or implement the target detection method provided in this embodiment. The electronic device may include a device with image processing capabilities, such as a server, a personal computer, a laptop computer, etc.
[0100] Please refer to Figure 5 A schematic diagram of the electronic device 100, which includes a target search device 110, a machine-readable storage medium 120, and a processor 130.
[0101] The machine-readable storage medium 120 and processor 130 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The target search device 110 includes at least one software function module that can be stored in the machine-readable storage medium 120 in the form of software or firmware or embedded in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the machine-readable storage medium 120, such as the software function modules and computer programs included in the target search device 110.
[0102] The machine-readable storage medium 120 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The machine-readable storage medium 120 is used to store a program, and the processor 130 executes the program / the target detection method provided in this embodiment after receiving an execution instruction.
[0103] The processor 130 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application-Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.
[0104] In another embodiment, please refer to Figure 6 Based on the same inventive concept as the foregoing embodiments, embodiments of this application also provide a target search device 110, which includes at least one functional module that can be stored in a machine-readable storage medium 120 in software form. Functionally, the device includes:
[0105] Module 111 is used to acquire optical flow maps.
[0106] The first determining module 112 is used to determine an initial region based on the pixel values of each pixel in the optical flow map, and to determine the region composed of adjacent pixels with equal pixel values.
[0107] The second determining module 113 is used to determine, for each initial region, regions located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region as neighboring regions based on the pixel value of the initial region.
[0108] The third determining module 114 is used to incorporate the neighboring region into the initial region and determine the adjusted initial region as the region where the target object is located.
[0109] It should be noted that each module in the target search device 110 in this embodiment corresponds one-to-one with each step in the target search method in the aforementioned embodiment. Therefore, the specific implementation method and the technical effects achieved in this embodiment can be referred to the implementation method of the aforementioned target search method, and will not be repeated here.
[0110] In one possible implementation, this application also provides a machine-readable storage medium storing machine-executable instructions that, when executed by one or more processors, implement the target detection method provided in this application. The machine-executable instructions may be in the form of programs, software, software modules, scripts, or code, written in any type of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0111] As an example, the machine-executable instructions may be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0112] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0113] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0114] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a multimedia terminal device (which may be a mobile phone, computer, television receiver, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0115] The above are merely optional embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A target search method, characterized in that, The method includes: Obtain optical flow maps; Statistically analyze the frequency of occurrence of different pixel values in each pixel of the optical flow map; For each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the region consisting of pixels whose pixel value is equal to the target pixel value and whose positions are adjacent is determined as an initial region; For each initial region, based on the pixel value of the initial region, the regions located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region are determined as neighboring regions; The adjacent regions are incorporated into the initial region, and the adjusted initial region is determined as the region where the target object is located.
2. The target search method according to claim 1, characterized in that, Before the step of determining an initial region consisting of pixels whose pixel value is equal to and adjacent to the target pixel value for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the method further includes: Based on the frequency of occurrence of different pixel values in the optical flow map, the background in the optical flow map is excluded; The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, where the region consisting of pixels whose pixel value is equal to the target pixel value and whose positions are adjacent to it, includes: Based on the optical flow map after excluding the background, for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the region composed of pixels whose pixel value is equal to the target pixel value and whose position is adjacent is determined as an initial region.
3. The target search method according to claim 1, characterized in that, Before the step of determining an initial region consisting of pixels whose pixel value is equal to and adjacent to the target pixel value for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, the method further includes: The frequency of occurrence of different pixel values in the optical flow map is sorted from largest to smallest. The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, where the region consisting of pixels whose pixel value is equal to the target pixel value and whose positions are adjacent to it, includes: For each target pixel value whose occurrence frequency is greater than a preset frequency threshold after sorting, the region consisting of pixels whose pixel value is equal to the target pixel value and whose position is adjacent is determined as an initial region.
4. The target search method according to claim 1, characterized in that, The step of determining an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, where the region consisting of pixels whose pixel value is equal to the target pixel value and whose positions are adjacent to it, includes: The frequency of occurrence of different pixel values in the optical flow map is traversed to obtain the coordinates of the pixel corresponding to each target pixel value that is greater than a preset frequency threshold; An initial region is defined as the region whose area is greater than the area threshold, consisting of pixels with adjacent coordinates and pixel values equal to the target pixel value.
5. The target search method according to claim 1, characterized in that, The step of determining, for each initial region, regions surrounding that are within a set gradient threshold range in terms of pixel value variation compared to the initial region as neighboring regions, based on the pixel values of that initial region, includes: Obtain the centroid of each initial region and the centroid of the regions surrounding the initial region; wherein the centroid of the initial region is the mean of all pixel coordinates within the initial region, and the centroid of the regions surrounding the initial region is the mean of all pixel coordinates in the regions surrounding the initial region; Based on the centroid of the initial region and the centroid of the regions surrounding the initial region, the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region is obtained; The region surrounding the initial region whose maximum absolute value of the gradient is less than a set gradient threshold is defined as the neighboring region.
6. The target search method according to claim 5, characterized in that, The step of obtaining the maximum absolute value of the gradient between the initial region and the surrounding regions based on the centroid of the initial region and the centroid of the regions surrounding the initial region includes: Based on the centroid of the initial region and the centroid of the region surrounding the initial region, obtain the equation of the straight line between the centroid of the initial region and the centroid of the region surrounding the initial region; Based on the equation of the line, the absolute values of several gradients between the initial region and the regions surrounding the initial region are obtained; Based on the absolute values of the aforementioned gradients, the maximum absolute value of the gradient between the initial region and the regions surrounding the initial region is obtained.
7. A target search device, characterized in that, The device includes: The acquisition module is used to acquire optical flow maps; The statistics module is used to count the frequency of occurrence of different pixel values in each pixel of the optical flow map; The first determining module is used to determine an initial region for each target pixel value whose occurrence frequency is greater than a preset frequency threshold, and the region composed of pixels whose pixel value is equal to the target pixel value and whose position is adjacent. The second determining module is used to determine, for each initial region, regions located around the initial region and whose pixel value changes within a set gradient threshold range compared to the initial region as neighboring regions based on the pixel value of the initial region. The third determining module is used to incorporate the neighboring region into the initial region and determine the adjusted initial region as the region where the target object is located.
8. An electronic device, characterized in that, The method includes a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions, which, when executed by the processor, implement the method according to any one of claims 1-6.
9. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions that, when executed by one or more processors, implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Doppler-based segmentation and optical flow in radar images
CN105574892A
Object tracking using optical flow
US20220351392A1