Motion trajectory recognition method, device, electronic device and storage medium

By using background templates to extract the shape and position features of candidate objects on campus and identify the activity trajectories of campus personnel, it solves the problems of high computing resource consumption and privacy protection, and achieves low-cost, low-resource trajectory identification and privacy protection.

CN118366227BActive Publication Date: 2024-10-25HEBEI KEMAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410796747.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-10-25
Estimated Expiration
2044-06-20

Smart Images

  • Figure CN118366227B_ABST
    Figure CN118366227B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of motion trajectory recognition technology, and in particular to a motion trajectory recognition method, device, electronic device and storage medium. The method of the present invention first acquires multiple first images; then extracts multiple candidate objects from each first image according to a background template, and constructs a first data set according to the shape and position features of the multiple candidate objects; then finds multiple target positions from the multiple first data sets according to the shape and position features of the target object; finally, plans the motion trajectory according to the multiple target positions. The present invention extracts multiple candidate objects by comparing with the background template, analyzes whether the candidate objects are on the motion trajectory based on the shape and position features of the candidate objects, thereby determining the position of the target object. The motion trajectory recognition process only performs shape and position feature analysis, and there is no need to recognize the target object. Therefore, the implementation method of the present invention consumes little computing resources in determining the position of the candidate objects and planning the motion trajectory based on the object position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of motion track recognition, and in particular to a motion track recognition method, device, electronic equipment and storage medium. Background Art

[0002] The activities of various types of people on campus have a crucial impact on campus security. In order to control activities on campus, some campuses will set up gates at key exit nodes to control access and statistics of cardholder access data.

[0003] The data extracted by the gate machine can only reflect the time when the cardholder appears at a fixed point, but cannot reflect the overall activities of campus personnel. Some related technologies use image recognition algorithms to analyze the activities of campus personnel, but this technology has a high computational cost, consumes a lot of computing resources, and has problems involving personnel privacy protection.

[0004] Based on this, it is necessary to develop and design a motion trajectory recognition method. Summary of the invention

[0005] The embodiments of the present invention provide a method, device, electronic device and storage medium for identifying a motion trajectory, which are used to solve the problem in the prior art that a large amount of computing resources are required to determine the activity trajectory of campus personnel.

[0006] In a first aspect, an embodiment of the present invention provides a method for identifying a motion trajectory, comprising:

[0007] Acquire a plurality of first images, wherein the plurality of first images are acquired based on the same field of view;

[0008] Extracting multiple candidate objects from each first image according to the background template, and constructing a first data set according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background;

[0009] Finding a plurality of target positions from the plurality of first data sets respectively according to the shape and position features of the target object, wherein the target object is obtained based on the positioning image extraction;

[0010] Plan an action trajectory according to the multiple target positions.

[0011] In a possible implementation, extracting multiple candidate objects from each first image according to the background template and constructing a first data set according to shape and position features of the multiple candidate objects includes:

[0012] Obtain the background template;

[0013] For each first image in the plurality of first images, the following steps are performed respectively:

[0014] Decolorizing the first image to obtain a decolorized image;

[0015] Adjusting the distribution interval of the pixel values ​​of the decolorized image to obtain a first grayscale image;

[0016] Calculating the difference between the first grayscale image and the background template to obtain a difference image;

[0017] extracting the plurality of candidate objects from the difference image;

[0018] The sizes of the multiple candidate objects and the positions of the multiple candidate objects in the image are constructed as a first data set.

[0019] In a possible implementation, the adjusting the distribution interval of the pixel values ​​of the decolorized image to obtain the first grayscale image includes:

[0020] Acquire a plurality of first pixel value intervals, wherein each first pixel value interval corresponds to a first quantity;

[0021] Arranging multiple pixel values ​​of the decolorized image from large to small to obtain a first pixel queue;

[0022] Taking out an interval with the largest median value from the plurality of first pixel value intervals as the pixel value interval to be processed;

[0023] Taking the first number corresponding to the to-be-processed pixel value interval as the to-be-processed number;

[0024] Taking out the number of pixel values ​​to be processed from the first pixel queue as a plurality of pixel values ​​to be processed;

[0025] The plurality of pixel values ​​to be processed are adjusted according to the first formula and the interval of pixel values ​​to be processed to obtain a plurality of second pixel values, wherein the first formula is:

[0026]

[0027] In the formula, is the second pixel value, is the lower limit of the pixel value interval to be processed, is the difference between the upper and lower limits of the pixel value interval to be processed, is the pixel value to be processed, is the smallest pixel value among multiple pixel values ​​to be processed. is the largest pixel value among multiple pixel values ​​to be processed;

[0028] According to the source positions of the plurality of second pixel values, the plurality of second pixel values ​​are placed into the first grayscale image;

[0029] If the traversal of the multiple first pixel value intervals is not completed, jump to the step of taking out the interval with the largest median value from the multiple first pixel value intervals as the pixel value interval to be processed.

[0030] In a possible implementation manner, extracting the plurality of candidate objects from the difference image includes:

[0031] Get the classification threshold;

[0032] Setting pixel values ​​in the difference image whose absolute values ​​are less than the classification threshold to zero to obtain a first intermediate image;

[0033] Setting the island points in the first intermediate image to zero to obtain a second intermediate image, wherein the island points are pixel points whose number of non-zero pixels within a preset radius is less than a threshold value of the number of islands;

[0034] A plurality of image blocks that do not include zero-edge rows and zero-edge columns are extracted from the second intermediate image as the plurality of candidate objects.

[0035] In a possible implementation, the shape and position features include the size of the object and the position of the object in the image, and finding multiple target positions from the multiple first data sets respectively according to the shape and position features of the target object includes:

[0036] Get the size and position of the target object;

[0037] Extracting a data set from the plurality of first data sets according to the order of the first image time nodes as the data set to be processed;

[0038] Extracting sizes and positions of the plurality of candidate objects from the data set to be processed respectively;

[0039] According to the size of the target object, the position of the target object and a second formula, a plurality of candidate feature vectors are constructed, wherein the second formula is:

[0040]

[0041] In the formula, For the The distance elements of candidate feature vectors, For the The distance between the candidate objects and the target object, is the distance between the target object and the previous object, For the The angle elements of the candidate eigenvectors, For the The candidate objects are relative to the target object. The distance of the direction, For the The candidate objects are relative to the target object. The distance of the direction, The target object is relative to the previous object. The distance moved in the direction, The target object is relative to the previous object. The distance moved in the direction, For the The first size ratio element of the candidate feature vectors is For the The second size of the candidate feature vectors is smaller than the element, For the The width of the candidate objects, For the The length of the candidate objects, is the width of the target object, is the length of the target object, For the The candidate object locations Axis coordinates, For the The candidate object locations Axis coordinates, The target object position Axis coordinates, The target object position Axis coordinates;

[0042] Adding the plurality of candidate feature vectors to a plurality of sample feature vectors respectively to obtain a plurality of feature groups;

[0043] Clustering the multiple feature groups respectively to obtain multiple clustering results, wherein each clustering result corresponds to a feature group;

[0044] Extracting the vector quantities of the classes to which the candidate feature vector belongs from the multiple clustering results respectively, and obtaining multiple cluster quantities, wherein each cluster quantity corresponds to a candidate feature vector;

[0045] According to the third formula and the plurality of cluster numbers, a plurality of candidate indexes are determined, wherein each candidate index corresponds to a cluster number, and the third formula is:

[0046]

[0047] In the formula, For the Candidate indexes, For the The number of clusters, is the total number of clusters, For the The number of clusters;

[0048] Selecting a winning object from the plurality of candidate objects according to the plurality of candidate indices;

[0049] using the position of the winning object as the target position;

[0050] Taking the winning object as the target object;

[0051] If the traversal of the plurality of first data sets is not completed, the process jumps to the step of extracting a data set from the plurality of first data sets according to the sequence of the first image time nodes as the data set to be processed.

[0052] In a possible implementation manner, clustering the multiple feature groups respectively to obtain multiple clustering results includes:

[0053] Get the number of categories;

[0054] traversally extracting a feature group from the plurality of feature groups as a feature group to be processed;

[0055] Extracting the feature vectors of the classification quantity from the feature group to be processed as a plurality of target feature vectors;

[0056] Adding each feature vector in the feature group to be processed to the class where the nearest target feature vector is located, thereby obtaining multiple intermediate classes;

[0057] According to the fourth formula, the distance from each target feature vector to the class center of the intermediate class to which it belongs is determined, thereby obtaining multiple distances, wherein the fourth formula is:

[0058]

[0059] In the formula, is the distance from the target feature vector to the class center of the intermediate class to which it belongs, is the total dimension of the feature vector, is the target feature vector elements, is the first intermediate class to which the target feature vector belongs The eigenvector elements, is the total number of feature vectors in the intermediate class to which the target feature vector belongs;

[0060] If there is a distance greater than the distance threshold among the multiple distances, jump to the step of extracting the feature vectors of the classification quantity from the feature group to be processed as multiple target feature vectors;

[0061] Otherwise, taking the multiple intermediate classes as the clustering results of the feature group to be processed;

[0062] If the traversal of the plurality of feature groups is not completed, the process jumps to the step of taking out a feature group from the traversed plurality of feature groups as a feature group to be processed.

[0063] In a possible implementation, selecting a winning object from the multiple candidate objects according to the multiple candidate indexes includes:

[0064] According to the fifth formula and the plurality of candidate indexes, the winning coefficient is determined, wherein the fifth formula is:

[0065]

[0066] In the formula, is the candidate index with the largest value among multiple candidate indices. The candidate index with the second largest median value among multiple candidate indexes. is the winning coefficient;

[0067] If the winning coefficient is greater than the winning threshold, the candidate object corresponding to the candidate index with the largest value is taken as the winning object;

[0068] Otherwise, the candidate object corresponding to the candidate index with the largest value and the candidate object corresponding to the candidate index with the second largest value are extracted as the first object and the second object respectively, and the winning object is selected from the first object and the second object according to the similarity between the first object and the second object and the target object.

[0069] In a second aspect, an embodiment of the present invention provides a motion trajectory recognition device, which is used to implement the motion trajectory recognition method described in the first aspect or any possible implementation of the first aspect, wherein the motion trajectory recognition device includes:

[0070] An image acquisition module, used to acquire a plurality of first images, wherein the plurality of first images are acquired based on the same field of view;

[0071] A shape and position feature extraction module, used to extract multiple candidate objects from each first image according to the background template, and construct a first data set according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background;

[0072] A target position determination module, used to find multiple target positions from the multiple first data sets respectively according to the shape and position features of the target object, wherein the target object is obtained based on the positioning image extraction;

[0073] as well as,

[0074] The trajectory planning module is used to plan the action trajectory according to the multiple target positions.

[0075] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, it implements the steps of the method described in the first aspect or any possible implementation method of the first aspect.

[0076] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect or any possible implementation of the first aspect are implemented.

[0077] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0078] An embodiment of the present invention discloses a method for identifying a motion trajectory, which first acquires a plurality of first images, wherein the plurality of first images are acquired based on the same field of view; then, a plurality of candidate objects are extracted from each first image according to a background template, and a first data set is constructed according to the shape and position features of the plurality of candidate objects, thereby obtaining a plurality of first data sets, wherein the candidate objects are objects that block the image background; then, a plurality of target positions are respectively found from the plurality of first data sets according to the shape and position features of the target objects, wherein the target objects are obtained by extracting the positioning image; finally, a motion trajectory is planned according to the plurality of target positions. In an embodiment of the present invention, a plurality of candidate objects are extracted by comparing with the background template, and whether the candidate objects are on the motion trajectory is analyzed based on the shape and position features of the candidate objects, thereby determining the position of the target object. In the process of identifying the motion trajectory, only shape and position feature analysis is performed, and there is no need to identify the target object. Therefore, in terms of determining the position of the candidate objects and planning the motion trajectory based on the object position, the embodiment of the present invention consumes little computing resources and does not involve personal privacy. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0080] Figure 1 is a flow chart of a method for identifying a motion trajectory provided by an embodiment of the present invention;

[0081] Figure 2It is a principle diagram of the distribution interval adjustment process of the pixel value of the decolorized image provided by an embodiment of the present invention;

[0082] Figure 3 It is a schematic diagram of distance elements and angle elements of candidate feature vectors provided in an embodiment of the present invention;

[0083] Figure 4 It is a principle diagram of feature group clustering provided by an embodiment of the present invention;

[0084] Figure 5 is a functional block diagram of a motion trajectory recognition device provided by an embodiment of the present invention;

[0085] Figure 6 It is a functional block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0086] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, and methods are omitted so as not to obscure the description of the present invention with unnecessary details.

[0087] In order to make the purpose, technical solutions and advantages of the present invention more clear, a specific implementation method will be described below in conjunction with the accompanying drawings.

[0088] The following is a detailed description of an embodiment of the present invention. This example is implemented based on the technical solution of the present invention, and provides a detailed implementation method and a specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0089] Figure 1 This is a flow chart of a method for identifying a motion trajectory provided in an embodiment of the present invention.

[0090] like Figure 1 As shown, it shows a flow chart of the implementation of the action trajectory recognition method provided by an embodiment of the present invention, which is described in detail as follows:

[0091] In step 101 , a plurality of first images are acquired, wherein the plurality of first images are acquired based on the same field of view.

[0092] In step 102, multiple candidate objects are extracted from each first image according to the background template, and a first data set is constructed according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background.

[0093] In some implementations, step 102 includes:

[0094] Obtain the background template;

[0095] For each first image in the plurality of first images, the following steps are performed respectively:

[0096] Decolorizing the first image to obtain a decolorized image;

[0097] Adjusting the distribution interval of the pixel values ​​of the decolorized image to obtain a first grayscale image;

[0098] Calculating the difference between the first grayscale image and the background template to obtain a difference image;

[0099] extracting the plurality of candidate objects from the difference image;

[0100] The sizes of the multiple candidate objects and the positions of the multiple candidate objects in the image are constructed as a first data set.

[0101] In some implementations, adjusting the distribution interval of the pixel values ​​of the decolorized image to obtain the first grayscale image includes:

[0102] Acquire a plurality of first pixel value intervals, wherein each first pixel value interval corresponds to a first quantity;

[0103] Arranging multiple pixel values ​​of the decolorized image from large to small to obtain a first pixel queue;

[0104] Taking out an interval with the largest median value from the plurality of first pixel value intervals as the pixel value interval to be processed;

[0105] Taking the first number corresponding to the to-be-processed pixel value interval as the to-be-processed number;

[0106] Taking out the number of pixel values ​​to be processed from the first pixel queue as a plurality of pixel values ​​to be processed;

[0107] The plurality of pixel values ​​to be processed are adjusted according to the first formula and the interval of pixel values ​​to be processed to obtain a plurality of second pixel values, wherein the first formula is:

[0108]

[0109] In the formula, is the second pixel value, is the lower limit of the pixel value interval to be processed, is the difference between the upper and lower limits of the pixel value interval to be processed, is the pixel value to be processed, is the smallest pixel value among multiple pixel values ​​to be processed. is the largest pixel value among multiple pixel values ​​to be processed;

[0110] According to the source positions of the plurality of second pixel values, the plurality of second pixel values ​​are placed into the first grayscale image;

[0111] If the traversal of the multiple first pixel value intervals is not completed, jump to the step of taking out the interval with the largest median value from the multiple first pixel value intervals as the pixel value interval to be processed.

[0112] In some implementations, extracting the plurality of candidate objects from the difference image includes:

[0113] Get the classification threshold;

[0114] Setting pixel values ​​in the difference image whose absolute values ​​are less than the classification threshold to zero to obtain a first intermediate image;

[0115] Setting the island points in the first intermediate image to zero to obtain a second intermediate image, wherein the island points are pixel points whose number of non-zero pixels within a preset radius is less than a threshold value of the number of islands;

[0116] A plurality of image blocks that do not include zero-edge rows and zero-edge columns are extracted from the second intermediate image as the plurality of candidate objects.

[0117] Exemplarily, in order to avoid the security problems caused by the use of video recognition algorithms for analyzing the trajectory of personnel activities as mentioned above, the embodiment of the present invention first pre-processes multiple images separately. These images are obtained based on the same field of view and correspond to different time nodes, and these images are arranged in the order of time nodes. Since multiple images are obtained based on one field of view, the background is the same. Then, the pre-processed image is compared with the background image, and the shape and position features of the blocks that are different from the background are extracted, for example, the size, position and other features of the difference blocks, and these features are processed together with the current shape and position features of the target to extract the features of the travel distance and the travel direction. These features are used to construct the feature vector of the difference block, and cluster it with the previous sample vector. Through the above steps, each difference block corresponds to a clustering result. Then, the difference blocks with the largest number of vectors in the class where the feature vectors are located are selected from the difference blocks as the target blocks and the position of the target blocks is extracted as the position of the target object at the next time node. The above steps are performed on multiple images respectively, and after obtaining the position corresponding to each time node, the trajectory of the action is finally planned according to the position of each time node. Through the above process, we can find that, unlike the image recognition method, the method of the present invention does not need to extract, compare and classify the edge and texture features of the target object. In other words, it does not need to identify the target object, the calculation cost is small, the hardware resource consumption is small, and since it does not involve the recognition process, it can better protect the privacy of people.

[0118] To achieve the above process, the present invention reduces the difference between the image and the background image template as much as possible in image preprocessing, so as to facilitate the extraction of difference image blocks. The image preprocessing process includes decolorization and pixel value adjustment. Figure 2 Schematic diagram of the process of adjusting the distribution interval of the pixel value of the decolorized image. In the figure, the X-axis is the axis of the pixel value, and the Y-axis is the axis of the number of pixels in the pixel value interval. There are differences in pixel values ​​between the multiple intervals 202 of the decolorized image distribution and the multiple first pixel value intervals 201 (standardized intervals). The embodiment of the present invention uses the first formula to process the multiple intervals 202 of the decolorized image distribution one by one. The first formula is:

[0119]

[0120] In the formula, is the second pixel value, is the lower limit of the pixel value interval to be processed, is the difference between the upper and lower limits of the pixel value interval to be processed, is the pixel value to be processed, is the smallest pixel value among multiple pixel values ​​to be processed. It is the largest pixel value among multiple pixel values ​​to be processed.

[0121] The processed image is taken as a grayscale image, and is subtracted from the background template image, and the island points are taken out to obtain the difference image. It can be seen that the absolute value of the pixel value of the background part of the grayscale image in the difference image is lower, and the part with a higher absolute value of the pixel value in the difference image is the location of the difference block.

[0122] In step 103, a plurality of target positions are respectively found from the plurality of first data sets according to the shape and position features of the target object, wherein the target object is obtained based on the positioning image extraction.

[0123] In step 104, a movement trajectory is planned according to the multiple target positions.

[0124] In some implementations, step 103 includes:

[0125] Get the size and position of the target object;

[0126] Extracting a data set from the plurality of first data sets according to the order of the first image time nodes as the data set to be processed;

[0127] Extracting sizes and positions of the plurality of candidate objects from the data set to be processed respectively;

[0128] According to the size of the target object, the position of the target object and a second formula, a plurality of candidate feature vectors are constructed, wherein the second formula is:

[0129]

[0130] In the formula, For the The distance element of the candidate feature vectors, For the The distance between the candidate objects and the target object, is the distance between the target object and the previous object, For the The angle elements of the candidate eigenvectors, For the The candidate objects are relative to the target object. The distance of the direction, For the The candidate objects are relative to the target object. The distance of the direction, The target object is relative to the previous object. The distance moved in the direction, The target object is relative to the previous object. The distance moved in the direction, For the The first size ratio element of the candidate feature vectors is For the The second size of the candidate feature vectors is smaller than the element, For the The width of the candidate objects, For the The length of the candidate objects, is the width of the target object, is the length of the target object, For the The candidate object locations Axis coordinates, For the The candidate object locations Axis coordinates, The target object position Axis coordinates, The target object position Axis coordinates;

[0131] Adding the plurality of candidate feature vectors to a plurality of sample feature vectors respectively to obtain a plurality of feature groups;

[0132] Clustering the multiple feature groups respectively to obtain multiple clustering results, wherein each clustering result corresponds to a feature group;

[0133] Extracting the vector quantities of the classes to which the candidate feature vector belongs from the multiple clustering results respectively, and obtaining multiple cluster quantities, wherein each cluster quantity corresponds to a candidate feature vector;

[0134] According to the third formula and the plurality of cluster numbers, a plurality of candidate indexes are determined, wherein each candidate index corresponds to a cluster number, and the third formula is:

[0135]

[0136] In the formula, For the Candidate indexes, For the The number of clusters, is the total number of clusters, For the The number of clusters;

[0137] Selecting a winning object from the plurality of candidate objects according to the plurality of candidate indices;

[0138] using the position of the winning object as the target position;

[0139] Taking the winning object as the target object;

[0140] If the traversal of the plurality of first data sets is not completed, the process jumps to the step of extracting a data set from the plurality of first data sets according to the sequence of the first image time nodes as the data set to be processed.

[0141] In some embodiments, clustering the multiple feature groups respectively to obtain multiple clustering results includes:

[0142] Get the number of categories;

[0143] traversally extracting a feature group from the plurality of feature groups as a feature group to be processed;

[0144] Extracting the feature vectors of the classification quantity from the feature group to be processed as a plurality of target feature vectors;

[0145] Adding each feature vector in the feature group to be processed to the class where the nearest target feature vector is located, thereby obtaining multiple intermediate classes;

[0146] According to the fourth formula, the distance from each target feature vector to the class center of the intermediate class to which it belongs is determined, thereby obtaining multiple distances, wherein the fourth formula is:

[0147]

[0148] In the formula, is the distance from the target feature vector to the class center of the intermediate class to which it belongs, is the total dimension of the feature vector, is the target feature vector elements, is the first intermediate class to which the target feature vector belongs The eigenvector elements, is the total number of feature vectors in the intermediate class to which the target feature vector belongs;

[0149] If there is a distance greater than the distance threshold among the multiple distances, jump to the step of extracting the feature vectors of the classification quantity from the feature group to be processed as multiple target feature vectors;

[0150] Otherwise, taking the multiple intermediate classes as the clustering results of the feature group to be processed;

[0151] If the traversal of the plurality of feature groups is not completed, the process jumps to the step of taking out a feature group from the traversed plurality of feature groups as a feature group to be processed.

[0152] In some embodiments, selecting a winning object from the plurality of candidate objects according to the plurality of candidate indexes comprises:

[0153] According to the fifth formula and the plurality of candidate indexes, the winning coefficient is determined, wherein the fifth formula is:

[0154]

[0155] In the formula, is the candidate index with the largest value among multiple candidate indices. The candidate index with the second largest median value among multiple candidate indexes. is the winning coefficient;

[0156] If the winning coefficient is greater than the winning threshold, the candidate object corresponding to the candidate index with the largest value is taken as the winning object;

[0157] Otherwise, the candidate object corresponding to the candidate index with the largest value and the candidate object corresponding to the candidate index with the second largest value are extracted as the first object and the second object respectively, and the winning object is selected from the first object and the second object according to the similarity between the first object and the second object and the target object.

[0158] Exemplarily, after determining the difference blocks, the embodiment of the present invention extracts the size and position of each difference block, and constructs a feature vector with the size and position of the previous node target object. The embodiment of the present invention uses the second formula to construct:

[0159]

[0160] In the formula, For the The distance elements of candidate feature vectors, For the The distance between the candidate objects and the target object, is the distance between the target object and the previous object, For the The angle elements of the candidate eigenvectors, For the The candidate objects are relative to the target object. The distance of the direction, For the The candidate objects are relative to the target object. The distance of the direction, The target object is relative to the previous object. The distance moved in the direction, The target object is relative to the previous object. The distance moved in the direction, For the The first size ratio element of the candidate feature vectors is For the The second size of the candidate feature vectors is smaller than the element, For the The width of the candidate objects, For the The length of the candidate objects, is the width of the target object, is the length of the target object, For the The candidate object locations Axis coordinates, For the The candidate object locations Axis coordinates, The target object position Axis coordinates, The target object position Axis coordinates.

[0161] like Figure 3 As shown, the figure shows a schematic diagram of the distance element and angle element of the candidate feature vector provided by an embodiment of the present invention. In the figure, the target object t1 time node position 301 and the t0 time node position 300 constitute a first distance vector 302 from the target object t0 time node to the t1 time node, and multiple candidate object positions 303 all correspond to the t2 time node, and multiple candidate object positions 303 and the target object t1 time node position 301 constitute multiple second distance vectors 304, then the modulus of the second distance vector 304 ( ) and the magnitude of the first distance vector 302 ( ) calculates the difference, and divides it by the modulus of the first distance vector 302 to obtain the distance element of the candidate feature vector, and the angle between the second distance vector 304 and the first distance vector 302 can be reflected by the following formula:

[0162]

[0163] After multiple candidate feature vectors are obtained, each candidate feature vector can be added to multiple sample feature vectors. The steps for obtaining the sample feature vectors are the same as those for the above-mentioned candidate feature vectors, and are obtained based on the positions located on the action trajectory.

[0164] like Figure 4 As shown, the figure shows a feature group clustering principle diagram provided by an embodiment of the invention. After the candidate feature vector 402 is clustered with multiple sample feature vectors, the clustering result obtained includes multiple classes 401. The number of vectors in the class 401 where the candidate feature vector 402 is located reflects the degree to which the candidate object position conforms to the action trajectory.

[0165] When the candidate feature vector is significantly different from these sample feature vectors, after clustering, it can be found that the number of vectors in the class where the candidate feature vector is located is relatively small, which reflects that the candidate object position deviates a lot from the action trajectory. When the candidate feature vector is slightly different from these sample feature vectors, after clustering, the number of vectors in the class where the candidate feature vector is located is relatively large, which reflects that the candidate object position is more likely to be on the action trajectory.

[0166] Based on the above analysis, we use the third formula to give a candidate index for the clustering result of each candidate object:

[0167]

[0168] In the formula, For the Candidate indexes, For the The number of clusters, is the total number of clusters, For the The number of clusters.

[0169] According to this formula, Figure 4 The candidate indices in are: .

[0170] Obviously, the larger the candidate index is, the more likely the candidate object corresponding to the candidate index is on the action trajectory. The embodiment of the present invention further confirms the possibility of the candidate object on the action trajectory through the winning coefficient. The winning coefficient is determined by the fifth formula:

[0171]

[0172] In the formula, is the candidate index with the largest value among multiple candidate indices. The candidate index with the second largest median value among multiple candidate indexes. Is the winning coefficient.

[0173] If the winning coefficient is greater than the threshold, it means that the deviation between the largest candidate index value and the second largest candidate index value is large. In this case, the candidate object corresponding to the largest candidate index is taken as the target object. Otherwise, it is necessary to perform image similarity analysis on the candidate object corresponding to the largest candidate index and the candidate objects corresponding to other candidate indexes with the target object respectively, and determine the target object through similarity analysis.

[0174] In terms of clustering, a kmeans clustering method is used in one application scenario. This method can obtain clustering results relatively quickly by classifying vectors into the nearest class.

[0175] The implementation method of the motion trajectory recognition method of the present invention first obtains multiple first images, wherein the multiple first images are obtained based on the same field of view; then, multiple candidate objects are extracted from each first image according to a background template, and a first data set is constructed according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background; then, multiple target positions are found from the multiple first data sets respectively according to the shape and position features of the target objects, wherein the target objects are obtained based on the extraction of the positioning image; finally, the motion trajectory is planned according to the multiple target positions. The implementation method of the present invention extracts multiple candidate objects by comparing with the background template, and analyzes whether the candidate objects are on the motion trajectory based on the shape and position features of the candidate objects, thereby determining the position of the target object. The motion trajectory recognition process only performs shape and position feature analysis, and there is no need to identify the target object. Therefore, the implementation method of the present invention consumes little computing resources in determining the position of the candidate objects and planning the motion trajectory based on the object position, and does not involve personal privacy.

[0176] It should be understood that the size of the serial numbers of the steps in the above implementation does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation method of the present invention.

[0177] The following is an implementation of the device of the present invention. For details not described in detail, reference may be made to the corresponding method implementation described above.

[0178] Figure 5 is a functional block diagram of a motion trajectory recognition device provided by an embodiment of the present invention, referring to Figure 5 The motion trajectory recognition device includes: an image acquisition module 501, a shape and position feature extraction module 502, a target position determination module 503 and a trajectory planning module 504, wherein:

[0179] An image acquisition module 501 is used to acquire a plurality of first images, wherein the plurality of first images are acquired based on the same field of view;

[0180] A shape and position feature extraction module 502 is used to extract multiple candidate objects from each first image according to the background template, and construct a first data set according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background;

[0181] A target position determination module 503 is used to find multiple target positions from the multiple first data sets according to the shape and position features of the target object, wherein the target object is obtained based on the positioning image extraction;

[0182] The trajectory planning module 504 is used to plan the action trajectory according to the multiple target positions.

[0183] Figure 6 is a functional block diagram of an electronic device provided by an embodiment of the present invention. Figure 6 As shown, the electronic device 6 of this embodiment includes: a processor 600 and a memory 601, wherein the memory 601 stores a computer program 602 that can be run on the processor 600. When the processor 600 executes the computer program 602, the steps in the above-mentioned motion trajectory recognition method and the embodiment are implemented, for example Figure 1 Steps 101 to 104 are shown.

[0184] Exemplarily, the computer program 602 may be divided into one or more modules / units, and the one or more modules / units are stored in the memory 601 and executed by the processor 600 to implement the present invention.

[0185] The electronic device 6 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device 6 may include, but is not limited to, a processor 600 and a memory 601. Those skilled in the art will appreciate that Figure 6 It is only an example of the electronic device 6 and does not constitute a limitation of the electronic device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 6 may also include input and output devices, network access devices, buses, etc.

[0186] The processor 600 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0187] The memory 601 may be an internal storage unit of the electronic device 6, such as a hard disk or memory of the electronic device 6. The memory 601 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. Further, the memory 601 may also include both an internal storage unit and an external storage device of the electronic device 6. The memory 601 is used to store the computer program 602 and other programs and data required by the electronic device 6. The memory 601 may also be used to temporarily store data that has been output or is to be output.

[0188] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the implementation method can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method implementation method, which will not be repeated here.

[0189] In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0190] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0191] In the embodiments provided by the present invention, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0192] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0193] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0194] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned implementation method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various methods and device implementation methods can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium.

[0195] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for identifying a motion trajectory, characterized in that: include: Acquire a plurality of first images, wherein the plurality of first images are acquired based on the same field of view; Extracting multiple candidate objects from each first image according to the background template, and constructing a first data set according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background; Finding a plurality of target positions from the plurality of first data sets respectively according to the shape and position features of the target object, wherein the target object is obtained based on the positioning image extraction; Planning an action trajectory according to the multiple target positions; in, The shape and position features include the size of the object and the position of the object in the image. The step of finding multiple target positions from the multiple first data sets according to the shape and position features of the target object includes: Get the size and position of the target object; Extracting a data set from the plurality of first data sets according to the order of the first image time nodes as the data set to be processed; Extracting sizes and positions of the plurality of candidate objects from the data set to be processed respectively; A plurality of candidate feature vectors are constructed according to the size of the target object, the position of the target object and a second formula, wherein the second formula is: In the formula, For the The distance element of the candidate feature vectors, For the The distance between the candidate objects and the target object, is the distance between the target object and the previous object, For the The angle elements of the candidate eigenvectors, For the The candidate objects are relative to the target object. The distance of the direction, For the The candidate objects are relative to the target object. The distance of the direction, The target object is relative to the previous object. The distance moved in the direction, The target object is relative to the previous object. The distance moved in the direction, For the The first size ratio element of the candidate feature vectors is For the The second size of the candidate feature vectors is smaller than the element, For the The width of the candidate objects, For the The length of the candidate objects, is the width of the target object, is the length of the target object, For the The candidate object locations Axis coordinates, For the The candidate object locations Axis coordinates, The target object position Axis coordinates, The target object position axis coordinates, wherein the previous object is the target object at the previous time node; adding the plurality of candidate feature vectors to a plurality of sample feature vectors respectively to obtain a plurality of feature groups, wherein the sample feature vectors are obtained based on positions on the action trajectory; Clustering the multiple feature groups respectively to obtain multiple clustering results, wherein each clustering result corresponds to a feature group; Extracting the vector quantities of the classes to which the candidate feature vector belongs from the multiple clustering results respectively, and obtaining multiple cluster quantities, wherein each cluster quantity corresponds to a candidate feature vector; According to the third formula and the plurality of cluster numbers, a plurality of candidate indexes are determined, wherein each candidate index corresponds to a cluster number, and the third formula is: In the formula, For the Candidate indexes, For the The number of clusters, is the total number of clusters, For the The number of clusters; Selecting a winning object from the plurality of candidate objects according to the plurality of candidate indices; using the position of the winning object as the target position; taking the winning object as the target object; If the traversal of the plurality of first data sets is not completed, the process jumps to the step of extracting a data set from the plurality of first data sets according to the sequence of the first image time nodes as the data set to be processed.

2. The method for identifying a motion trajectory according to claim 1, characterized in that: The extracting multiple candidate objects from each first image according to the background template and constructing a first data set according to the shape and position features of the multiple candidate objects includes: Obtain the background template; For each first image of the plurality of first images, the following steps are performed respectively: Decolorizing the first image to obtain a decolorized image; Adjusting the distribution interval of the pixel values ​​of the decolorized image to obtain a first grayscale image; Calculating the difference between the first grayscale image and the background template to obtain a difference image; extracting the plurality of candidate objects from the difference image; The sizes of the multiple candidate objects and the positions of the multiple candidate objects in the image are constructed as a first data set.

3. The method for identifying motion trajectories according to claim 2, characterized in that: The step of adjusting the distribution interval of the pixel values ​​of the decolorized image to obtain the first grayscale image includes: Acquire a plurality of first pixel value intervals, wherein each first pixel value interval corresponds to a first quantity; Arranging multiple pixel values ​​of the decolorized image from large to small to obtain a first pixel queue; Taking out an interval with the largest median value from the plurality of first pixel value intervals as the pixel value interval to be processed; Taking the first number corresponding to the to-be-processed pixel value interval as the to-be-processed number; Taking out the number of pixel values ​​to be processed from the first pixel queue as a plurality of pixel values ​​to be processed; The plurality of pixel values ​​to be processed are adjusted according to the first formula and the interval of pixel values ​​to be processed to obtain a plurality of second pixel values, wherein the first formula is: In the formula, is the second pixel value, is the lower limit of the pixel value interval to be processed, is the difference between the upper and lower limits of the pixel value interval to be processed, is the pixel value to be processed, is the smallest pixel value among multiple pixel values ​​to be processed. is the largest pixel value among multiple pixel values ​​to be processed; According to the source positions of the plurality of second pixel values, the plurality of second pixel values ​​are placed into the first grayscale image; If the traversal of the multiple first pixel value intervals is not completed, jump to the step of taking out the interval with the largest median value from the multiple first pixel value intervals as the pixel value interval to be processed.

4. The method for identifying motion trajectory according to claim 2, characterized in that: The extracting the plurality of candidate objects from the difference image comprises: Get the classification threshold; Setting pixel values ​​in the difference image whose absolute values ​​are less than the classification threshold to zero to obtain a first intermediate image; Setting the island points in the first intermediate image to zero to obtain a second intermediate image, wherein the island points are pixel points whose number of non-zero pixels within a preset radius is less than a threshold value of the number of islands; A plurality of image blocks that do not include zero-edge rows and zero-edge columns are extracted from the second intermediate image as the plurality of candidate objects.

5. The method for identifying a motion trajectory according to claim 1, characterized in that: The clustering of the plurality of feature groups respectively to obtain a plurality of clustering results comprises: Get the number of categories; traversally extracting a feature group from the plurality of feature groups as a feature group to be processed; Extracting the feature vectors of the classification quantity from the feature group to be processed as a plurality of target feature vectors; Adding each feature vector in the feature group to be processed to the class where the nearest target feature vector is located, thereby obtaining multiple intermediate classes; According to the fourth formula, the distance from each target feature vector to the class center of the intermediate class to which it belongs is determined, thereby obtaining multiple distances, wherein the fourth formula is: In the formula, is the distance from the target feature vector to the class center of the intermediate class to which it belongs, is the total dimension of the feature vector, is the target feature vector elements, is the first intermediate class to which the target feature vector belongs The eigenvector elements, is the total number of feature vectors in the intermediate class to which the target feature vector belongs; If there is a distance greater than the distance threshold among the multiple distances, jump to the step of extracting the feature vectors of the classification quantity from the feature group to be processed as multiple target feature vectors; Otherwise, taking the multiple intermediate classes as the clustering results of the feature group to be processed; If the traversal of the plurality of feature groups is not completed, the process jumps to the step of taking out a feature group from the traversed plurality of feature groups as a feature group to be processed.

6. The method for identifying a motion trajectory according to claim 1, characterized in that: The step of selecting a winning object from the plurality of candidate objects according to the plurality of candidate indexes comprises: According to the fifth formula and the plurality of candidate indexes, the winning coefficient is determined, wherein the fifth formula is: In the formula, is the candidate index with the largest value among multiple candidate indices. The candidate index with the second largest median value among multiple candidate indexes. is the winning coefficient; If the winning coefficient is greater than the winning threshold, the candidate object corresponding to the candidate index with the largest value is taken as the winning object; Otherwise, the candidate object corresponding to the candidate index with the largest value and the candidate object corresponding to the candidate index with the second largest value are extracted as the first object and the second object respectively, and the winning object is selected from the first object and the second object according to the similarity between the first object and the second object and the target object.

7. A motion trajectory recognition device, characterized in that: Used to implement the motion trajectory recognition method according to any one of claims 1 to 6, the motion trajectory recognition device comprises: An image acquisition module, used to acquire a plurality of first images, wherein the plurality of first images are acquired based on the same field of view; A shape and position feature extraction module, used to extract multiple candidate objects from each first image according to the background template, and construct a first data set according to the shape and position features of the multiple candidate objects, thereby obtaining multiple first data sets, wherein the candidate objects are objects that block the image background; A target position determination module, used to find multiple target positions from the multiple first data sets respectively according to the shape and position features of the target object, wherein the target object is obtained based on the positioning image extraction; as well as, The trajectory planning module is used to plan the action trajectory according to the multiple target positions.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.