Image processing method and device
By introducing predicted paths in IPC and matching the position points of new target objects with the predicted paths of known targets, the accuracy problem caused by mutation of target recognition feature values is solved, and the accuracy and stability of the target tracking task are improved.
Patent Information
- Application Number
- CN202410835358.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-06
AI Technical Summary
In the existing IPC, the target recognition feature value mutates due to the change of the picture during the movement of the target, causing the original target to be recognized as a new target, causing accuracy problems in the target tracking task.
Introducing the prediction path, when the same target is recognized as a new target due to changes in characteristics, the calculated movement trajectory is used to determine whether it is the same target, assisting the accuracy of the target tracking task. The specific method is to detect the new target object when no known target is detected in the target frame image, and match its to-be-matched position point with the pre-established predicted path of the known target. If it matches, it is determined to be the same target.
It improves the accuracy and stability of target recognition, corrects recognition errors, ensures the accuracy of target tracking tasks, and can identify lost known targets even when feature values change.
Smart Images

Figure CN118608604A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to technical fields such as image processing and target recognition. Background Art
[0002] With the continuous development of IPC (IP CAMERA, network camera), there are higher requirements for indoor and outdoor target recognition. However, due to the performance limitations of current IPC, there will be lag and loss problems for moving targets in many scenarios. Summary of the invention
[0003] The present disclosure provides an image processing method and device to solve or alleviate one or more technical problems in related technologies.
[0004] In a first aspect, the present disclosure provides an image processing method, comprising:
[0005] When a known first target object is not detected in the target frame image based on the target recognition method and a newly added second target object is detected, matching the to-be-matched position point of the second target object with a pre-established predicted path of the first target object; wherein the to-be-matched position point is constructed based on the target frame image;
[0006] When the to-be-matched position point matches the predicted path, the second target object is determined to be the first target object.
[0007] In a second aspect, the present disclosure provides an image processing device, comprising:
[0008] A matching module, configured to match a to-be-matched position point of the second target object with a pre-established predicted path of the first target object when a known first target object is not detected in the target frame image based on a target recognition method and a newly added second target object is detected; wherein the to-be-matched position point is constructed based on the target frame image;
[0009] A determination module is used to determine that the second target object is the first target object when the to-be-matched position point matches the predicted path.
[0010] In a third aspect, an electronic device is provided, including:
[0011] at least one processor; and
[0012] a memory communicatively connected to the at least one processor; wherein,
[0013] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any method in the embodiments of the present disclosure.
[0014] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute any method according to the embodiments of the present disclosure.
[0015] In a fifth aspect, a computer program product is provided, comprising a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.
[0016] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments provided according to the present disclosure and should not be regarded as limiting the scope of the present disclosure.
[0018] Figure 1 is a flowchart of an image processing method according to an embodiment of the present disclosure;
[0019] Figure 2 is a schematic diagram of an image according to an embodiment of the present disclosure;
[0020] Figure 3 is a schematic diagram of a process for obtaining a location point of a target object according to an embodiment of the present disclosure;
[0021] Figure 4 is a schematic diagram of obtaining a predicted path according to an embodiment of the present disclosure;
[0022] Figure 5 is an architecture diagram of an image processing method according to an embodiment of the present disclosure;
[0023] Figure 6 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure;
[0024] Figure 7 It is a block diagram of an electronic device used to implement the image processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] The present disclosure will be further described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0026] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.
[0027] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0028] The target tracking task is one of the most important tasks in computer vision. In order to complete the target tracking task, it is first necessary to locate the target in the image. Then a separate unique ID (Identity document) is assigned to each target. Then, the same target can be identified in the subsequent continuous frames, thereby obtaining the historical trajectory of each target. Among them, the target can be of any category, such as pedestrians, vehicles, athletes in motion, birds in the sky, etc.
[0029] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0030] However, when the target moves, the image changes, causing the target recognition method in the related art to mutate the feature values of the same target, which may cause the original target to be recognized as a new target.
[0031] In view of this, the embodiment of the present disclosure introduces a predicted path for known targets. When the same target is identified as a new target due to feature changes, it can be determined whether the two are the same target based on the inferred movement trajectory, which is used to assist the target tracking task to ensure the accuracy of the target tracking task.
[0032] like Figure 1 FIG. 1 is a flow chart of an image processing method proposed in an embodiment of the present disclosure, which may include the following contents:
[0033] S101, when a known first target object is not detected in a target frame image based on a target recognition method and a newly added second target object is detected, a to-be-matched position point of the second target object is matched with a pre-established predicted path of the first target object; wherein the to-be-matched position point is constructed based on the target frame image.
[0034] In some embodiments, acquiring the target frame image may be implemented as: periodically collecting images in the environment as the target frame image, wherein the target frame image may be in a YUV format.
[0035] "Y" stands for brightness (Luminance or Luma), which is the grayscale value; while "U" and "V" stand for chrominance (Chrominance or Chroma), which is used to describe the color and saturation of the image and is used to specify the color of the pixel. In addition, the image in YUV format occupies less storage space, so the image is converted to YUV format to facilitate target detection using the target recognition method on the image.
[0036] Of course, you can also collect images in RGB (Red Green Blue, color system) format. Since YUV refers to a pixel format in which brightness parameters and chromaticity parameters are represented separately, its data volume is small and it is helpful for later target detection tasks. Therefore, it is recommended to convert RGB format images into YUV format images for target recognition methods to perform target detection.
[0037] Among them, the target recognition method can be openCV HOG algorithm (Open Source Computer Vision Library Histogram of Oriented Gradients, oriented gradient histogram of open source computer vision library), Dlib algorithm (i.e., target detection algorithm provided by Dlib library), target detection method provided by TensorFlow (an open source machine learning framework), target detection method provided by MediaPipe (a framework for building machine learning pipelines), yoloV5 (YouOnly Look Once V5, fifth edition object detection and image segmentation model), yolov9 (You Only Look Once V9, ninth edition object detection and image segmentation model), PyTorch (deep learning tensor library) and other algorithms for target recognition, which are not limited in the embodiments of the present disclosure.
[0038] S102: When the to-be-matched position point matches the predicted path, determining that the second target object is the first target object.
[0039] Among them, the method of matching the position point to be matched with the predicted path can be understood as determining the distance between the position point to be matched and the predicted path. When the distance is less than the distance threshold, the position point to be matched of the second target object is located on the predicted path, and the second target object is determined to be the first target object.
[0040] On the contrary, when the distance is less than the distance threshold, the to-be-matched position point of the second target object is not on the predicted path, thereby determining that the second target object is not the first target object.
[0041] In the embodiment of the present disclosure, a known target, that is, a predicted path of the first target object, is pre-established. In the process of using the target recognition method to perform target recognition on the captured image, if the known target is lost and a new target (i.e., the second target object) is generated, based on the fact that the movement trajectory of the same target will not change suddenly in a short period of time, the lost known target can be identified by analyzing whether the new target matches the predicted path of the known target. Therefore, even if the target recognition method based on feature value for target detection has recognition errors, the method provided by the embodiment of the present disclosure can assist in correcting the recognition errors and improve the accuracy and stability of target recognition.
[0042] The method provided by the embodiment of the present disclosure can be applied to a smart camera that has the computing resources required to implement the method. The smart camera collects images at the same shooting angle, that is, the image collection range of the smart camera in the world coordinate system remains basically unchanged. Figure 2 As shown, in the case of fine weather, the smart camera uses the target recognition method to identify and locate the first target object on the collected image, and establishes a predicted path for it. When the weather environment changes, such as when fine weather turns into lightning, the characteristic value of the first target object in the image changes, and the target recognition method will lose the first target object, and will identify the newly added second target object. At this time, the position point to be matched of the second target object can be determined, and it can be determined whether the position point to be matched is on the predicted path of the first target pair. If the position point to be matched is on the predicted path, it can be confirmed that the second target object is the first target object, and the second target object detected by the target recognition method can be corrected to re-identify the first target object. In this way, the target recognition method can be assisted in target detection, thereby improving the efficiency and accuracy of detection.
[0043] It should be noted that the method provided in the embodiments of the present disclosure is not limited to smart cameras, but can also be implemented in a computing device that is compatible with an ordinary image sensor. For example, an ordinary image sensor is only responsible for collecting images and distributing them to the computing device to execute the target recognition method and the image processing method provided in the embodiments of the present disclosure.
[0044] It is understandable that the same frame image is not limited to identifying one or one type of target. Whether it is identifying one or more types of targets, when the feature value changes and the target recognition method cannot identify the same target, multiple known targets may be lost and multiple new objects (i.e., new targets) may be generated.
[0045] In order to accurately find the first target object from multiple newly added objects, in some possible implementations, each newly added object can be used as a second target object and execute Figure 1 The method shown is used to identify the lost first target object.
[0046] However, this traversal method will obviously consume more computing resources. Therefore, in some other possible implementations, based on a certain screening method, the newly added objects that cannot be the first target object can be filtered out from the multiple newly added objects, thereby screening out the objects that need to be executed. Figure 1 The second target object of the method shown. During implementation, it is considered that the color-related feature value has changed and it is impossible to filter based on the color-related feature value. The embodiment of the present disclosure finally uses the relatively stable features of the target object for filtering. In view of this, the embodiment of the present disclosure uses the difference between the speed and / or area between the multiple newly added objects and the first target object to filter out the second target object, which can be specifically implemented as follows:
[0047] Step A1, when there are multiple newly added objects in the target frame image, determine the similarity between each newly added object and the first target object, wherein the similarity is determined based on the area similarity and / or movement speed similarity between the newly added object and the first target object in the frame image.
[0048] In some embodiments, determining the area similarity between each newly added object and the first target object can be implemented as follows: determining the number of pixels in the first detection frame of each newly added object, and determining the number of pixels in the second detection frame of the first target object; comparing the number of pixels in the first detection frame and the second detection frame to obtain the area similarity between each newly added object and the first target object. Specifically, a relatively simple way is to calculate the ratio of the two. The closer the ratio is to 1, the more similar the two are. In addition, the moving direction of the second target object can be determined, and the size change rate of the target object in the picture can be determined based on its moving direction and moving speed. The number of pixels in the second detection frame is corrected according to the size change rate to obtain an optimized value. Then, the ratio of the number of pixels in the first detection frame of the newly added object to the optimized value is calculated. The closer the two are, the more similar they are.
[0049] In some embodiments, determining the speed similarity between each newly added object and the first target object can be implemented as follows: determining first speed information of each newly added object; and determining second speed information of the first target object; and comparing the first speed information and the second speed information to obtain the speed similarity between each newly added object and the first target object. The closer the speed information of the two objects is, the greater the similarity obtained is.
[0050] In some embodiments, for any newly added object among the newly added objects, determining the first speed information of the newly added object can be implemented as follows: obtaining multiple first detection frames of the newly added object in multiple consecutive frames; determining the position point of the newly added object based on the first detection frame; and determining the first speed information of the newly added object based on the multiple position points, wherein the position point of each newly added object represents the position of the newly added object in the three-dimensional coordinate system.
[0051] Determining the position point of the newly added object based on the first detection frame can be implemented as follows: based on the position information of the first detection frame in any frame image, determining the coordinate values of the newly added object on the first coordinate axis and the second coordinate axis; determining the coordinate value of the newly added object on the third coordinate axis based on the size of the first detection frame; the coordinate value on the third coordinate axis is inversely proportional to the size of the first detection frame; wherein the coordinate value of the newly added object on the first coordinate axis, the coordinate value on the second coordinate axis and the coordinate value on the third coordinate axis are used to express the position point of the newly added object.
[0052] The specific method of determining the location point of the newly added object is similar to the method of determining the location point of the first target object described later, and is not described in detail in the embodiment of the present disclosure.
[0053] Based on multiple position points, determining the first speed information of the newly added object can be implemented as follows: calculating the distance between two adjacent position points to obtain multiple distances, and then calculating the average of the multiple distances as the first speed information; or, determining the length of a path constructed by multiple position points, and then determining the moving duration based on the acquisition time of the frame image corresponding to each position point, and dividing the path length by the moving duration to obtain the first speed information.
[0054] In some embodiments, determining the second speed information of the first target object may be implemented as follows: determining the position points of the position box of the first target object in multiple consecutive frames; and determining the second speed information of the first target object based on the multiple position points. The method for determining the second speed information may refer to the first speed information, which will not be described in detail here.
[0055] The specific method of obtaining the location point of the first target object is described later, and the embodiment of the present disclosure will not be repeated here.
[0056] Step A2: based on the similarity between each newly added object and the first target object, select the second target object from the multiple newly added objects.
[0057] When the similarity is determined based only on the area similarity, if the area similarity between the newly added object and the first target object is greater than a first preset threshold, the newly added object is determined as the second target object. If the area similarity between the newly added object and the first target object is not greater than the first preset threshold, the newly added object is filtered out.
[0058] In the case where the similarity is determined based only on the moving speed similarity, if the moving speed similarity between the newly added object and the first target object is greater than a second preset threshold, the newly added object is determined as the second target object. If the moving speed similarity between the newly added object and the first target object is not greater than the second preset threshold, the newly added object is not determined as the second target object.
[0059] In the case where the similarity includes area similarity and moving speed similarity, if the area similarity between the newly added object and the first target object is greater than a first preset threshold and the moving speed similarity is greater than a second preset threshold, the newly added object is determined as the second target object. If the area similarity between the newly added object and the first target object is not greater than the first preset threshold or the moving speed similarity is not greater than the second preset threshold, the newly added object is filtered out.
[0060] In the disclosed embodiment, the newly added objects are first preliminarily filtered based on area similarity and / or speed similarity to obtain the second target object. This approach can save computing resources and reduce resource waste.
[0061] In the case of obtaining the second target object, in order to identify the known target again, it is necessary to determine whether the second target object is on the predicted path of the first target object. In some embodiments, in order to improve the accuracy of identifying the same target, the predicted path of the first target object in the target three-dimensional space can be predicted. The target three-dimensional space uses the height direction of the frame image captured by the image acquisition device as the first coordinate axis, the width direction as the second coordinate axis, and the direction perpendicular to the image plane as the third coordinate axis. The image acquisition device may include the aforementioned smart camera, and an image sensor. The coordinate axes of the target three-dimensional space can be as follows: Figure 2 As shown, the first coordinate axis is the y-axis (the height of the captured image), the second coordinate axis is the x-axis (the width of the captured image), and the third coordinate axis is the z-axis perpendicular to the image plane. On this basis, the predicted path of the first target object can be constructed in the following manner:
[0062] Step B1, constructing historical position points of the first target object based on multiple frames of historical frame images to obtain multiple historical position points; wherein the multiple frames of historical frame images meet the following conditions: the first target object is identified in each frame of the historical frame image by the target recognition method, and the acquisition time of each frame of the historical frame image is earlier than the acquisition time of the target frame image.
[0063] Among them, multiple frames of historical frame images can be images of the first target object in a short period of time. Each frame of image collected in a short period of time can be used as a historical frame image respectively, or when the frame rate of collection is high, the collected images can be randomly sampled to obtain multiple frames of historical frame images. For example, if 3 frames of images are collected within 1 second, 3 frames within 1 second can be selected as historical frame images. In the case of collecting 10 frames of images within 1 second, 3 frames within 1 second can also be randomly sampled as historical frame images. The embodiment of the present disclosure can determine the number of historical frames and the collection method based on actual conditions. In addition, the sampling rate can also be dynamically adjusted according to the moving speed of the target object. That is, there is a positive correlation between the sampling rate and the moving speed.
[0064] In some cases, an odd number of history frames may be selected for predicting the path.
[0065] Step B2: constructing a predicted path of the first target object in a target three-dimensional space based on the multiple historical position points of the first target object.
[0066] In a specific implementation, the order of the multiple historical position points may be determined according to the acquisition order of the historical frame images, and then the predicted path of the first target object in the target three-dimensional space may be obtained based on the order.
[0067] In the disclosed embodiment, the predicted path of the first target object in three-dimensional space can be accurately determined based on historical location points. This method is simple to operate and easy to implement, and a predicted path can be constructed in a short time to better assist image recognition methods to accurately identify the same target.
[0068] In some embodiments, for any one of the first target object and the second target object, when the position point of any one of the target objects is constructed based on any one frame image, as follows Figure 3 As shown, it can be implemented as:
[0069] S301, obtaining a position frame of any target object identified by a target recognition method in any frame image.
[0070] S302: Determine the coordinate values of any target object on the first coordinate axis and the second coordinate axis based on the position information of the position box in any frame image.
[0071] Specifically, it can be understood that the position information of any vertex of the position box is used to determine the coordinate value of any target object on the first coordinate axis and the second coordinate axis.
[0072] Exemplarily, when the coordinate value is determined by the position information of the upper left corner D1 (x1, y1) of the position box, x1 is used as the coordinate value on the second coordinate axis, and y1 is used as the coordinate value on the first coordinate axis.
[0073] The center point of any target object in the position box may also be solved to determine the coordinate values of the target object on the first coordinate axis and the second coordinate axis.
[0074] S303, determining the coordinate value of any target object on the third coordinate axis based on the size of the position box; the coordinate value on the third coordinate axis is inversely proportional to the size of the position box; wherein the coordinate value of any target object on the first coordinate axis, the coordinate value on the second coordinate axis and the coordinate value on the third coordinate axis are used to express the position point of any target object.
[0075] In some embodiments, the size of the position box is the area of the position box, and determining the coordinate value of any target object on the third coordinate axis based on the size of the position box can be implemented as follows: determining the ratio between the area of any frame image and the area of the position box, and obtaining the coordinate value of any target object on the third coordinate axis; wherein the area of any frame image and the area of the position box are both expressed by the total number of pixels occupied by each.
[0076] In the disclosed embodiment, the coordinate value of the target object on the third coordinate axis is obtained by using the ratio between the area of the image and the area of the position box. This method can obtain three-dimensional coordinates simply and efficiently, thereby improving the efficiency of target recognition and detection.
[0077] Furthermore, constructing the position point of the target object based on the aforementioned target three-dimensional coordinate system can be implemented as follows: constructing the position point of the target object based on the center coordinates of the target object and the coordinate values on the third coordinate axis.
[0078] In some embodiments, obtaining the center coordinates of the target object may be implemented as follows: determining the center coordinates of the target object based on the average of the coordinates of two vertices on the detection frame that do not belong to the same side.
[0079] For example, taking a 2560*1440 resolution screen as an example, the X-axis value range is [0, 2560], and the Y-axis value range is [0, 1440].
[0080] Assuming that the coordinates of D1 (x1, y1) are (300, 200) (D1 is the upper left corner coordinate), and the coordinates of D2 (x2, y2) are (700, 400) (D2 is the lower right corner coordinate), then the coordinates of the center coordinate D3 (x3, y3) can be (500, 300), and the area of the position box is S. D1D2 =(x2-x1)×(y2-y1)=80000.
[0081] In an image, the farther the target is from the screen, the smaller the proportion of the target in the image. D1D2 / S 总 The smaller it is, the larger its reciprocal is. 总 is the area of the image, which is S 总 =2560*1440=3686400. Therefore, the value range of the Z axis is [1,+∞), and the coordinate of the Z axis is S 总 / S D1D2 , which is 46.08. Then the position of the target object is (500, 300, 46.08).
[0082] It should be noted that the above numerical values are only for illustrative purposes, and the specific numerical values can be determined based on actual conditions, and the embodiments of the present disclosure are not limited to this.
[0083] In some embodiments, the position point of any target object may also be implemented as follows: based on the external parameters and / or internal parameters of the camera, the coordinates of the position box are converted into coordinates in the world coordinate system to obtain an expression of the position point in the world coordinate system.
[0084] It can be seen that mapping the pixels in the image to the world coordinate system requires the conversion of camera parameters, and the conversion relationship is relatively complex. The method of determining the position point proposed in the embodiment of the present disclosure is relatively simple and efficient, making the prediction of the trajectory in the short term more accurate.
[0085] For the first target object, when the position point of the target object is obtained based on the above-mentioned method, a predicted path of the first target object in the target three-dimensional space is constructed based on the multiple historical position points of the first target object. This can be implemented as follows: using the multiple historical position points as known points of the straight line equation expression of the first target object in the target three-dimensional space, using the coefficients of the straight line equation expression as unknown quantities, and determining the predicted path of the first target object in the target three-dimensional space by solving the set of equations.
[0086] Since the path of the target object in the short term is a straight line, the predicted path of the target object can be expressed using the straight line equation expression.
[0087] Exemplarily, the straight line equation expression can be z=a*x+b*y+c. The multiple historical position points obtained above are substituted into the expression, and the equation group is solved to obtain the specific values of a, b, and c, and then the predicted path of the first target object is obtained.
[0088] In the disclosed embodiment, the predicted path of the first target object is determined by solving a set of equations, which can more accurately describe the path of the first target object in the short term, so as to assist the target recognition method in performing target detection.
[0089] In another embodiment, the predicted path can be obtained by first obtaining the slope and then constructing the straight line equation. Therefore, the predicted path of the first target object in the target three-dimensional space is constructed based on the multiple historical position points of the first target object, which can be implemented as follows:
[0090] Step C1, projecting the multiple historical position points into two plane coordinate systems in the target three-dimensional space respectively to obtain a projection point sequence of each plane; wherein the two plane coordinate systems both include a target axis.
[0091] Step C2, for each plane, using the projection point sequence of the plane to solve the slope of the straight line equation of the projection point sequence; wherein the straight line equation of the projection point sequence takes the target axis as the dependent variable, and the coordinate values of the other two coordinate axes other than the target axis as the independent variables.
[0092] Step C3, taking the slope of each plane as the slope of the coordinate axis outside the target axis in the plane, and taking the intersection of the execution equation and the target axis as the intercept, so as to obtain the predicted path of the first target object in the target three-dimensional space.
[0093] Specific as Figure 4 As shown, assuming that the slope of the x-axis is to be obtained, the linear equation z=ax+d is solved based on the projection point sequence of the ZOX plane to obtain the specific value a' of the x-axis slope a. Specifically, the projection point sequence of the ZOY plane can be substituted into z=by+u to obtain the specific value b' of the slope b. After obtaining a' and b', the value of the intersection of the straight line and the z-axis in any two-dimensional plane on the z-axis is taken as the specific value c' of the intercept c. Then the predicted path is z=a'*x+b'*y+c'.
[0094] In the disclosed embodiment, compared with the method of solving a group of equations in three-dimensional space, the method of solving the slope of the straight line equation in two-dimensional space to obtain the predicted path is more efficient and can save computing resources.
[0095] In some embodiments, as the target object moves, the predicted short-term path needs to be adjusted in a timely manner. In a possible implementation, each time n frames of images are acquired, the predicted short-term path of the first target object is reconstructed based on the position point of the first target object in the n frames of images. However, this method may have redundant processing processes.
[0096] In order to save computing resources and assist the target recognition method, after determining that the second target object is the first target object in the embodiment of the present disclosure, the following may also be implemented:
[0097] Step D1, for the frame image to be processed collected after the target frame image, when the position point of the second target object constructed based on the frame image to be processed does not match the predicted path of the first target object, obtain the recognition result of the frame image to be processed by the target recognition method.
[0098] Step D2, when the recognition result is that the second target object is recognized, the predicted path of the first target object is updated using the most recently acquired n image frames; wherein n is a positive integer.
[0099] Specifically, it can be understood that when the recognition result of the target recognition method for the processed frame image indicates that the second target object is the first target object, but the trajectories of the two do not match, the originally constructed short-term prediction path is no longer applicable to the current situation. Therefore, the result obtained by the target recognition method can be used as the basis to update the short-term prediction path of the first target object from time to time.
[0100] In the disclosed embodiment, a target recognition method is combined with a path matching method to achieve timely and appropriate correction of the predicted path of the first target object, thereby improving the efficiency and accuracy of target detection.
[0101] The architecture diagram of the image processing method proposed in the embodiment of the present disclosure is as follows: Figure 5As shown, it may include an image acquisition unit, a target recognition unit, a coordinate construction unit, a path calculation unit, and a path regression unit. The image acquisition unit is used to acquire images in real time, and the target recognition unit is used to recognize the acquired images to obtain the first target object and / or the second target object. The coordinate construction unit is used to construct the position points of the first target object. After acquiring a preset number of position points of the first target object, the preset number of position points of the first target object are input into the path calculation unit to obtain the predicted path of the first target object, and then the predicted path is input into the path regression unit. In addition, the coordinate construction unit is also used to construct the position points to be matched of the second target object; the position points to be matched of the second target object are matched with the predicted path of the first target object. If it is determined that they are the same target, the image acquisition unit is returned to continuously acquire the target object. If it is determined that the two are not the same target, the image acquisition unit is continued to acquire, and a newly added multi-frame image is obtained. If the second target object matching the first target object is not acquired within the preset time length, it can be determined that the second target object is indeed a newly added target object, not a known target, and a predicted path can be created for it for processing.
[0102] Based on the same technical concept, the embodiment of the present disclosure also provides an image processing device 600, such as Figure 6 As shown, including:
[0103] A matching module 601 is used for matching a to-be-matched position point of the second target object with a pre-established predicted path of the first target object when a known first target object is not detected in the target frame image based on a target recognition method and a newly added second target object is detected; wherein the to-be-matched position point is constructed based on the target frame image;
[0104] The determination module 602 is configured to determine that the second target object is the first target object when the to-be-matched position point matches the predicted path.
[0105] In some embodiments, the method further comprises a first building block for:
[0106] Based on multiple frames of historical frame images, historical position points of the first target object are respectively constructed to obtain multiple historical position points; wherein the multiple frames of historical frame images meet the following conditions: the first target object is recognized in each frame of the historical frame image by the target recognition method, and the acquisition time of each frame of the historical frame image is earlier than the acquisition time of the target frame image;
[0107] Based on the multiple historical position points of the first target object, construct a predicted path of the first target object in a target three-dimensional space;
[0108] Among them, the target three-dimensional space has a height direction of the frame image captured by the image capture device as a first coordinate axis, a width direction as a second coordinate axis, and a direction perpendicular to the image plane as a third coordinate axis.
[0109] In some embodiments, a second construction module is further included, which is used to construct the position point of any target object based on any frame image in the following manner:
[0110] Obtaining a position frame of any target object identified by the target recognition method in any frame image;
[0111] Determine the coordinate values of any target object on the first coordinate axis and the second coordinate axis based on the position information of the position frame in any frame image;
[0112] Determine the coordinate value of any target object on the third coordinate axis based on the size of the position frame; the coordinate value on the third coordinate axis is in inverse proportion to the size of the position frame;
[0113] The coordinate value of any target object on the first coordinate axis, the coordinate value on the second coordinate axis, and the coordinate value on the third coordinate axis are used to express the position point of any target object.
[0114] In some embodiments, the size of the position box is the area of the position box, and the second building module is specifically used to:
[0115] Determine the ratio between the area of any frame image and the area of the position frame, and obtain the coordinate value of any target object on the third coordinate axis;
[0116] The area of any frame image and the area of the position box are both expressed by the total number of pixels they occupy.
[0117] In some embodiments, the first building block is specifically used to:
[0118] The multiple historical position points are used as known points of the straight line equation expression of the first target object in the target three-dimensional space, and the coefficients of the straight line equation expression are used as unknown quantities. The predicted path of the first target object in the target three-dimensional space is determined by solving the set of equations.
[0119] In some embodiments, the first building block is specifically used to:
[0120] Projecting the multiple historical position points into two plane coordinate systems in the target three-dimensional space respectively to obtain projection point sequences of each plane; wherein the two plane coordinate systems both include the target axis;
[0121] For each plane, the projection point sequence of the plane is used to solve the slope of the straight line equation of the projection point sequence; wherein the straight line equation of the projection point sequence takes the target axis as the dependent variable, and the coordinate values of the other two coordinate axes other than the target axis as the independent variables;
[0122] The slope of each plane is used as the slope of the coordinate axis other than the target axis in the plane, and the intersection of the execution equation and the target axis is used as the intercept to obtain the predicted path of the first target object in the target three-dimensional space.
[0123] In some embodiments, a screening module is further included for:
[0124] In the target frame image, when there are multiple newly added objects, determining the similarity between each newly added object and the first target object, wherein the similarity is determined based on the area similarity and / or movement speed similarity between the newly added object and the first target object in the frame image;
[0125] Based on the similarity between each newly added object and the first target object, the second target object is selected from the multiple newly added objects.
[0126] In some embodiments, an update module is further included, which is used to:
[0127] After determining that the second target object is the first target object, for a frame image to be processed acquired after the target frame image, if the position point of the second target object constructed based on the frame image to be processed does not match the predicted path of the first target object, obtaining a recognition result of the frame image to be processed by the target recognition method;
[0128] When the recognition result is that the second target object is recognized, the predicted path of the first target object is updated using the most recently acquired n image frames; wherein n is a positive integer.
[0129] For the description of specific functions and examples of each module, sub-module\unit of the device in the embodiment of the present disclosure, please refer to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0130] Figure 7 FIG. 1 is a structural block diagram of an electronic device according to an embodiment of the present disclosure. Figure 7As shown, the electronic device includes: a memory 710 and a processor 720, and the memory 710 stores a computer program that can be run on the processor 720. The number of the memory 710 and the processor 720 can be one or more. The memory 710 can store one or more computer programs. When the one or more computer programs are executed by the electronic device, the electronic device executes the method provided by the above method embodiment. The electronic device may also include: a communication interface 730, which is used to communicate with external devices and perform data exchange transmission.
[0131] If the memory 710, the processor 720 and the communication interface 730 are implemented independently, the memory 710, the processor 720 and the communication interface 730 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0132] Optionally, in a specific implementation, if the memory 710, the processor 720 and the communication interface 730 are integrated on a chip, the memory 710, the processor 720 and the communication interface 730 can communicate with each other through an internal interface.
[0133] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0134] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0135] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (for example: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (for example: infrared, Bluetooth, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc. It is worth noting that the computer-readable storage medium mentioned in the present disclosure may be a non-volatile storage medium, in other words, a non-transient storage medium.
[0136] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0137] In the description of the embodiments of the present disclosure, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0138] In the description of the embodiments of the present disclosure, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in this article is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0139] In the description of the embodiments of the present disclosure, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.
[0140] The above description is only an exemplary embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An image processing method, comprising: When a known first target object is not detected in the target frame image based on the target recognition method and a newly added second target object is detected, matching the to-be-matched position point of the second target object with a pre-established predicted path of the first target object; wherein the to-be-matched position point is constructed based on the target frame image; When the to-be-matched position point matches the predicted path, the second target object is determined to be the first target object.
2. The method according to claim 1 further comprises constructing a predicted path of the first target object based on: Based on multiple frames of historical frame images, the historical position points of the first target object are respectively constructed to obtain multiple historical position points; wherein, The multiple frames of historical frame images meet the following conditions: the first target object is recognized in each frame of the historical frame image by the target recognition method, and the acquisition time of each frame of the historical frame image is earlier than the acquisition time of the target frame image; Based on the multiple historical position points of the first target object, construct a predicted path of the first target object in a target three-dimensional space; Among them, the target three-dimensional space has a height direction of the frame image captured by the image capture device as a first coordinate axis, a width direction as a second coordinate axis, and a direction perpendicular to the image plane as a third coordinate axis.
3. The method according to claim 2, wherein: For any target object among the first target object and the second target object, constructing a position point of any target object based on any frame image includes: Obtaining a position frame of any target object identified by the target recognition method in any frame image; Determine the coordinate values of any target object on the first coordinate axis and the second coordinate axis based on the position information of the position frame in any frame image; Determine the coordinate value of any target object on the third coordinate axis based on the size of the position frame; the coordinate value on the third coordinate axis is in inverse proportion to the size of the position frame; The coordinate value of any target object on the first coordinate axis, the coordinate value on the second coordinate axis, and the coordinate value on the third coordinate axis are used to express the position point of any target object.
4. The method according to claim 3, wherein: The size of the position box is the area of the position box, and determining the coordinate value of any target object on the third coordinate axis based on the size of the position box includes: Determine the ratio between the area of any frame image and the area of the position frame, and obtain the coordinate value of any target object on the third coordinate axis; The area of any frame image and the area of the position box are both expressed by the total number of pixels they occupy.
5. The method according to claim 2, wherein: The step of constructing a predicted path of the first target object in a target three-dimensional space based on the multiple historical position points of the first target object includes: The multiple historical position points are used as known points of the straight line equation expression of the first target object in the target three-dimensional space, and the coefficients of the straight line equation expression are used as unknown quantities. The predicted path of the first target object in the target three-dimensional space is determined by solving the set of equations.
6. The method according to claim 2, wherein: The step of constructing a predicted path of the first target object in a target three-dimensional space based on the multiple historical position points of the first target object includes: Projecting the multiple historical position points into two plane coordinate systems in the target three-dimensional space respectively to obtain projection point sequences of each plane; wherein the two plane coordinate systems both include the target axis; For each plane, the projection point sequence of the plane is used to solve the slope of the straight line equation of the projection point sequence; wherein the straight line equation of the projection point sequence takes the target axis as the dependent variable, and the coordinate values of the other two coordinate axes other than the target axis as the independent variables; The slope of each plane is used as the slope of the coordinate axis other than the target axis in the plane, and the intersection of the execution equation and the target axis is used as the intercept to obtain the predicted path of the first target object in the target three-dimensional space.
7. The method according to claim 1, further comprising: In the target frame image, when there are multiple newly added objects, determining the similarity between each newly added object and the first target object, wherein the similarity is determined based on the area similarity and / or movement speed similarity between the newly added object and the first target object in the frame image; Based on the similarity between each newly added object and the first target object, the second target object is selected from the multiple newly added objects.
8. The method according to any one of claims 1 to 7, after determining that the second target object is the first target object, further comprising: For a frame image to be processed acquired after the target frame image, when the position point of the second target object constructed based on the frame image to be processed does not match the predicted path of the first target object, obtaining a recognition result of the frame image to be processed by the target recognition method; When the recognition result is that the second target object is recognized, the predicted path of the first target object is updated using the most recently acquired n image frames; wherein n is a positive integer.
9. An image processing device, comprising: A matching module, configured to match a to-be-matched position point of the second target object with a pre-established predicted path of the first target object when a known first target object is not detected in the target frame image based on a target recognition method and a newly added second target object is detected; wherein the to-be-matched position point is constructed based on the target frame image; A determination module is used to determine that the second target object is the first target object when the to-be-matched position point matches the predicted path.
10. The apparatus according to claim 9, further comprising a first building module, configured to: Based on multiple frames of historical frame images, the historical position points of the first target object are respectively constructed to obtain multiple historical position points; wherein, The multiple frames of historical frame images meet the following conditions: the first target object is recognized in each frame of the historical frame image by the target recognition method, and the acquisition time of each frame of the historical frame image is earlier than the acquisition time of the target frame image; Based on the multiple historical position points of the first target object, construct a predicted path of the first target object in a target three-dimensional space; Among them, the target three-dimensional space has a height direction of the frame image captured by the image capture device as a first coordinate axis, a width direction as a second coordinate axis, and a direction perpendicular to the image plane as a third coordinate axis.
11. The device according to claim 10, further comprising a second construction module, configured to construct the position point of any target object based on any frame image in the following manner: Obtaining a position frame of any target object identified by the target recognition method in any frame image; Determine the coordinate values of any target object on the first coordinate axis and the second coordinate axis based on the position information of the position frame in any frame image; Determine the coordinate value of any target object on the third coordinate axis based on the size of the position frame; the coordinate value on the third coordinate axis is in inverse proportion to the size of the position frame; The coordinate value of any target object on the first coordinate axis, the coordinate value on the second coordinate axis, and the coordinate value on the third coordinate axis are used to express the position point of any target object.
12. The device according to claim 11, wherein: The size of the position box is the area of the position box, and the second building module is specifically used to: Determine the ratio between the area of any frame image and the area of the position frame, and obtain the coordinate value of any target object on the third coordinate axis; The area of any frame image and the area of the position box are both expressed by the total number of pixels they occupy.
13. The device according to claim 10, wherein: The first building module is specifically used for: The multiple historical position points are used as known points of the straight line equation expression of the first target object in the target three-dimensional space, and the coefficients of the straight line equation expression are used as unknown quantities. The predicted path of the first target object in the target three-dimensional space is determined by solving the set of equations.
14. The device according to claim 10, wherein: The first building module is specifically used for: Projecting the multiple historical position points into two plane coordinate systems in the target three-dimensional space respectively to obtain projection point sequences of each plane; wherein the two plane coordinate systems both include the target axis; For each plane, the projection point sequence of the plane is used to solve the slope of the straight line equation of the projection point sequence; wherein the straight line equation of the projection point sequence takes the target axis as the dependent variable, and the coordinate values of the other two coordinate axes other than the target axis as the independent variables; The slope of each plane is used as the slope of the coordinate axis other than the target axis in the plane, and the intersection of the execution equation and the target axis is used as the intercept to obtain the predicted path of the first target object in the target three-dimensional space.
15. The apparatus according to claim 9, further comprising a screening module, configured to: In the target frame image, when there are multiple newly added objects, determining the similarity between each newly added object and the first target object, wherein the similarity is determined based on the area similarity and / or movement speed similarity between the newly added object and the first target object in the frame image; Based on the similarity between each newly added object and the first target object, the second target object is selected from the multiple newly added objects.
16. The device according to any one of claims 9 to 15, further comprising an updating module, configured to: After determining that the second target object is the first target object, for a frame image to be processed acquired after the target frame image, if the position point of the second target object constructed based on the frame image to be processed does not match the predicted path of the first target object, obtaining a recognition result of the frame image to be processed by the target recognition method; When the recognition result is that the second target object is recognized, the predicted path of the first target object is updated by using the most recently acquired n frames of images; wherein, n is a positive integer.
Citation Information
Patent Citations
Behavior detection method, device and equipment and readable storage medium
CN114529874A
Target tracking method, terminal equipment and computer storage medium
CN117710410A
Cited By
Object tracking method and system, electronic equipment, storage medium and program product
CN120993400A
