A video identity processing method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LENOVO (BEIJING) LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-26
Smart Images

Figure CN122289731A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing technology, and in particular to a video identity processing method and system. Background Technology
[0002] When detecting and tracking objects in a video, if changes in lighting or temporary occlusion of the object prevent the same object from being assigned the same identity in different image frames of the video, tracking may fail. Summary of the Invention
[0003] In view of this, this application provides a video identity processing method and an electronic device, the specific solution of which is as follows:
[0004] A video identity processing method, comprising:
[0005] At least a first image frame and a second image frame are obtained, the time corresponding to the first image frame is earlier than the time corresponding to the second image frame, and the target object located at the target position in the first image frame has a stationary marker.
[0006] A first identity identifier and a first counting threshold are determined based on the target object in the first image frame;
[0007] In response to the fact that the target object is not detected at the target location in the second image frame, counting begins until an object matching the target object is detected at the target location in the third image frame, wherein the time corresponding to the third image frame is later than the time corresponding to the second image frame.
[0008] In response to the fact that the image frame count value between the third image frame and the second image frame in a series of consecutive image frames is less than the first count threshold, the identity identifier of the object in the third image frame is determined to be the first identity identifier.
[0009] Furthermore, it also includes:
[0010] In response to the fact that the image frame count value between the third image frame and the second image frame in the consecutive multi-frame images is greater than the first counting threshold and less than the second counting threshold, the identity identifier of the object located at the target location in the third image frame is determined to be the second identity identifier, and the object located at the target location in the third image frame has the stationary mark, the second counting threshold is greater than the first counting threshold, and the second identity identifier is different from the first identity identifier.
[0011] Furthermore, it also includes:
[0012] In response to the image frame count value between the third image frame and the second image frame in the consecutive multi-frame images being greater than the second count threshold, the identity identifier of the object located at the target location in the third image frame is determined to be a third identity identifier, and the object located at the target location in the third image frame does not have the stationary mark, and the third identity identifier is different from the first identity identifier.
[0013] Furthermore, the response that the target object is not detected at the target location in the second image frame includes:
[0014] A first identity determination threshold is determined based on the target object in the first image frame;
[0015] In response to the second image frame not meeting the first identity determination threshold, it is determined that no object matching the target object in the first image frame is identified at the target location of the second image frame;
[0016] In response to the second image frame satisfying the first identity determination threshold, it is determined that an object matching the target object in the first image frame is identified at the target location of the second image frame, and the identity identifier of the object at the target location of the second image frame is determined as the first identity identifier.
[0017] Furthermore, it also includes:
[0018] It is determined that the consecutive multi-frame images include N consecutive target image frames, and the position of the target object in the N consecutive target image frames has not moved, where N is a positive integer greater than 1;
[0019] Set a stillness flag for the target object in the target image frame.
[0020] Furthermore, setting a stillness flag for the target object in the target image frame includes:
[0021] Obtain a fourth image frame and a fifth image frame. The fourth image frame is an image frame that is adjacent to the fifth image frame in the consecutive multi-frame images and whose corresponding time is earlier than the time corresponding to the fifth image frame. The object at the target position in the fourth image frame does not have a stationary marker. The fourth image frame is a frame image in which the object at the target position has not moved in the (N-1)th consecutive frame.
[0022] Based on the object identified at the target location in the fifth image frame and the object at the target location in the fourth image frame, it is determined that the object at the target location in the fifth image frame is stationary.
[0023] In response to the object at the target location being stationary in the fifth image frame and the object at the target location not having a stationary marker in the fourth image frame, a second identity determination threshold is determined.
[0024] In response to the fact that the object at the target position in the fifth image frame and the object at the target position in the fourth image frame satisfy the second identity determination threshold, based on the fact that the fourth image frame is a consecutive N-1 frame in which the object at the target position has not moved, the fifth image frame is determined to be a consecutive N frame in which the object at the target position has not moved. A stationary flag is set for the object at the target position in the fifth image frame, and the identity identifier of the object at the target position in the fifth image frame is determined to be the same as the identity identifier of the object at the target position in the fourth image frame, which is the first identity identifier.
[0025] Furthermore, it also includes:
[0026] In response to the fact that the object at the target position in the fifth image frame does not meet the second identity determination threshold with the object at the target position in the fourth image frame, counting begins until an object matching the object at the target position in the fourth image frame is identified at the target position in the sixth image frame. The sixth image frame is an image frame in the consecutive multi-frame images whose corresponding time is later than the corresponding time of the fifth image frame.
[0027] The third counting threshold is determined based on the fact that the object at the target location in the fourth image frame does not have a stationary marker.
[0028] In response to the fact that the image frame count value between the sixth image frame and the fourth image frame in the consecutive multi-frame images is less than the third counting threshold, the identity identifier of the object located at the target position in the sixth image frame is determined as the first identity identifier.
[0029] Furthermore, it also includes:
[0030] In response to the image frame count value between the sixth image frame and the fourth image frame in the consecutive multi-frame images being greater than the third count threshold, a fourth identity identifier is set for the object at the target location in the sixth image frame, wherein the fourth identity identifier is different from the first identity identifier.
[0031] Furthermore, determining that the object at the target position in the fifth image frame is stationary based on the object identified at the target position in the fifth image frame and the object at the target position in the fourth image frame includes:
[0032] Determine the first center position and first size parameter of the object at the target location in the fourth image frame;
[0033] Determine the second center position and second size parameter of the object at the target position in the fifth image frame;
[0034] The center displacement is determined based on the first center position and the second center position, and the dimensional change rate is determined based on the first dimensional parameter and the second dimensional parameter.
[0035] In response to the center displacement being less than a first threshold and the size change rate being less than a second threshold, it is determined that the object at the target position in the fifth image frame is stationary.
[0036] An electronic device, comprising:
[0037] A counter, used for counting;
[0038] A processor is configured to acquire at least a first image frame and a second image frame, wherein the time corresponding to the first image frame is earlier than the time corresponding to the second image frame, and a target object located at a target position in the first image frame has a stationary marker; determine a first identity identifier and a first counting threshold based on the target object in the first image frame; in response to the fact that the target object is not identified at the target position in the second image frame, start counting until an object matching the target object is identified at the target position in a third image frame, wherein the time corresponding to the third image frame is later than the time corresponding to the second image frame; and in response to the fact that the image frame count value between the third image frame and the second image frame in a series of consecutive image frames is less than the first counting threshold, determine the identity identifier of the object in the third image frame as the first identity identifier. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a flowchart of a video identity processing method disclosed in an embodiment of this application;
[0041] Figure 2 This is a schematic diagram of a first image frame, a second image frame, and a third image frame disclosed in an embodiment of this application;
[0042] Figure 3 This is a flowchart of a video identity processing method disclosed in an embodiment of this application;
[0043] Figure 4 This is a flowchart of a video identity processing method disclosed in an embodiment of this application;
[0044] Figure 5 This is a flowchart of a video identity processing method disclosed in an embodiment of this application;
[0045] Figure 6a This is a schematic diagram illustrating the correspondence between N consecutive target image frames and the first, second, and third image frames disclosed in an embodiment of this application.
[0046] Figure 6b This is a schematic diagram illustrating the correspondence between N consecutive image frames and the first, second, and third image frames disclosed in an embodiment of this application.
[0047] Figure 7 This is a complete schematic diagram of a video identity processing method disclosed in an embodiment of this application;
[0048] Figure 8 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application;
[0049] Figure 9 This is a schematic diagram of the structure of a video identity processing system disclosed in an embodiment of this application. Detailed Implementation
[0050] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0051] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0052] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0053] This application discloses a video identity processing method, the flowchart of which is as follows: Figure 1 As shown, it includes:
[0054] Step S11: Obtain at least a first image frame and a second image frame. The time corresponding to the first image frame is earlier than the time corresponding to the second image frame. The target object located at the target position in the first image frame has a stationary marker.
[0055] Step S12: Determine the first identity identifier and the first counting threshold based on the target object in the first image frame;
[0056] Step S13: In response to the fact that no target object is detected at the target position in the second image frame, start counting until an object matching the target object is detected at the target position in the third image frame. The time corresponding to the third image frame is later than the time corresponding to the second image frame.
[0057] Step S14: In response to the image frame count value between the third image frame and the second image frame in a series of consecutive image frames being less than the first count threshold, the identity identifier of the object in the third image frame is determined as the first identity identifier.
[0058] Based on this, in this embodiment, in a series of consecutive images, when the target object at the target location in the first image frame has a stationary marker, a first identity identifier and a first counting threshold are determined. When no target object is identified at the target location in the second image frame, counting begins until an object matching the target object is identified at the target location in the third image frame. Then, it is determined whether the image frame count value between the third image frame and the second image frame is less than the first counting threshold. If it is less, a first identity identifier can be assigned to the object at the target location in the third image frame, thus realizing the retention of the object's identity when the object briefly disappears and then reappears in the video.
[0059] A video clip may include multiple consecutive frames of images. For example, a video clip may be a video clip taken of a mobile phone placed on a table, where the mobile phone is stationary. Each image frame in the video clip can be assigned an identity identifier. When the mobile phone in a certain image frame is partially obscured, it cannot be identified as the same object as before. A new identity identifier is assigned to the object identified in that image frame. Even if the mobile phone is identified again in subsequent image frames, the initial identity identifier of the mobile phone cannot be reassigned to the mobile phone in subsequent image frames.
[0060] Based on this, in this scheme, firstly, image frames with a stillness marker (e.g., the first image frame) are determined in a series of consecutive images. If an object in an image frame has a stillness marker, it indicates that the object is a still object. When it is determined that the target object at the target location in the first image frame has a stillness marker, the first identity identifier and the first counting threshold can be determined based on this.
[0061] Wherein, the first identity identifier is the identity identifier of the target object at the target location in the first image frame, and the first counting threshold is the image frame counting threshold for which the identity identifier of an object with a stationary marker can be retained after it disappears in subsequent image frames.
[0062] Therefore, counting begins when no target object is detected at the target location in the second image frame. This counting is used to count the number of image frames until an object matching the target object is detected at the target location in the third image frame.
[0063] The first image frame, the second image frame, and the third image frame are all image frames in a video segment composed of multiple consecutive image frames. Furthermore, the time corresponding to the first image frame in the video segment is earlier than the time corresponding to the second image frame in the video segment, and the time corresponding to the second image frame in the video segment is earlier than the time corresponding to the third image frame in the video segment.
[0064] In this system, the first image frame and the second image frame can be adjacent, meaning the first image frame is the preceding image frame of the second image frame. Of course, the first image frame can also be non-adjacent to the second image frame, but it must be ensured that the object at the target position in each image frame between the second and third image frames is identified as an object matching the target object, and the identity identifier is the first identity identifier. The second image frame is the first image frame in which no object matching the target object is identified at the target position, so counting starts from the second image frame. In the image frames after the second image frame, up to the third image frame, in the image frames between the second and third image frames, the object at the target position in each image frame cannot be identified as an object matching the target object. The third image frame is the first image frame in which the object at the target position can be identified as a match for the target object after the counting starts, so counting stops at the third image frame, and the count value obtained is determined as the image frame count value.
[0065] If an object matching the target object is identified at the target location in the third image frame, and the counting starts from the second image frame and stops at the third image frame, and the image frame count value during this process is less than the first counting threshold, then the object at the target location in the third image frame can be assigned a first identity identifier.
[0066] like Figure 2 The diagram shown is a schematic representation of the first, second, and third image frames. Figure 2 Part a represents the first image frame, part b represents the second image frame, and part c represents the third image frame. In the first image frame, there is a target object (e.g., a mobile phone) at the target location, and the identity of the target object is id1. In the second image frame, there is an object at the target location, but it is partially obscured and cannot be identified as a target object. In this case, id1 cannot be used as the identity of the object at the target location in the second image frame. In the third image frame, the object at the target location can be identified as a target object, and the image frame count value between the third image frame and the second image frame is less than the first count threshold. Therefore, id1 can be used as the identity of the object at the target location in the third image frame.
[0067] For example, if the first counting threshold is 150, then if the object with the stillness mark is determined to disappear starting from the 11th frame of a certain video segment, then counting begins until the 161st frame. If the object is detected again in a certain image frame between the 11th and 161st frames, such as the 79th frame, then at this time, the identity of the object at the target location in the 79th frame image is still the first identity.
[0068] Additionally, it should be noted that in the video identity processing method disclosed in this embodiment, the first counting threshold can also be a first time threshold. That is, timing begins when no target object is detected at the target location and stops when an object matching the target object is detected at the target location in the third image frame. The timing duration can be compared with the first time threshold. When the timing duration is less than the first time threshold, the first identity identifier of the target object can be assigned to the object at the target location in the third image frame. [After the stationary target disappears, the identity retrieval threshold is extended from the first timing duration to a second timing duration, where the second timing duration is longer than the first timing duration, to prolong the survival of the target object's identity.]
[0069] The solution disclosed in this embodiment can be applied to the field of object detection and tracking to reduce business failures caused by the disappearance of tracked objects. It specifically reduces the loss of identity due to interference in multi-target tracking in static scenes. It is particularly suitable for scenarios such as monitoring, visual inspection, and industrial automation that contain a large number of stationary or low-speed moving targets, and can improve the practicality and reliability of the overall tracking system.
[0070] The video identity processing method disclosed in this embodiment has a stationary marker on the target object located at the target position in the first image frame. A first identity identifier and a first counting threshold are determined based on the target object in the first image frame. When no target object is identified at the target position in the second image frame whose corresponding time is later than the corresponding time of the first image frame, counting begins until a matching object is identified at the target position in the third image frame whose corresponding time is later than the corresponding time of the second image frame. When the image frame count value between the third image frame and the second image frame in multiple consecutive image frames is less than the first counting threshold, the identity identifier of the object at the target position in the third image frame is determined as the first identity identifier. This solution addresses the situation where an object with a stationary marker disappears and then reappears. A first counting threshold is assigned so that as long as the object reappears at its original position within the first counting threshold range, the object's identity identifier is restored. This achieves the goal of assigning the same identity identifier to the same object at the same position within the first counting threshold range, thereby reducing the frequency of identity identifier switching and effectively preventing identity loss due to momentary interference.
[0071] This embodiment discloses a video identity processing method, the flowchart of which is as follows: Figure 3 As shown, it includes:
[0072] Step S31: Obtain at least a first image frame and a second image frame. The time corresponding to the first image frame is earlier than the time corresponding to the second image frame. The target object located at the target position in the first image frame has a stationary marker.
[0073] Step S32: Determine the first identity identifier and the first counting threshold based on the target object in the first image frame;
[0074] Step S33: In response to the fact that no target object is detected at the target position in the second image frame, start counting until an object matching the target object is detected at the target position in the third image frame. The time corresponding to the third image frame is later than the time corresponding to the second image frame.
[0075] Step S34: In response to the image frame count value between the third image frame and the second image frame in a series of consecutive image frames being less than the first count threshold, the identity identifier of the object in the third image frame is determined as the first identity identifier;
[0076] Step S35: In response to the image frame count value between the third image frame and the second image frame in a series of images being greater than the first count threshold and less than the second count threshold, determine the identity identifier of the object at the target location in the third image frame as the second identity identifier, and the object at the target location in the third image frame has a stationary sign, the second count threshold is greater than the first count threshold, and the second identity identifier is different from the first identity identifier.
[0077] In a series of multiple image frames, the target object at the target location in the first image frame has a stationary marker, thus determining the first identity of the target object in the first image frame. Based on the target object in the first image frame, a first counting threshold is determined. If the target object is not identified at the target location in the second image frame, which corresponds to a time later than the time of the first image frame, counting begins until an object matching the target object is identified at the target location in the third image frame. When the count value of the image frame is less than the first counting threshold, the identity of the object at the target location in the third image frame can be determined as the first identity. This ensures that even if an object with a stationary marker disappears briefly in an image frame, it can still recover its original identity after reappearing, preventing identity loss due to momentary interference.
[0078] Furthermore, in this embodiment, if the image frame count value between the third image frame and the second image frame in a series of consecutive image frames is greater than the first counting threshold and less than the second counting threshold, then the identity identifier of the object located at the target location in the third image frame can be determined as the second identity identifier, and the object located at the target location in the third image frame has a stationary mark, the second counting threshold is greater than the first counting threshold, and the second identity identifier is different from the first identity identifier.
[0079] If the image frame count between the third image frame and the second image frame is less than the first count threshold, it indicates that the object matching the target object at the target location only disappears briefly in a few image frames. At this time, the first identity of the target object can be recovered, that is, the identity of the object at the target location in the third image frame can be determined as the first identity, so that the first identity of the target object can be maintained for a relatively long time (i.e., the time required for the image frames between the first count threshold), avoiding the loss of identity due to momentary interference.
[0080] Additionally, a second counting threshold can be set, which is greater than the first counting threshold. When the image frame count value between the third image frame and the second image frame is greater than the first counting threshold but less than the second counting threshold, a new identity identifier (i.e., the second identity identifier) can be assigned to the object at the target location in the third image frame. Even if the object matches the target object, the original identity (i.e., the first identity identifier) cannot be assigned to it, thus achieving identity identifier replacement. At this time, the object at the target location in the third image frame that matches the target object can still have a stationary flag. That is, based on the stationary flag, it can be determined that the object at the target location in the first image frame and the object at the target location in the third image frame are the same object. However, since the image frame count value exceeds the first counting threshold but does not exceed the second counting threshold, a new identity identifier can only be assigned to it. However, the stationary flag indicates that the new identity identifier corresponds to the same object as the original identity identifier, and the object has not moved.
[0081] For example: the first counting threshold is 150, the second counting threshold is 153, and counting starts from the second image frame. If an object matching the target object is identified at the target location in the third image frame before the image frame count value reaches 150, then the object at the target location in the third image frame is assigned a first identity identifier. If an object matching the target object is identified at the target location in the third image frame before the image frame count value exceeds 150 but does not exceed 153 (e.g., the image frame count value is 152), then the object at the target location in the third image frame is assigned a second identity identifier, while retaining the static flag of the object at the target location in the third image frame. This static flag indicates that the object corresponding to the second identity identifier and the object corresponding to the first identity identifier are the same object at the same location.
[0082] The first counting threshold can be in the range of 50-300, meaning it can be any value between 50 and 300, such as 150, 50, 80, 173, 246, 300, etc. The second counting threshold is a fixed value added to the first counting threshold, which can be any value between 2 and 5. For example, if the first counting threshold is 150 and the fixed value is 3, then the second counting threshold is 153; if the first counting threshold is 80 and the fixed value is 4, then the second counting threshold is 84; if the first counting threshold is 120 and the fixed value is 5, then the second counting threshold is 125, etc.
[0083] It should be noted that when the image frame count reaches the first counting threshold, but the third image frame has not yet been identified, the first identity identifier in the identity pool can be deleted, meaning that the first identity identifier will no longer be assigned to objects in subsequent image frames.
[0084] Furthermore, the video identity processing method disclosed in this embodiment may also include:
[0085] In response to the image frame count value between the third image frame and the second image frame in a series of images being greater than the second count threshold, the identity identifier of the object located at the target location in the third image frame is determined to be the third identity identifier, and the object located at the target location in the third image frame does not have a stationary marker, and the third identity identifier is different from the first identity identifier.
[0086] If the image frame count between the third image frame and the second image frame is greater than the second count threshold, it indicates that the target object at the target location has been missing for too long. In this case, even if the same object is detected again at the same location, the original identity cannot be assigned to the object. At the same time, the stillness flag will also be deleted. That is, the object at the target location in the third image frame not only loses its identity, but also its stillness flag. At this time, a new identity can be assigned to the object at the target location in the third image frame, such as a third identity. It is only necessary to ensure that the third identity is different from the first identity. The third identity can be the same as or different from the second identity.
[0087] For example, if the first identity identifier is id:11 and the second identity identifier is id:22, then the third identity identifier can be id:22, id:33, id:43, etc.
[0088] It should be noted that in the image frames corresponding to the time period during which the target object disappears at the target location (i.e., the image frames between the second and third image frames), an object may be detected at the target location, but the detected object cannot be identified as matching the target object. This could be because the target object is significantly occluded, or because another object is located at that location; alternatively, no object may be detected at the target location, in which case the target object may have moved. However, in any of these cases, an identity marker can be withheld from assigning an identifier to the object at the target location in these image frames to ensure the accuracy of the identifier assignment.
[0089] In addition, in this embodiment, instead of using the first and second counting thresholds to count the number of passed image frames, timing begins when no target object is identified at the target location and stops when an object matching the target object is identified at the target location in the third image frame, thus determining the timing duration. In this case, the first and second time thresholds are used. If the timing duration is less than the first time threshold, it indicates that the target object only temporarily disappeared. When the target object reappears at the target location in the third image frame, the same identity identifier (i.e., the first identity identifier) is assigned to the object at the target location in the third image frame. If the target object is not identified again within the first time threshold, the first identity identifier can be used. If the time threshold is extended to a second time threshold, the timing duration is between the first and second time thresholds. After the target object reappears at the target location in the third image frame, a new identity identifier is assigned to the object at the target location in the third image frame. However, the stillness marker is still retained to clarify that the new identity identifier and the first identity identifier are the same object corresponding to the same stillness marker. This achieves the goal of maintaining the identity of the same still object through the stillness marker. At this time, the identity retention does not mean that the identity identifier remains unchanged, but rather that the stillness marker represents that different identity identifiers correspond to the same still object. If the target object is not identified again within the second time threshold, the stillness marker can be removed.
[0090] The video identity processing method disclosed in this embodiment distinguishes whether an object matching the target object at the target location is temporarily missing or permanently replaced by comparing the image frame count value between the third image frame and the second image frame with the first and second count thresholds. If the image frame count value is less than the first count threshold, it can be determined that the object matching the target object at the target location is temporarily missing in the image frame. After it reappears, it can still be assigned its original identity identifier, i.e., the first identity identifier. If the image frame count value is greater than the first count threshold and less than the second count threshold, it can be determined that the object matching the target object at the target location will be permanently replaced in the image frame. Even if it reappears, it will not be assigned its original identity identifier, but a new identity identifier will be assigned to it. However, at this time, the static mark of the object still exists, and the object is still a static object, which effectively prevents confusion between the old and new identities and improves the accuracy of the data.
[0091] This embodiment discloses a video identity processing method, the flowchart of which is as follows: Figure 4 As shown, it includes:
[0092] Step S41: Obtain at least a first image frame and a second image frame. The time corresponding to the first image frame is earlier than the time corresponding to the second image frame. The target object located at the target position in the first image frame has a stationary marker.
[0093] Step S42: Determine the first identity identifier, the first counting threshold, and the first identity determination threshold based on the target object in the first image frame;
[0094] Step S43: In response to the second image frame not meeting the first identity determination threshold, it is determined that no target object is identified at the target position of the second image frame, and counting begins until an object matching the target object is identified at the target position of the third image frame. The time corresponding to the third image frame is later than the time corresponding to the second image frame.
[0095] Step S44: In response to the fact that the image frame count value between the third image frame and the second image frame in a series of consecutive image frames is less than the first count threshold, the identity identifier of the object in the third image frame is determined as the first identity identifier.
[0096] In a series of multiple image frames, the target object at the target location in the first image frame has a stationary marker, thus determining the first identity of the target object in the first image frame. Based on the target object in the first image frame, a first counting threshold is determined. If the target object is not identified at the target location in the second image frame, which corresponds to a time later than the time of the first image frame, counting begins until an object matching the target object is identified at the target location in the third image frame. When the count value of the image frame is less than the first counting threshold, the identity of the object at the target location in the third image frame can be determined as the first identity. This ensures that even if an object with a stationary marker disappears briefly in an image frame, it can still recover its original identity after reappearing, preventing identity loss due to momentary interference.
[0097] Specifically, determining whether an object matching the target object is identified at the target location of the second image frame can be achieved by: determining a first identity determination threshold based on the target object in the first image frame; in response to the second image frame not meeting the first identity determination threshold, determining that no object matching the target object in the first image frame is identified at the target location of the second image frame; and in response to the second image frame meeting the first identity determination threshold, determining that an object matching the target object in the first image frame is identified at the target location of the second image frame, and determining the identity identifier of the object at the target location of the second image frame as the first identity identifier.
[0098] Based on the fact that the target object in the first image frame has a stationary marker, a first identity determination threshold is determined. To determine whether the second image frame meets the first identity determination threshold, specifically: if no object is identified at the target location in the second image frame, it can be directly determined that the second image frame does not meet the first identity determination threshold, and it can be directly determined that no object matching the target object is identified at the target location in the second image frame.
[0099] If an object is identified at the target location in the second image frame, the intersection-over-union ratio (IoU) between the object at the target location in the second image frame and the target object at the target location in the first image frame can be calculated. This IoU is then compared with a first identity determination threshold. If the IoU is less than the first identity determination threshold, the second image frame is determined to meet the first identity determination threshold, and an object matching the target object is identified at the target location in the second image frame. If the IoU is not less than the first identity determination threshold, the second image frame is determined not to meet the first identity determination threshold, and no object matching the target object is identified at the target location in the second image frame.
[0100] The first identity determination threshold can be specifically defined as the sum of the intersection-union ratio (IoU) threshold and the weighted value, i.e., IoU + α, where IoU is the IoU threshold and α is the weighted value. The weighted value α can be a value in the range of 0.15-0.3, and it can consist of three parts: the initial weighted value (which can be fixed at 0.05), the adjustment value (which can be adjusted multiple times according to the actual situation, with each adjustment increment being 0.02), and the maximum weighted value. If the weighted value α after multiple adjustments exceeds the maximum weighted value, then the weighted value α is directly determined as the maximum weighted value. If the weighted value α after multiple adjustments still does not exceed the maximum weighted value, then the actual weighted value after multiple adjustments is used.
[0101] It should be noted that determining whether an object matching the target object is identified at the target location in any image frame is based on the identity determination threshold, which is determined based on whether the target object has a stationary marker.
[0102] If the target object in the first image frame has a stationary marker, then the determined identity determination threshold is the first identity determination threshold. If the target object in the first image frame does not have a stationary marker, then the determined identity determination threshold is the second identity determination threshold. The first identity determination threshold is greater than the second identity determination threshold. That is, when the target object has a stationary marker, the determination of whether an object matching the target object is identified at the target position in the second image frame can be a larger determination range. However, when the target object does not have a stationary marker, the determination of whether an object matching the target object is identified at the target position in the image frame can be a relatively smaller determination range, in order to ensure the accuracy of the determination.
[0103] Since the target object in the first image frame has a stationary marker, the first identity determination threshold is used when determining the object to match the target object in any image frame between the second and third image frames. However, when determining the object to match the target object in another image frame after the stationary marker disappears, the second identity determination threshold is used.
[0104] The first identity determination threshold can be specifically defined as the sum of the intersection-union ratio threshold and the weighted value, i.e., IoU+α, and the second identity determination threshold can be specifically defined as the intersection-union ratio threshold, i.e., IoU.
[0105] The video identity processing method disclosed in this embodiment determines a first identity identifier, a first counting threshold, and a first identity determination threshold based on the target object in the first image frame. By judging whether the second image frame meets the first identity determination threshold, it determines whether an object matching the target object is identified at the target position in the second image frame. The matching degree threshold is set by the first identity determination threshold. Only when the matching degree does not reach the first identity determination threshold can it be determined that the target object may have temporarily disappeared, and only then can the subsequent counting process be entered. This ensures the rigor of identity preservation and improves the credibility of identity recovery.
[0106] This embodiment discloses a video identity processing method, the flowchart of which is as follows: Figure 5 As shown, it includes:
[0107] Step S51: Determine that the consecutive multi-frame images include N consecutive target image frames, where the position of the target object in the N consecutive target image frames has not moved, and N is a positive integer greater than 1;
[0108] Step S52: Set a stillness flag for the target object in the target image frame;
[0109] Step S53: Obtain at least a first image frame and a second image frame. The time corresponding to the first image frame is earlier than the time corresponding to the second image frame. The target object located at the target position in the first image frame has a stationary marker.
[0110] Step S54: Determine the first identity identifier and the first counting threshold based on the target object in the first image frame;
[0111] Step S55: In response to the fact that no target object is detected at the target position in the second image frame, start counting until an object matching the target object is detected at the target position in the third image frame. The time corresponding to the third image frame is later than the time corresponding to the second image frame.
[0112] Step S56: In response to the image frame count value between the third image frame and the second image frame in a series of consecutive image frames being less than the first count threshold, the identity identifier of the object in the third image frame is determined as the first identity identifier.
[0113] In a series of multiple image frames, the target object at the target location in the first image frame has a stationary marker, thus determining the first identity of the target object in the first image frame. Based on the target object in the first image frame, a first counting threshold is determined. If the target object is not identified at the target location in the second image frame, which corresponds to a time later than the time of the first image frame, counting begins until an object matching the target object is identified at the target location in the third image frame. When the count value of the image frame is less than the first counting threshold, the identity of the object at the target location in the third image frame can be determined as the first identity. This ensures that even if an object with a stationary marker disappears briefly in an image frame, it can still recover its original identity after reappearing, preventing identity loss due to momentary interference.
[0114] Specifically, the setting of the stillness flag can be as follows: determine that there are N consecutive target image frames in a series of consecutive images, and the position of the target object in the N consecutive target image frames has not moved, where N is a positive integer greater than 1, and set a stillness flag for the target object in the target image frame.
[0115] That is, only when the target object is included in all N consecutive frames of images, and the position of the target object remains unchanged in all N consecutive frames, can these N consecutive frames be defined as N consecutive target image frames, and a stationary flag be set for the target object in the target image frames.
[0116] Setting a stillness flag for a target object in a target image frame can be done by setting the stillness flag only for the Nth frame of a consecutive N target image frame. However, in each of these N consecutive frames (from frame 1 to frame N-1), the target object has not moved for the entire N frames. Therefore, the target object in any of these frames cannot have a stillness flag set. For example, N can be any value from 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 50, etc. Taking N=5 as an example, if the target object is present in all 5 consecutive frames and its position is the same across these 5 frames, then the stillness flag can be set for the target object in the 5th frame. The target object in the 5th frame can be identified as a still object. However, the target objects in the 1st to 4th frames of the same 5-frame sequence can only be identified as still within their respective frames, not as still objects, and therefore cannot have a stillness flag set.
[0117] To determine whether the position of a target object has remained unchanged across N consecutive frames, it is necessary to ensure that the position of the target object in each of the N consecutive frames has not changed relative to its position in the previous frame. Whether the position of the target object in each frame has changed relative to its position in the previous frame can be determined by whether a matching object is identified at the target location in each frame. That is, if a matching object is identified at the target location in a frame, it can be determined that the position of the target object in that frame has not changed relative to its position in the previous frame; if no matching object is identified at the target location in a frame, it can be determined that the position of the target object in that frame has changed relative to its position in the previous frame.
[0118] Specifically, determining whether an object matching the target object in the previous frame is identified at the target location in each frame can be done by determining whether the object detected at the target location in each frame meets the identity determination threshold with the object detected in the previous frame. The identity determination threshold is related to whether the object at the target location has a stationary marker. If there is a stationary marker, the first identity determination threshold is determined; if there is no stationary marker, the second identity determination threshold is determined.
[0119] In other words, when determining whether an object matching the target object is identified at the target location in the second image frame, since the target object at the target location in the first image frame has a stationary marker, a first identity determination threshold can be determined. (It should be noted that if the image frame count between the third and second image frames is greater than the second count threshold, the stationary marker of the object at the target location in the third image frame is deleted. That is, the stationary marker is only deleted when the image frame count of the target object disappearing at the target location reaches the second count threshold. Therefore, as long as it is within the range of the second count threshold, the first identity determination threshold can be used to determine whether an object matching the target object is identified at the target location in the corresponding image frame.) The first image frame is determined by summing the Intersection over Union (IoU) threshold and the weighted value (IoU+α) of the target object in the previous image frame. If the target object in the second image frame matches the target object in the first image frame, it can be determined that the target object in the second image frame has not moved relative to the target object in the first image frame. If the target object in the second image frame does not match the target object, it can be determined that the target object in the second image frame has moved relative to the target object in the first image frame.
[0120] Accordingly, when no stationary flag is set, the determined identity determination threshold is the second identity determination threshold, which can be specifically defined as follows:
[0121] A fourth image frame and a fifth image frame are obtained. The fourth image frame is an image frame adjacent to the fifth image frame in a series of consecutive images, and the corresponding time is earlier than the corresponding time of the fifth image frame. The object at the target position in the fourth image frame does not have a stationary marker. The fourth image frame is a frame image where the object at the target position in the (N-1)th consecutive frame has not moved. Based on the object identified at the target position in the fifth image frame and the object at the target position in the fourth image frame, it is determined that the object at the target position in the fifth image frame is stationary. In response to the object at the target position in the fifth image frame being stationary and the object at the target position in the fourth image frame not having a stationary marker, a second identity determination threshold is determined. In response to the object at the target position in the fifth image frame and the object at the target position in the fourth image frame satisfying the second identity determination threshold, based on the fact that the object at the target position in the fourth image frame is a frame image where the object at the target position in the (N-1)th consecutive frame has not moved, the fifth image frame is determined to be a frame image where the object at the target position in the Nth consecutive frame has not moved. A stationary marker is set for the object at the target position in the fifth image frame. It is determined that the identity identifier of the object at the target position in the fifth image frame is the same as the identity identifier of the object at the target position in the fourth image frame, which is the first identity identifier.
[0122] The fourth image frame is the frame image in which the object at the target position in the N-1 consecutive frames has not moved. For example, if N=5, then the fourth image frame is the fourth frame image in the four consecutive frames in which the object at the target position has not moved.
[0123] Both the fourth and fifth image frames are frame images in a video segment consisting of multiple consecutive frames. The fourth and fifth image frames are adjacent frame images, and the time corresponding to the fourth image frame is earlier than the time corresponding to the fifth image frame. Since the fourth image frame is the frame image in which the object at the target position in the (N-1)th consecutive frame image has not moved, as long as it is determined that the object at the target position in the fifth image frame has not moved relative to the object at the target position in the fourth image frame, the fifth image frame can be determined as the Nth frame image in the N consecutive frame images in which the object at the target position has not moved. Thus, a stationary flag can be set for the object at the target position in the fifth image frame.
[0124] To determine whether the object at the target location in the fifth image frame has not moved relative to the object at the target location in the fourth image frame, we can first determine whether the object at the target location in the fifth image frame is stationary based on the object identified at the target location in the fifth image frame and the object at the target location in the fourth image frame. That is, we first determine whether the object at the target location in the fifth image frame is stationary at the current moment. When it is determined that it is stationary at the current moment, we need to further determine whether it meets the second identity determination threshold. This determines whether the object at the target location in the fifth image frame has not moved relative to the object at the target location in the fourth image frame.
[0125] If the object at the target location in the fifth image frame is not stationary at the current moment, it indicates that the object at the target location in the fifth image frame is moving at the current moment. In this case, the current process is terminated, and the identity identifier is assigned according to the identity identifier assignment method of the moving object. However, the assignment of identity identifiers for moving objects is not within the scope of this embodiment.
[0126] If the object at the target location in the fifth image frame is stationary at the current moment, then since the object at the target location does not have a stationary flag, the second identity determination threshold, namely the Intersection over Union (IoU) threshold, is determined. At this time, it is determined whether the object at the target location in the second image frame and the object at the target location in the fourth image frame satisfy the second identity determination threshold. If they do, it indicates that the object at the target location in the fifth image frame has not moved relative to the object at the target location in the fourth image frame. At this time, the condition that the position of the target object has not moved in N consecutive image frames is met, and a stationary flag can be set for the target object at the target location in the fifth image frame.
[0127] In addition, since the object at the target location in the fifth image frame has not moved relative to the object at the target location in the fourth image frame, if both the location and the object match, the identity identifier of the object at the target location in the fourth image frame can be assigned to the identity identifier of the object at the target location in the fifth image frame. At this time, the identity identifiers of the objects at the target location in the consecutive N frames are all the same, and they are all the first identity identifier.
[0128] It should be noted that, since the object at the target location in the first image frame has a stationary marker and its identification is the first identification marker, the fifth image frame and the first image frame can be the same image frame. That is, the first image frame is the image frame where the position of the Nth target object has not moved. Figure 6aThe diagram illustrates the correspondence between N consecutive target image frames and the first, second, and third image frames. It includes: N consecutive target image frames 61, where the Nth target image frame is the first image frame 62, the second image frame 63, and the third image frame 64. The first image frame 62 includes the target object 621 at the target location and a stationary marker 622 (represented by a right-angled triangle in the diagram; however, it can also be represented in other ways, but this is only an example). The time corresponding to the second image frame 63 is later than the time corresponding to the first image frame 62, and the time corresponding to the third image frame 64 is later than the time corresponding to the second image frame 63.
[0129] Alternatively, it can be: the fifth image frame is the image frame preceding the first image frame in a video segment composed of multiple consecutive image frames. That is, firstly, a stillness marker is set for the target object at the target location in the Nth target image frame using N consecutive target image frames. Then, the first image frame appears in the video segment composed of these multiple consecutive image frames. If an object matching the target object with the stillness marker is identified at the target location in the first image frame, the same stillness marker is set for the object at the target location in the first image frame. This indicates that the object at the target location in the first image frame is the same as the target object at the target location in the N consecutive target image frames, and that the object at the target location in the first image frame is a still object. Figure 6b The diagram illustrates the correspondence between N consecutive image frames and the first, second, and third image frames, including: N consecutive target image frames 61, a first image frame 62, a second image frame 63, and a third image frame 64. Each target image frame in the N consecutive target image frames includes a target object 611 at the target location and a stationary marker 612 set for the target object 611 at the target location (represented by a right-angled triangle in the diagram; of course, it can also be represented in other ways, but this is only an example). The time corresponding to the first image frame 62 is later than the time corresponding to each of the N consecutive target image frames, the time corresponding to the second image frame 63 is later than the time corresponding to the first image frame 62, and the time corresponding to the third image frame 64 is later than the time corresponding to the second image frame 63.
[0130] Furthermore, the video identity processing method disclosed in this embodiment may also include:
[0131] In response to the fact that the object at the target location in the fifth image frame does not meet the second identity determination threshold with the object at the target location in the fourth image frame, counting begins until an object matching the object at the target location in the fourth image frame is identified at the target location in the sixth image frame. The sixth image frame is an image frame in a series of consecutive images whose corresponding time is later than the corresponding time in the fifth image frame. A third counting threshold is determined based on the fact that the object at the target location in the fourth image frame does not have a stationary marker. In response to the fact that the image frame count value between the sixth image frame and the fourth image frame in a series of consecutive images is less than the third counting threshold, the identity identifier of the object at the target location in the sixth image frame is determined as the first identity identifier.
[0132] If the object at the target location in the fifth image frame does not meet the second identity determination threshold compared to the object at the target location in the fourth image frame, it indicates that the object at the target location in the fifth image frame has moved relative to the object at the target location in the fourth image frame. This movement may be a slight shaking of the target object, or it may be that the object at the corresponding location in the fifth image frame is no longer the target object, but has been replaced by another object. Therefore, at this time, the identity identifier of the object at the target location in the fourth image frame cannot be directly assigned to the object at the target location in the fifth image frame, nor can the fifth image frame be determined as the Nth consecutive target image frame. Since the condition that the position of the target object has not moved in the N consecutive image frames has not been met, it is necessary to start from the image frames after the fifth image frame to determine whether there is a N consecutive image frames in which the position of the target object has not moved.
[0133] At this point, in order to determine whether the object at the target location in the fifth image frame is slightly shaking or has switched objects, further judgment is needed. This judgment is made using a third counting threshold. The third counting threshold is determined based on the fact that the object at the target location in the fourth image frame does not have a stationary marker. The counting threshold corresponding to the absence of a stationary marker should be less than the counting threshold corresponding to the presence of a stationary marker. That is, the third counting threshold is less than the first counting threshold. For example, the first counting threshold is 150 and the third counting threshold is 3; or the first counting threshold is 100 and the third counting threshold is 10, etc.
[0134] The first counting threshold can be any value between 50 and 300. Correspondingly, the third counting threshold can also be any value within a range of values, such as any value between 1 and 10, which can be 2, 3, 5, 7, etc.
[0135] Of course, the numerical range corresponding to the first counting threshold can also be other ranges, such as 100-500, that is, the first counting threshold can be any value between 100 and 500; the numerical range corresponding to the third counting threshold can also be other ranges, such as 10-25, that is, the third counting threshold can be any value between 10 and 25. This is only an example and is not specifically limited.
[0136] When the object at the target location in the fifth image frame does not meet the second identity determination threshold compared to the object at the target location in the fourth image frame, counting begins until the third counting threshold is reached.
[0137] If an object matching the object at the target location in the fourth image frame is identified at the target location in the sixth image frame, and the image frame count value between the sixth and fourth image frames is less than the third counting threshold (i.e., within the third counting threshold), then the identity identifier of the object at the target location in the fourth image frame is still retained in the identity pool. The identity identifier of the object at the target location in the fourth image frame can be directly assigned to the object at the target location in the sixth image frame. Since the identity identifier of the object at the target location in the fourth image frame is the first identity identifier, the identity identifier of the object at the target location in the sixth image frame is also the first identity identifier. That is, the object at the target location in the sixth image frame and the object at the target location in the fourth image frame are the same object, and their positions have not changed.
[0138] Specifically, determining whether an object matching the object at the target location in the sixth image frame is identified at the target location in the fourth image frame can be done by: determining whether the object detected in the sixth image frame and the object at the target location in the fourth image frame meet the second identity determination threshold. If they meet the threshold, it can be determined that an object matching the object at the target location in the sixth image frame is identified at the target location in the fourth image frame; if they do not meet the threshold, it can be determined that no object matching the object at the target location in the fourth image frame is identified at the target location in the sixth image frame.
[0139] Furthermore, if the image frame count value between the sixth image frame and the fourth image frame is greater than the third count threshold, a fourth identity identifier is set for the object at the target location in the sixth image frame. The fourth identity identifier is different from the first identity identifier.
[0140] If the image frame count between the sixth and fourth image frames is less than the third counting threshold, it indicates that the object at the target location in the fourth image frame only briefly disappeared or failed to be identified in subsequent image frames. At this time, the first identity of the object at the target location in the fourth image frame is still retained in the identity pool. Therefore, when an object matching the object at the target location in the fourth image frame is identified again within the third counting threshold, the first identity can be directly assigned to the object at the target location in the sixth image frame.
[0141] The third counting threshold indicates that if no object matching the target location in the fourth image frame is identified again within the third counting threshold, the identity identifier of the object at the target location in the fourth image frame will be deleted. Even if an object matching the target location in the fourth image frame is identified in a subsequent image frame, an identity identifier (e.g., the fourth identity identifier) will be reassigned to it, and the first identity identifier will not be reassigned to the re-identified object.
[0142] The fourth identity identifier differs from the first identity identifier. In a video segment composed of multiple consecutive frames, objects identified in each frame are assigned identities according to a pre-defined identifier allocation rule. For example, the first object identified in the first frame of the video segment is assigned the identity identifier id: 101, the second object is assigned id: 102, and so on. Therefore, when the object at the target location in the fourth image frame of N-1 consecutive frames is identified by the first identity identifier (e.g., id: 132), and the frame count between the sixth and fourth image frames exceeds a third counting threshold, a fourth identity identifier (e.g., id: 133) is assigned to the object at the target location in the sixth image frame. This fourth identity identifier differs from the first identity identifier.
[0143] In another embodiment, if the image frame count value between the sixth image frame and the fourth image frame is less than the third count threshold, then the first identity threshold can be directly determined as the identity identifier of the object at the target location in the sixth image frame. In this case, the identity identifier of the object at the target location in the sixth image frame is id: 132.
[0144] In another embodiment, in the fifth image frame preceding the sixth image frame, if the object at the target location in the fifth image frame has not moved relative to the object at the target location in the fourth image frame, then the identity of the object at the target location in the fifth image frame can be configured as the first identity (e.g., id: 132). Continuing to detect image frames after the fifth image frame in the video segment, the first image frame can be either the fifth image frame or an image frame after the fifth image frame. Regardless of whether the first image frame is the fifth image frame or an image frame after the fifth image frame, the identity of the target object at the target location in the first image frame is always the first identity (e.g., id: 132). For the third image frame following the first image frame, if the image frame count value between the third image frame and the second image frame is less than the first count threshold, then the first identity (e.g., id: 132) Determine the identity of the object at the target location in the third image frame; if the image frame count value between the third image frame and the second image frame is greater than the first count threshold and less than the second count threshold, then the object at the target location in the third image frame can be assigned a second identity (e.g., id: 135); if the image frame count value between the third image frame and the second image frame is greater than the second count threshold, then the object at the target location in the third image frame is assigned a third identity. If the identity should be assigned according to the identity allocation rule as id: 135, then id: 135 is directly determined as the third identity and assigned to the object at the target location in the third image frame; if the identity should be assigned according to the identity allocation rule as id: 138, then id: 138 is directly determined as the third identity and assigned to the object at the target location in the third image frame.
[0145] The video identity processing method disclosed in this embodiment sets a stillness flag for the target object in a target image frame only when the position of the target object in N consecutive target image frames has not moved. For the first image frame with the stillness flag, counting begins when no target object is detected at the target position in the second image frame, continuing until a matching object is detected at the target position in the third image frame. When the image frame count between the third and second image frames is less than a first counting threshold determined based on the target object with the stillness flag, the object at the target position in the third image frame is assigned a first identity identifier. This scheme automatically determines the target objects in the target image frames that can be set with the stillness flag from all tracked objects using the objective and calculable standard that the target object has not moved in N consecutive target image frames. These objects are prone to losing their identity due to slight jitter or brief occlusion. This embodiment, by adding the stillness flag setting and determining the first counting threshold corresponding to the relevant target object, ensures that as long as the target object reappears within the first counting threshold, its original identity identifier can be assigned, effectively solving the problem of identity loss due to slight jitter or brief occlusion.
[0146] Furthermore, in the video identity processing method disclosed in this embodiment, determining that the object at the target position in the fifth image frame is stationary based on the object identified at the target position in the fifth image frame and the object at the target position in the fourth image frame can be specifically as follows:
[0147] Determine the first center position and first size parameter of the object at the target position in the fourth image frame; determine the second center position and second size parameter of the object at the target position in the fifth image frame; determine the center displacement based on the first center position and the second center position, and determine the size change rate based on the first size parameter and the second size parameter; in response to the center displacement being less than a first threshold and the size change rate being less than a second threshold, determine that the object at the target position in the fifth image frame is stationary.
[0148] To determine whether the object at the target location in the fifth image frame is stationary, it is necessary to determine the center position of the object at the target location in the fifth image frame, namely the second center position c2, and also to determine the center position of the object at the target location in the fourth image frame, namely the first center position c1.
[0149] In addition, it is necessary to determine the size parameter of the object at the target position in the fifth image frame, namely the second size parameter s2, and it is also necessary to determine the size parameter of the object at the target position in the fourth image frame, namely the first size parameter s1.
[0150] Next, the center offset of the object at the target position in the fifth image frame relative to the object at the target position in the fourth image frame is determined, i.e., ∆c = c2 - c1. It is also necessary to determine the size change rate of the object at the target position in the fifth image frame relative to the object at the target position in the fourth image frame, i.e., ∆s = s2 - s1. Wherein, ∆c is the center offset of the object at the target position in the fifth image frame relative to the object at the target position in the fourth image frame, and ∆s is the size change rate of the object at the target position in the fifth image frame relative to the object at the target position in the fourth image frame.
[0151] Finally, the center offset is compared with the first threshold, and the size change rate is compared with the second threshold, so as to determine whether the object at the target location in the fifth image frame is stationary in the current frame based on the comparison results.
[0152] If the center offset is less than the first threshold and the size change rate is less than the second threshold, it can be determined that the object at the target position in the fifth image frame is stationary in the current frame; if the center offset is greater than the first threshold, or the size change rate is greater than the second threshold, it can be determined that the object at the target position in the fifth image frame is moving in the current frame.
[0153] It should be noted that determining whether an object in any image frame is stationary can be achieved using the method disclosed in this embodiment. Here, only the fourth and fifth image frames are used as examples for illustration.
[0154] Subsequent determinations can only be made if the object at the target location is stationary in the current frame. For example, if there is a stationary marker, the first identity determination threshold is used to determine whether an object matching the target object is identified at the target location in the current image frame. If an object matching the target object is identified, the first identity identifier of the target object is directly assigned to the object at the target location in the current image frame. If no object is identified, the determination of whether the object at the target location has moved in the next frame is continued, and counting begins until an object matching the target object is identified in a certain frame and the counting stops.
[0155] Specifically, a complete schematic diagram of the video identity processing method disclosed in this embodiment can be seen as follows: Figure 7 As shown, it includes:
[0156] Step S701: Obtain the k-th frame image;
[0157] Step S702: Determine ∆c and ∆s based on the k-th frame image and the (k-1)-th frame image;
[0158] Step S703: Determine whether the object at the target position in the k-th frame image is stationary based on ∆c and ∆s. If it is stationary, proceed to step S704; if it is not stationary, proceed to step S718.
[0159] Step S704: If stationary, determine whether there is a stationary marker on the object at the target location. If there is, proceed to step S705; otherwise, proceed to step S712.
[0160] Step S705: If yes, determine whether an object matching the target object is identified at the target location of the k-th frame image by using the first identity determination threshold. If yes, proceed to step S706; otherwise, proceed to step S707.
[0161] Step S706: Assign the first identity identifier to the object at the target location in the k-th frame image. The first identity identifier is the identity identifier of the object corresponding to the stillness marker.
[0162] Step S707: Start counting and return to step S701 to continue detecting the (k+1)th frame image in the same way as the kth frame image.
[0163] Step S708: When an object matching the target object is identified at the target position in the (k+n1)th frame of the image, the counting stops, and it is determined whether the image frame count value (n1) has reached the first counting threshold.
[0164] Step S709: If the first counting threshold is not reached, assign a first identity identifier to the object at the target location in the k+n1 frame image and retain the stationary flag;
[0165] Step S710: If the image frame count value (n1) is between the first count threshold and the second count threshold, assign a second identity identifier to the object at the target location in the k+n1th frame image and retain the stationary flag;
[0166] Step S711: If the image frame count value (n1) is greater than the second count threshold, assign a third identity identifier to the object at the target location in the k+n1th frame image and delete the stillness flag;
[0167] Step S712: Determine whether an object matching the target object is identified at the target location of the k-th frame image by using the second identity determination threshold. If yes, proceed to step S713; otherwise, proceed to step S714.
[0168] Step S713: Assign the first identity identifier to the object at the target location in the k-th frame image, and determine whether N consecutive frames have been reached. If so, set the stillness flag.
[0169] Step S714: Start counting and return to step S701 to continue detecting the (k+1)th frame image in the same way as the kth frame image.
[0170] Step S715: When an object matching the target object is identified at the target position in the (k+n2)th frame of the image, stop counting and determine whether the image frame count value (n2) has reached the third counting threshold.
[0171] Step S716: If the third counting threshold is not reached, assign a first identity identifier to the object at the target location in the k+n2th frame image;
[0172] Step S717: If the third counting threshold is reached, assign a fourth identity identifier to the object at the target location in the k+n2th frame image;
[0173] Step S718: Determine the identity identifier of the object at the target location in the k-th frame image according to the video identity processing method for moving targets.
[0174] The video identity processing method disclosed in this embodiment accurately quantifies the subjective state of stillness through center displacement and size change rate, eliminating ambiguity caused by manual judgment or simple rules. It requires both center displacement and size change rate to be satisfied simultaneously to determine stillness in the current frame, effectively avoiding misjudgments that may occur when relying on a single indicator. The solution disclosed in this embodiment effectively reduces the occurrence of identity association errors or loss during long-term identity retention, providing an effective identity consistency solution for quality inspection, monitoring, inventory, and other scenarios in the manufacturing process.
[0175] This embodiment discloses an electronic device, the structural schematic diagram of which is shown below. Figure 8 As shown, it includes:
[0176] Counter 81 and processor 82.
[0177] Counter 81 is used for counting;
[0178] The processor 82 is configured to acquire at least a first image frame and a second image frame, wherein the time corresponding to the first image frame is earlier than the time corresponding to the second image frame, and the target object located at the target position in the first image frame has a stationary marker; determine a first identity identifier and a first counting threshold based on the target object in the first image frame; in response to the fact that no target object is identified at the target position in the second image frame, start counting until an object matching the target object is identified at the target position in the third image frame, wherein the time corresponding to the third image frame is later than the time corresponding to the second image frame; in response to the fact that the image frame count value between the third image frame and the second image frame in a series of consecutive image frames is less than the first counting threshold, determine the identity identifier of the object in the third image frame as the first identity identifier.
[0179] The electronic device disclosed in this embodiment is implemented based on the video identity processing method disclosed in the above embodiments, and will not be described again here.
[0180] The electronic device disclosed in this embodiment has a stationary marker on the target object located at the target position in the first image frame. A first identity identifier and a first counting threshold are determined based on the target object in the first image frame. When no target object is detected at the target position in the second image frame whose corresponding time is later than the corresponding time of the first image frame, counting begins until a matching object is detected at the target position in the third image frame whose corresponding time is later than the corresponding time of the second image frame. When the image frame count value between the third image frame and the second image frame in multiple consecutive image frames is less than the first counting threshold, the identity identifier of the object at the target position in the third image frame is determined as the first identity identifier. This solution addresses the situation where an object with a stationary marker disappears and then reappears. A first counting threshold is assigned so that if the object reappears at its original position within the first counting threshold range, the object's identity identifier is restored. This achieves the goal of assigning the same identity identifier to the same object at the same position within the first counting threshold range, thereby reducing the frequency of identity identifier switching and effectively preventing identity loss due to momentary interference.
[0181] This embodiment discloses a video identity processing system, the structural diagram of which is shown below. Figure 9 As shown, it includes:
[0182] The unit includes a obtaining unit 91, a first determining unit 92, an identifying unit 93, and a second determining unit 94.
[0183] The obtaining unit 91 is used to obtain at least a first image frame and a second image frame. The time corresponding to the first image frame is earlier than the time corresponding to the second image frame. The target object located at the target position in the first image frame has a stationary mark.
[0184] The first determining unit 92 is used to determine a first identity identifier and a first counting threshold based on the target object in the first image frame;
[0185] The recognition unit 93 is used to start counting in response to the fact that no target object is recognized at the target position of the second image frame, until an object matching the target object is recognized at the target position of the third image frame, the time corresponding to the third image frame being later than the time corresponding to the second image frame.
[0186] The second determining unit 94 is used to determine the identity of the object in the third image frame as the first identity in response to the image frame count value between the third image frame and the second image frame in a series of multiple image frames being less than the first counting threshold.
[0187] The video identity processing system disclosed in this embodiment is implemented based on the video identity processing method disclosed in the above embodiment, and will not be described again here.
[0188] The video identity processing system disclosed in this embodiment has a stationary marker on the target object located at the target position in the first image frame. A first identity identifier and a first counting threshold are determined based on the target object in the first image frame. When no target object is identified at the target position in the second image frame whose corresponding time is later than the corresponding time of the first image frame, counting begins until a matching object is identified at the target position in the third image frame whose corresponding time is later than the corresponding time of the second image frame. When the image frame count value between the third image frame and the second image frame in multiple consecutive image frames is less than the first counting threshold, the identity identifier of the object at the target position in the third image frame is determined as the first identity identifier. This solution addresses the situation where an object with a stationary marker disappears and then reappears. A first counting threshold is assigned so that if the object reappears at its original position within the first counting threshold range, the object's identity identifier is restored. This achieves the goal of assigning the same identity identifier to the same object at the same position within the first counting threshold range, thereby reducing the frequency of identity identifier switching and effectively preventing identity loss due to momentary interference.
[0189] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0190] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred 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 readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0191] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0192] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A video identity processing method, comprising: At least a first image frame and a second image frame are obtained, the time corresponding to the first image frame is earlier than the time corresponding to the second image frame, and the target object located at the target position in the first image frame has a stationary marker. A first identity identifier and a first counting threshold are determined based on the target object in the first image frame; In response to the fact that the target object is not detected at the target location in the second image frame, counting begins until an object matching the target object is detected at the target location in the third image frame, wherein the time corresponding to the third image frame is later than the time corresponding to the second image frame. In response to the fact that the image frame count value between the third image frame and the second image frame in a series of consecutive image frames is less than the first count threshold, the identity identifier of the object in the third image frame is determined to be the first identity identifier.
2. The method according to claim 1, further comprising: In response to the fact that the image frame count value between the third image frame and the second image frame in the consecutive multi-frame images is greater than the first counting threshold and less than the second counting threshold, the identity identifier of the object located at the target location in the third image frame is determined to be the second identity identifier, and the object located at the target location in the third image frame has the stationary mark, the second counting threshold is greater than the first counting threshold, and the second identity identifier is different from the first identity identifier.
3. The method according to claim 2, further comprising: In response to the image frame count value between the third image frame and the second image frame in the consecutive multi-frame images being greater than the second count threshold, the identity identifier of the object located at the target location in the third image frame is determined to be a third identity identifier, and the object located at the target location in the third image frame does not have the stationary mark, and the third identity identifier is different from the first identity identifier.
4. The method according to claim 1, wherein the response to the target object not being detected at the target location in the second image frame includes: A first identity determination threshold is determined based on the target object in the first image frame; In response to the second image frame not meeting the first identity determination threshold, it is determined that no object matching the target object in the first image frame is identified at the target location of the second image frame; In response to the second image frame satisfying the first identity determination threshold, it is determined that an object matching the target object in the first image frame is identified at the target location of the second image frame, and the identity identifier of the object at the target location of the second image frame is determined as the first identity identifier.
5. The method according to claim 1, further comprising: It is determined that the consecutive multi-frame images include N consecutive target image frames, and the position of the target object in the N consecutive target image frames has not moved, where N is a positive integer greater than 1; Set a stillness flag for the target object in the target image frame.
6. The method according to claim 5, wherein setting a stillness flag for the target object in the target image frame comprises: Obtain a fourth image frame and a fifth image frame. The fourth image frame is an image frame that is adjacent to the fifth image frame in the consecutive multi-frame images and whose corresponding time is earlier than the time corresponding to the fifth image frame. The object at the target position in the fourth image frame does not have a stationary marker. The fourth image frame is a frame image in which the object at the target position has not moved in the (N-1)th consecutive frame. Based on the object identified at the target location in the fifth image frame and the object at the target location in the fourth image frame, it is determined that the object at the target location in the fifth image frame is stationary. In response to the object at the target location being stationary in the fifth image frame and the object at the target location not having a stationary marker in the fourth image frame, a second identity determination threshold is determined. In response to the fact that the object at the target position in the fifth image frame and the object at the target position in the fourth image frame satisfy the second identity determination threshold, based on the fact that the fourth image frame is a consecutive N-1 frame in which the object at the target position has not moved, the fifth image frame is determined to be a consecutive N frame in which the object at the target position has not moved. A stationary flag is set for the object at the target position in the fifth image frame, and the identity identifier of the object at the target position in the fifth image frame is determined to be the same as the identity identifier of the object at the target position in the fourth image frame, which is the first identity identifier.
7. The method according to claim 6, further comprising: In response to the fact that the object at the target position in the fifth image frame does not meet the second identity determination threshold with the object at the target position in the fourth image frame, counting begins until an object matching the object at the target position in the fourth image frame is identified at the target position in the sixth image frame. The sixth image frame is an image frame in the consecutive multi-frame images whose corresponding time is later than the corresponding time of the fifth image frame. The third counting threshold is determined based on the fact that the object at the target location in the fourth image frame does not have a stationary marker. In response to the fact that the image frame count value between the sixth image frame and the fourth image frame in the consecutive multi-frame images is less than the third counting threshold, the identity identifier of the object located at the target position in the sixth image frame is determined as the first identity identifier.
8. The method according to claim 7, further comprising: In response to the image frame count value between the sixth image frame and the fourth image frame in the consecutive multi-frame images being greater than the third count threshold, a fourth identity identifier is set for the object at the target location in the sixth image frame, wherein the fourth identity identifier is different from the first identity identifier.
9. The method according to claim 1, wherein determining that the object at the target position in the fifth image frame is stationary based on the object identified at the target position in the fifth image frame and the object at the target position in the fourth image frame comprises: Determine the first center position and first size parameter of the object at the target location in the fourth image frame; Determine the second center position and second size parameter of the object at the target position in the fifth image frame; The center displacement is determined based on the first center position and the second center position, and the dimensional change rate is determined based on the first dimensional parameter and the second dimensional parameter. In response to the center displacement being less than a first threshold and the size change rate being less than a second threshold, it is determined that the object at the target position in the fifth image frame is stationary.
10. A video identity processing system, comprising: The acquisition unit is used to acquire at least a first image frame and a second image frame, wherein the time corresponding to the first image frame is earlier than the time corresponding to the second image frame, and the target object located at the target position in the first image frame has a stationary marker. The first determining unit is configured to determine a first identity identifier and a first counting threshold based on the target object in the first image frame; The identification unit is configured to start counting in response to the fact that the target object is not identified at the target position in the second image frame, until an object matching the target object is identified at the target position in the third image frame, wherein the time corresponding to the third image frame is later than the time corresponding to the second image frame. The second determining unit is configured to determine the identity identifier of the object in the third image frame as the first identity identifier in response to the image frame count value between the third image frame and the second image frame in a series of multiple image frames being less than the first counting threshold.