CN111553259B - Image duplicate removal method and system - Google Patents

Image duplicate removal method and system Download PDF

Info

Publication number
CN111553259B
CN111553259B CN202010337253.3A CN202010337253A CN111553259B CN 111553259 B CN111553259 B CN 111553259B CN 202010337253 A CN202010337253 A CN 202010337253A CN 111553259 B CN111553259 B CN 111553259B
Authority
CN
China
Prior art keywords
image
target
comparison
comparison image
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010337253.3A
Other languages
Chinese (zh)
Other versions
CN111553259A (en
Inventor
吴松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Next Dimension Technology Co ltd
Original Assignee
Beijing Next Dimension Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Next Dimension Technology Co ltd filed Critical Beijing Next Dimension Technology Co ltd
Priority to CN202010337253.3A priority Critical patent/CN111553259B/en
Publication of CN111553259A publication Critical patent/CN111553259A/en
Application granted granted Critical
Publication of CN111553259B publication Critical patent/CN111553259B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/46Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]

Abstract

The invention discloses an image duplicate removal method and an image duplicate removal system, and relates to the technical field of video monitoring. The method comprises the following steps: extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image; calculating the hash value of each frame of target image; taking the ith frame target image as a first comparison image; taking the i + W frame target image as a second comparison image; respectively calculating gradient values of the first comparison image and the second comparison image; and judging whether the first comparison image and the second comparison image are repeated or not by utilizing the Hash value, and if so, storing a target image with a large gradient value and an original image corresponding to the target image with the large gradient value. According to the invention, target detection and image repetition removal are combined, the key target area in the original image is determined through the target detection, and the repetition removal and image definition judgment are only carried out on the key target area, so that the calculation amount of the repetition removal judgment and the image definition calculation is reduced, and meanwhile, the definition calculation error in the target movement process is eliminated.

Description

Image duplicate removal method and system
Technical Field
The invention relates to the technical field of video monitoring, in particular to an image duplicate removal method and an image duplicate removal system.
Background
In security protection or daily video intelligent monitoring, monitored key targets are often required to be extracted and uploaded to a background server, but as videos are continuous, a large number of repeated images are uploaded within a period of time, so that the waste of storage space and network bandwidth is caused. The conventional image de-duplication method generally comprises the steps of calculating the Hash values of the whole image, comparing the Hamming distance between the Hash values of each image, and judging that the two images are identical or similar when the Hamming distance is smaller than a set threshold value, so that redundant images are deleted. When similarity comparison is carried out, key targets in some scenes are not changed, but backgrounds are changed, and the two images are judged to be non-repeated images by the conventional image duplicate removal method, so that repeated uploading is caused, and storage space and network bandwidth are wasted. Therefore, the existing image deduplication method has the problem of repeated uploading.
Disclosure of Invention
The invention aims to provide an image duplicate removal method and an image duplicate removal system, which solve the problem of repeated uploading in the existing image duplicate removal method.
In order to achieve the purpose, the invention provides the following scheme:
an image deduplication method, comprising:
acquiring a video image;
extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image;
calculating the hash value of each frame of the target image;
taking the target image of the ith frame as a first comparison image;
taking the target image of the (i + W) th frame as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1;
respectively calculating gradient values of the first comparison image and the second comparison image; the gradient value is used for reflecting the definition of an image;
and judging whether the first comparison image and the second comparison image are repeated or not by utilizing the hash value, if so, storing a target image with a large gradient value in the first comparison image and the second comparison image, and storing an original image in the video image corresponding to the target image with the large gradient value.
Optionally, the extracting, by using a target detection algorithm, a target region of each frame of original image in the video image to obtain a target image specifically includes:
extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image;
and carrying out binarization processing on the target initial image to obtain a target image.
Optionally, the respectively calculating the gradient values of the first comparison image and the second comparison image specifically includes:
performing Laplace filtering on the gray value of the first comparison image to obtain a gradient value of the first comparison image;
and performing Laplace filtering on the gray value of the second comparison image to obtain a gradient value of the second comparison image.
Optionally, the determining, by using the hash value, whether the first comparison image and the second comparison image are repeated, and if yes, storing a target image with a large gradient value in the first comparison image and the second comparison image specifically includes:
calculating a hamming distance between the first comparison image and the second comparison image using the hash value;
judging whether the Hamming distance is smaller than a preset threshold value or not to obtain a first judgment result;
if the first judgment result shows that the Hamming distance is smaller than a preset threshold value, judging whether the gradient value of the first comparison image is smaller than that of the second comparison image or not to obtain a second judgment result;
if the first judgment result shows that the Hamming distance is larger than or equal to a preset threshold value, judging whether the interval frame number W is larger than 1 or not, and obtaining a third judgment result;
if the second judgment result indicates that the gradient value of the first comparison image is smaller than that of the second comparison image, storing the second comparison image, and making i equal to i + W, and returning to the step of taking the target image of the ith frame as the first comparison image;
if the second judgment result indicates that the gradient value of the first comparison image is greater than or equal to the gradient value of the second comparison image, storing the first comparison image, setting i to i + W, and returning to the step of taking the target image of the i + W th frame as the second comparison image;
if the third judgment result shows that the spacing frame number W is greater than 1, making W equal to W/2, and i equal to i + W, and returning to the step of taking the target image of the i + W-th frame as a second comparison image until the first judgment result shows that the Hamming distance is smaller than a preset threshold value;
and if the third judgment result shows that the number of interval frames W is equal to 1, storing the first comparison image, enabling i to be i + W, and returning to the step of taking the target image of the ith frame as the first comparison image.
Optionally, after the step of returning to "take the target image of the ith frame as the first comparison image" after storing the first comparison image and making i equal to i + W if the third determination result indicates that the number of interval frames W is equal to 1, the method further includes:
judging whether the first judgment result and the second judgment result of the target images of the continuous N frames are both yes, and obtaining a fourth judgment result;
and if the fourth judgment result indicates that the first judgment result and the second judgment result of the target image of the continuous N frames are both yes, making W equal to S and S equal to or less than 1 and equal to or less than N, and returning to the step of taking the target image of the i + W frame as a second comparison image.
An image deduplication system, comprising:
the acquisition module is used for acquiring a video image;
the target image extraction module is used for extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image;
the hash value calculation module is used for calculating the hash value of each frame of the target image;
the first comparison image determining module is used for taking the target image of the ith frame as a first comparison image;
the second comparison image determining module is used for taking the target image of the (i + W) th frame as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1;
a gradient value calculation module for calculating gradient values of the first comparison image and the second comparison image, respectively; the gradient value is used for reflecting the definition of an image;
and the target image storage module is used for judging whether the first comparison image and the second comparison image are repeated or not by utilizing the hash value, if so, storing a target image with a large gradient value in the first comparison image and the second comparison image, and storing an original image in the video image corresponding to the target image with the large gradient value.
Optionally, the target image extraction module specifically includes:
the target initial image extraction unit is used for extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image;
and the binarization processing unit is used for carrying out binarization processing on the target initial image to obtain a target image.
Optionally, the gradient value calculating module specifically includes:
a first gradient value calculation unit, configured to perform laplacian filtering on the gray value of the first comparison image to obtain a gradient value of the first comparison image;
and the second gradient value calculation unit is used for performing Laplace filtering on the gray value of the second comparison image to obtain the gradient value of the second comparison image.
Optionally, the target image storage module specifically includes:
a first hamming distance calculating unit for calculating a hamming distance between the first comparison image and the second comparison image using the hash value;
the first judging unit is used for judging whether the Hamming distance is smaller than a preset threshold value or not to obtain a first judging result;
a second judging unit, configured to, when the first judgment result indicates that the hamming distance is smaller than a preset threshold, judge whether a gradient value of the first comparison image is smaller than a gradient value of the second comparison image, to obtain a second judgment result;
a third judging unit, configured to, when the first judgment result indicates that the hamming distance is greater than or equal to a preset threshold value, judge whether the number of spaced frames W is greater than 1, to obtain a third judgment result;
a first storage unit, configured to store the second comparison image, set i to i + W, and return to the first comparison image determination module when the second determination result indicates that the gradient value of the first comparison image is smaller than the gradient value of the second comparison image;
a second storage unit, configured to store the first comparison image, set i to i + W, and return to a second comparison image determination module when the second determination result indicates that the gradient value of the first comparison image is greater than or equal to the gradient value of the second comparison image;
a first updating unit, configured to, when the third determination result indicates that the number of frame intervals W is greater than 1, make W equal to W/2, i equal to i + W, and return to the second comparison image determining module until the first determination result indicates that the hamming distance is smaller than a preset threshold value;
and the second updating unit is used for storing the first comparison image when the third judgment result shows that the interval frame number W is equal to 1, making i equal to i + W, and returning to the first comparison image determining module.
Optionally, the target image storage module further includes:
a fourth judging unit, configured to judge whether the first judgment result and the second judgment result of the target image of consecutive N frames are both yes, and obtain a fourth judgment result;
and a returning unit, configured to, when the fourth determination result indicates that both the first determination result and the second determination result of the target image of consecutive N frames are yes, make W equal to S, and S equal to or less than 1 and equal to or less than N, and return to a second comparison image determining module.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the invention provides an image duplicate removal method and system. The method comprises the following steps: acquiring a video image; extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image; calculating the hash value of each frame of target image; taking the ith frame target image as a first comparison image; taking the i + W frame target image as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1; respectively calculating gradient values of the first comparison image and the second comparison image; the gradient value is used for reflecting the definition of the image; and judging whether the first comparison image and the second comparison image are repeated or not by utilizing the hash value, if so, storing a target image with a large gradient value in the first comparison image and the second comparison image, and storing an original image in the video image corresponding to the target image with the large gradient value. The method combines target detection and image repetition removal, determines one or more interested key target areas in an original image in a video image through the target detection, and only performs repetition removal judgment and image definition judgment on the key target areas, thereby reducing the calculation amount of the repetition removal judgment and the image definition and eliminating the definition calculation error in the target movement process.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a flowchart of an image deduplication method according to an embodiment of the present invention;
fig. 2 is a structural diagram of an image deduplication system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide an image duplicate removal method and an image duplicate removal system, which solve the problem of repeated uploading in the existing image duplicate removal method.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Examples
The present embodiment provides an image deduplication method, and fig. 1 is a flowchart of the image deduplication method provided in the embodiment of the present invention. Referring to fig. 1, the image deduplication method includes:
step 101, acquiring a video image. Step 101 specifically includes: a sequence of video images is acquired, and an original image of each frame in the video images can be obtained.
And 102, extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image.
Step 102 specifically includes:
and extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image. Specifically, target detection is performed on each frame of original image in a video image through a target detection algorithm, the coordinate position of a target in each frame of original image is detected, the target is separated from the background, and a detected target area is extracted to obtain a target initial image. And if the target is not detected in the original image of any frame, deleting the original image of the frame.
The method comprises the steps that a target area in an original image is separated from a background by a target detection algorithm, the gray value of the target area is used for calculating the hash value and the gradient value of each frame of the original image, one or more region of interest (ROI) or key target areas in each frame of the original image are determined by the target detection algorithm, and only the ROI is subjected to duplicate removal judgment and image definition judgment, so that the calculation amount of duplicate removal judgment and image definition is reduced, and the calculation error of definition in the target movement process can be eliminated. The target detection algorithm can adopt a deep learning algorithm based on a neural network, and can also adopt a traditional target detection algorithm. Deep learning algorithms such as Yolo V3 (youonly Look one V3), SSD (Single Shot multi box Detector, Single step multi box Detector), and false RCNN (Faster Region-conditional neural Network), etc., Yolo and SSD are both Single-stage object detection algorithms, and false RCNN is a multi-stage object detection algorithm; conventional target detection algorithms include a characteristic detection method based on HARR (hall) + Adaptive Boosting (Adaptive Boosting), a characteristic detection method based on HOG (Histogram of oriented gradients) + SVM (Support vector machine), and the like. The method for extracting the target area can be that all the pixels outside the detected target area are set to be 0 or 1, and the influence of the pixels in the part of the area on the similarity or definition calculation is eliminated in the subsequent step of calculation. The similarity is calculated as a Hash value (Hash value) of the calculation target image. The image similarity comparison is to calculate the Hamming distance of the Hash values of the two target images, judge whether the Hamming distance of the two target images is smaller than a preset threshold value, and if the Hamming distance is smaller than the preset threshold value, the two target images are similar, namely the two target images are repeated images; the image quality ratio compares the gradient values of the two target images, and the higher the gradient value of the image is, the higher the definition of the image is.
And carrying out binarization processing on the target initial image to obtain a target image. The target image is an image of a target area including the original image.
Step 103, calculating the hash value of each frame of target image. Specifically, the hash value of the target image is calculated according to the gray value of the target area in the target image.
And step 104, taking the target image of the ith frame as a first comparison image.
Step 105, taking the i + W frame target image as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1.
Step 106, respectively calculating gradient values of the first comparison image and the second comparison image; the gradient values are used to reflect the sharpness of the image. A larger gradient value of the image indicates a higher sharpness of the image.
Step 106 specifically includes:
and performing Laplace filtering on the gray value of the first comparison image to obtain a gradient value of the first comparison image.
And performing Laplace filtering on the gray value of the second comparison image to obtain a gradient value of the second comparison image.
And 107, judging whether the first comparison image and the second comparison image are repeated or not by utilizing the hash value, if so, storing a target image with a large gradient value in the first comparison image and the second comparison image, and storing an original image in the video image corresponding to the target image with the large gradient value.
Step 107 specifically includes:
the hamming distance between the first comparison image and the second comparison image is calculated using the hash value. And calculating the Hamming distance of the hash values of the first comparison image and the second comparison image.
And judging whether the Hamming distance is smaller than a preset threshold value or not to obtain a first judgment result.
And if the first judgment result shows that the Hamming distance is smaller than the preset threshold value, judging whether the gradient value of the first comparison image is smaller than that of the second comparison image or not to obtain a second judgment result. And if the Hamming distance between the first comparison image and the second comparison image is smaller than a preset threshold value, the two target images are redundant, and one of the two target images needs to be deleted, so that the Laplace gradient values of the pixels of the first comparison image and the second comparison image are compared, and the target image with the small gradient value is deleted as the redundant image with poor image quality.
And if the first judgment result shows that the Hamming distance is greater than or equal to the preset threshold value, judging whether the interval frame number W is greater than 1 or not, and obtaining a third judgment result.
And if the second judgment result shows that the gradient value of the first comparison image is smaller than that of the second comparison image, storing the second comparison image and the original image in the video image corresponding to the second comparison image, making i equal to i + W, and returning to the step of updating the first comparison image by taking the target image of the ith frame as the first comparison image.
And if the second judgment result shows that the gradient value of the first comparison image is greater than or equal to that of the second comparison image, storing the first comparison image and the original image corresponding to the first comparison image, setting i to i + W, and returning to the step of updating the second comparison image by taking the i + W frame target image as the second comparison image.
And if the third judgment result shows that the spacing frame number W is greater than 1, making W equal to W/2 and i equal to i + W, returning to the step of taking the i + W-th frame target image as the second comparison image to update the second comparison image until the first judgment result shows that the Hamming distance is less than the preset threshold value.
And if the third judgment result shows that the number of the interval frames W is equal to 1, storing the first comparison image and the original image corresponding to the first comparison image, enabling i to be i + W, and returning to the step of updating the first comparison image by taking the ith frame target image as the first comparison image.
And judging whether the first judgment result and the second judgment result of the target images of the continuous N frames are both yes, and obtaining a fourth judgment result.
And if the fourth judgment result shows that the first judgment result and the second judgment result of the target images of the continuous N frames are both yes, making W equal to S, and making S equal to or less than 1 and equal to or less than N, and returning to the step of updating the second comparison image by taking the target image of the i + W frame as the second comparison image. The embodiment also provides a method for selecting candidate frames to perform similarity judgment, namely predicting the window size of subsequent repeated frames according to the count of the continuous repeated frames, setting an interval frame number, and extracting according to the interval frame number instead of continuous extraction when extracting a target image, so that the processing quantity of redundant images can be further reduced, and key information is not missed while the processing quantity is reduced.
The present embodiment provides an implementation of image deduplication, including: acquiring a sequence of video images, and extracting a target area of each frame of original image in the video images by using a target detection algorithm to obtain a target image. And calculating the hash value of each frame of target image.
Initially, let W be 1, and take the 1 st frame target image as the first comparison image and the 2 nd frame target image as the second comparison image.
Gradient values of the first comparison image and the second comparison image are calculated, respectively.
Calculating the Hamming distance of the Hash value of the 1 st frame target image and the 2 nd frame target image, if the Hamming distance of the two target images is smaller than a preset threshold value, indicating that the two target images are redundant, deleting one of the two target images, comparing the Laplace gradient values of the pixels of the two frame target images, namely the gradient values, deleting the target image with a small gradient value as a redundant image with poor quality, and keeping the target image with a large gradient value and the original image in the video image corresponding to the target image with the large gradient value. Meanwhile, taking the reserved target image as a reference, continuously acquiring the next frame image, and performing image similarity and image quality comparison, for example, if the gradient value of the 1 st frame target image is smaller than that of the 2 nd frame target image, deleting the 1 st frame target image, storing the 2 nd frame target image and the original image corresponding to the 2 nd frame target image, and performing image similarity and image quality comparison on the stored 2 nd frame target image and the 3 rd frame target image because W is 1. In this embodiment, laplacian filtering is performed on the gray value of the image to obtain a laplacian gradient value, that is, a gradient value, and the laplacian gradient value is used as an image sharpness evaluation function to evaluate sharpness of the image, where a larger laplacian gradient value of the image indicates a higher sharpness of the image.
If the Hamming distance between the two frames of target images is larger than or equal to the preset threshold value, the two frames of target images are not similar, and the 1 st frame of target image and the original image corresponding to the 1 st frame of target image are stored, or the 1 st frame of target image and the original image corresponding to the 1 st frame of target image are transmitted to the background server. Meanwhile, taking the 2 nd frame target image as a reference, continuing to compare the image similarity and the image quality with a subsequent target image, taking the 2 nd frame target image as a reference, comparing the image similarity and the image quality of the 2 nd frame target image with the 3 rd frame target image, if the 2 nd frame target image is not similar to the 3 rd frame target image, storing the 2 nd frame target image and an original image corresponding to the 2 nd frame target image, and taking the 3 rd frame target image as a reference, continuing to compare the image similarity and the image quality with the subsequent target image; if the target image of the 2 nd frame is similar to the target image of the 3 rd frame, comparing the gradient values of the target image of the 2 nd frame and the target image of the 3 rd frame, and continuously comparing the image similarity and the image quality with the subsequent target image by taking the target image with high definition as a reference.
In actual video monitoring, a monitored video image may not change for a long time, and if the image similarity and the image quality of each frame of target image are compared, the calculation amount is large, so an implementation method for selecting a subsequent image frame is provided: first stageWhen image deduplication is started, the interval frame number W of the target image is 1, namely the target images of adjacent frames are taken for image similarity and image quality comparison. After a period of time, judging whether the continuous N frames of target images in the time T are all repeated images (the Hamming distance between two adjacent frames of target images is smaller than a preset threshold value), if the continuous N frames of target images are all repeated images, adjusting the number W of interval frames to be S, wherein S is more than or equal to 1 and less than or equal to N, and then, adjusting the next non-repeated target image FnAs a first comparison image, a target image F to be non-repeatednTarget image F spaced by W frames, i.e. S framesmAs a second comparison image, image similarity and image quality comparison is performed, where m + W + n + S, n representing the target image FnM represents the target image FmS represents an integer of 1 or more and N or less. If the target image FnWith the target image FmAnd keeping the target image with high definition for repeating the image, taking the target image with high definition as a first comparison image, taking the target image separated from the first comparison image by W frames, namely the target image of S frame as a second comparison image, and comparing the image similarity and the image quality. If the target image FnWith the target image FmIf the image is not a duplicate image, let W/2 be S/2, in which case m + n + W be n + S/2, and continue to compare the target image FnWith the target image FmImage similarity and image quality. When a new image frame is selected to be compared with the current image frame in similarity, if the new image frame is similar to the current frame, the interval frame number W is kept unchanged, if the new image frame is not similar to the current frame, the interval frame number W is halved, and the minimum W is reduced to 1. For example, the target images of 10 consecutive frames within the time T are all repeated images, the number W of interval frames is adjusted to be 8 when W is equal to S, and if the target image of 11 th frame is a non-repeated target image, 11+ W is equal to 19, and the target image of 19 th frame is compared with the target image of 11 th frame in terms of image similarity and image quality. If the 19 th frame target image and the 11 th frame target image are repeated images and the definition of the 19 th frame target image is greater than that of the 11 th frame target image, 19+ W is 27, and the image similarity and the image quality of the 27 th frame target image and the 19 th frame target image are compared; if the 19 th frame target image and the 11 th frameAnd if the target image is a repeated image and the definition of the 11 th frame target image is greater than or equal to that of the 19 th frame target image, 11+2W is equal to 27, and the 27 th frame target image is compared with the 11 th frame target image in terms of image similarity and image quality. If the 19 th frame target image and the 11 th frame target image are non-repetitive images, W/2 is S/2 is 4, and the 15 th frame target image and the 11 th frame target image are compared in image similarity and image quality; and if the 15 th frame target image and the 11 th frame target image are non-repetitive images, W/2 is 2, and the 13 th frame target image and the 11 th frame target image are compared in image similarity and image quality until W is 1.
The embodiment also provides an image deduplication system, and fig. 2 is a structural diagram of the image deduplication system provided by the embodiment of the invention. Referring to fig. 2, the image deduplication system includes:
an obtaining module 201, configured to obtain a video image.
The target image extraction module 202 is configured to extract a target area of each frame of original image in the video image through a target detection algorithm, so as to obtain a target image.
The target image extraction module 202 specifically includes:
and the target initial image extracting unit is used for extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image.
And the binarization processing unit is used for carrying out binarization processing on the target initial image to obtain a target image.
And the hash value calculation module 203 is used for calculating the hash value of each frame of target image.
And a first comparison image determining module 204, configured to use the i-th frame target image as the first comparison image.
A second comparison image determination module 205, configured to use the i + W frame target image as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1.
A gradient value calculation module 206 for calculating gradient values of the first comparison image and the second comparison image, respectively; the gradient values are used to reflect the sharpness of the image.
The gradient value calculating module 206 specifically includes:
and the first gradient value calculation unit is used for carrying out Laplace filtering on the gray value of the first comparison image to obtain the gradient value of the first comparison image.
And the second gradient value calculating unit is used for carrying out Laplace filtering on the gray value of the second comparison image to obtain the gradient value of the second comparison image.
And the target image storage module 207 is configured to determine whether the first comparison image and the second comparison image are repeated by using the hash value, store a target image with a large gradient value in the first comparison image and the second comparison image if the first comparison image and the second comparison image are repeated, and store an original image in the video image corresponding to the target image with the large gradient value.
The target image storage module 207 specifically includes:
and a first Hamming distance calculating unit for calculating a Hamming distance between the first comparison image and the second comparison image using the hash value.
The first judging unit is used for judging whether the Hamming distance is smaller than a preset threshold value or not to obtain a first judging result.
And the second judgment unit is used for judging whether the gradient value of the first comparison image is smaller than that of the second comparison image or not when the first judgment result shows that the Hamming distance is smaller than the preset threshold value, so as to obtain a second judgment result.
And the third judging unit is used for judging whether the interval frame number W is greater than 1 or not when the first judging result shows that the Hamming distance is greater than or equal to the preset threshold value, and obtaining a third judging result.
And a first storage unit, configured to store the second comparison image and an original image in the video image corresponding to the second comparison image when the second determination result indicates that the gradient value of the first comparison image is smaller than the gradient value of the second comparison image, and return to the first comparison image determining module 205 by making i equal to i + W.
And a second storage unit, configured to store the first comparison image and the original image corresponding to the first comparison image when the second determination result indicates that the gradient value of the first comparison image is greater than or equal to the gradient value of the second comparison image, and return i to i + W, which is returned to the second comparison image determination module 206.
And a first updating unit, configured to, when the third determination result indicates that the interval frame number W is greater than 1, make W equal to W/2, and i equal to i + W, and return to the second comparative image determining module 206 until the first determination result indicates that the hamming distance is smaller than the preset threshold value.
And a second updating unit, configured to, when the third determination result indicates that the inter-frame number W is equal to 1, store the first comparison image and the original image corresponding to the first comparison image, make i equal to i + W, and return to the first comparison image determining module 205.
And the fourth judging unit is used for judging whether the first judging result and the second judging result of the target images of the continuous N frames are both yes or not to obtain a fourth judging result.
And a returning unit, configured to, when the fourth determination result indicates that both the first determination result and the second determination result of the target image of consecutive N frames are yes, make W equal to S, and S equal to or less than 1 and equal to or less than N, and return to the second comparison image determining module 206.
In the prior art, a hash value is generally calculated for an entire frame of original image in a video image, which results in a large calculation amount, and in addition, in some scenes, such as a camera real-time monitoring scene, a key target to be detected does not change, but a large number of other interference targets in the video image change, under which condition, it is easily determined that a non-similar image is stored or reported, but actually, the non-similar image is not needed; in addition, in the definition judgment, the key target is blurred, but the background is clear, so that the original image may be judged to be clear, an error image is uploaded, and the information of the actually desired key target is blurred. The method combines the target detection algorithm with the image duplication elimination, determines one or more ROI (regions of interest) in each frame of original image through the target detection algorithm, compares the image similarity and the image quality only aiming at the ROI, reduces the calculated amount of duplication elimination judgment and the calculated amount of image definition, and simultaneously eliminates the calculation error of the definition in the target movement process.
In the actual video monitoring, the monitored video images have no change for a long time, and if each frame is compared and compared repeatedly, the calculated amount is large, so the invention provides a method for selecting candidate frames to judge the similarity, namely, the number of the subsequent repeated frames is predicted through the number of the continuously repeated frames, the number of the interval frames is set as the number of the predicted subsequent repeated frames, when the video images are extracted, the original images needing to be subjected to the de-duplication judgment are extracted according to the number of the interval frames instead of the de-duplication judgment of each frame of the original images, the number of the video image processing can be further reduced, and the processing amount is reduced without missing key information.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.

Claims (4)

1. An image deduplication method, comprising:
acquiring a video image;
extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image;
calculating the hash value of each frame of the target image;
taking the target image of the ith frame as a first comparison image;
taking the target image of the (i + W) th frame as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1;
respectively calculating gradient values of the first comparison image and the second comparison image; the gradient value is used for reflecting the definition of an image; the method specifically comprises the following steps:
performing Laplace filtering on the gray value of the first comparison image to obtain a gradient value of the first comparison image;
performing Laplace filtering on the gray value of the second comparison image to obtain a gradient value of the second comparison image;
judging whether the first comparison image and the second comparison image are repeated or not by utilizing the hash value, if so, storing a target image with a large gradient value in the first comparison image and the second comparison image, and storing an original image in the video image corresponding to the target image with the large gradient value;
the determining, by using the hash value, whether the first comparison image and the second comparison image are repeated, and if yes, storing a target image with a large gradient value in the first comparison image and the second comparison image specifically includes:
calculating a hamming distance between the first comparison image and the second comparison image using the hash value;
judging whether the Hamming distance is smaller than a preset threshold value or not to obtain a first judgment result;
if the first judgment result shows that the Hamming distance is smaller than a preset threshold value, judging whether the gradient value of the first comparison image is smaller than that of the second comparison image or not to obtain a second judgment result;
if the first judgment result shows that the Hamming distance is larger than or equal to a preset threshold value, judging whether the interval frame number W is larger than 1 or not, and obtaining a third judgment result;
if the second judgment result indicates that the gradient value of the first comparison image is smaller than that of the second comparison image, storing the second comparison image, and making i equal to i + W, and returning to the step of taking the target image of the ith frame as the first comparison image;
if the second judgment result indicates that the gradient value of the first comparison image is greater than or equal to the gradient value of the second comparison image, storing the first comparison image, setting i to i + W, and returning to the step of taking the target image of the i + W th frame as the second comparison image;
if the third judgment result shows that the spacing frame number W is greater than 1, making W equal to W/2, and i equal to i + W, and returning to the step of taking the target image of the i + W-th frame as a second comparison image until the first judgment result shows that the Hamming distance is smaller than a preset threshold value;
if the third judgment result shows that the number of interval frames W is equal to 1, storing the first comparison image, enabling i to be i + W, and returning to the step of taking the target image of the ith frame as the first comparison image;
judging whether the first judgment result and the second judgment result of the target images of the continuous N frames are both yes, and obtaining a fourth judgment result;
and if the fourth judgment result indicates that the first judgment result and the second judgment result of the target image of the continuous N frames are both yes, making W equal to S and S equal to or less than 1 and equal to or less than N, and returning to the step of taking the target image of the i + W frame as a second comparison image.
2. The image deduplication method according to claim 1, wherein the extracting, by a target detection algorithm, a target area of each frame of original image in the video image to obtain a target image specifically comprises:
extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image;
and carrying out binarization processing on the target initial image to obtain a target image.
3. An image deduplication system, comprising:
the acquisition module is used for acquiring a video image;
the target image extraction module is configured to extract a target area of each frame of original image in the video image through a target detection algorithm to obtain a target image, and specifically includes:
the target initial image extraction unit is used for extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image;
a binarization processing unit, configured to perform binarization processing on the target initial image to obtain a target image;
the hash value calculation module is used for calculating the hash value of each frame of the target image;
the first comparison image determining module is used for taking the target image of the ith frame as a first comparison image;
the second comparison image determining module is used for taking the target image of the (i + W) th frame as a second comparison image; w represents the interval frame number of the target image, and W is more than or equal to 1;
a gradient value calculation module for calculating gradient values of the first comparison image and the second comparison image, respectively; the gradient value is used for reflecting the definition of an image; the gradient value calculating module specifically includes:
a first gradient value calculation unit, configured to perform laplacian filtering on the gray value of the first comparison image to obtain a gradient value of the first comparison image;
a second gradient value calculating unit, configured to perform laplacian filtering on the gray value of the second comparison image to obtain a gradient value of the second comparison image
The target image storage module is used for judging whether the first comparison image and the second comparison image are repeated or not by utilizing the hash value, if so, storing a target image with a large gradient value in the first comparison image and the second comparison image, and storing an original image in the video image corresponding to the target image with the large gradient value;
the target image storage module specifically comprises:
a first hamming distance calculating unit for calculating a hamming distance between the first comparison image and the second comparison image using the hash value;
the first judging unit is used for judging whether the Hamming distance is smaller than a preset threshold value or not to obtain a first judging result;
a second judging unit, configured to, when the first judgment result indicates that the hamming distance is smaller than a preset threshold, judge whether a gradient value of the first comparison image is smaller than a gradient value of the second comparison image, to obtain a second judgment result;
a third judging unit, configured to, when the first judgment result indicates that the hamming distance is greater than or equal to a preset threshold value, judge whether the number of spaced frames W is greater than 1, to obtain a third judgment result;
a first storage unit, configured to store the second comparison image, set i to i + W, and return to the first comparison image determination module when the second determination result indicates that the gradient value of the first comparison image is smaller than the gradient value of the second comparison image;
a second storage unit, configured to store the first comparison image, set i to i + W, and return to a second comparison image determination module when the second determination result indicates that the gradient value of the first comparison image is greater than or equal to the gradient value of the second comparison image;
a first updating unit, configured to, when the third determination result indicates that the number of frame intervals W is greater than 1, make W equal to W/2, i equal to i + W, and return to the second comparison image determining module until the first determination result indicates that the hamming distance is smaller than a preset threshold value;
a second updating unit, configured to store the first comparison image, set i to i + W, and return to the first comparison image determining module when the third determination result indicates that the inter-frame number W is equal to 1;
a fourth judging unit, configured to judge whether the first judgment result and the second judgment result of the target image of consecutive N frames are both yes, and obtain a fourth judgment result;
and a returning unit, configured to, when the fourth determination result indicates that both the first determination result and the second determination result of the target image of consecutive N frames are yes, make W equal to S, and S equal to or less than 1 and equal to or less than N, and return to a second comparison image determining module.
4. The image deduplication system of claim 3, wherein the target image extraction module specifically comprises:
the target initial image extraction unit is used for extracting a target area of each frame of original image in the video image through a target detection algorithm to obtain a target initial image;
and the binarization processing unit is used for carrying out binarization processing on the target initial image to obtain a target image.
CN202010337253.3A 2020-04-26 2020-04-26 Image duplicate removal method and system Active CN111553259B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010337253.3A CN111553259B (en) 2020-04-26 2020-04-26 Image duplicate removal method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010337253.3A CN111553259B (en) 2020-04-26 2020-04-26 Image duplicate removal method and system

Publications (2)

Publication Number Publication Date
CN111553259A CN111553259A (en) 2020-08-18
CN111553259B true CN111553259B (en) 2022-03-15

Family

ID=72000282

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010337253.3A Active CN111553259B (en) 2020-04-26 2020-04-26 Image duplicate removal method and system

Country Status (1)

Country Link
CN (1) CN111553259B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112399236B (en) * 2020-10-09 2022-08-26 北京达佳互联信息技术有限公司 Video duplicate checking method and device and electronic equipment
CN112738533A (en) * 2020-12-28 2021-04-30 中国南方电网有限责任公司超高压输电公司 Machine patrol image regional compression method
CN112929695B (en) * 2021-01-25 2022-05-27 北京百度网讯科技有限公司 Video duplicate removal method and device, electronic equipment and storage medium
CN113568571A (en) * 2021-06-28 2021-10-29 西安电子科技大学 Image de-duplication method based on residual error neural network
CN113971229A (en) * 2021-10-20 2022-01-25 成都智元汇信息技术股份有限公司 Frame comparison method analysis method and device
CN114549876A (en) * 2022-01-10 2022-05-27 上海明胜品智人工智能科技有限公司 Image processing method, device and system
CN115190320A (en) * 2022-06-09 2022-10-14 武汉鸿宸信信息科技有限公司 Cloud computing system and method for video processing and storage
CN117119253B (en) * 2023-06-28 2024-05-07 三峡科技有限责任公司 High-quality video frame extraction method for target object

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528587B (en) * 2015-12-29 2019-04-30 生迪智慧科技有限公司 The method and device of target detection
CN105825201A (en) * 2016-03-31 2016-08-03 武汉理工大学 Moving object tracking method in video monitoring
CN106327426A (en) * 2016-08-19 2017-01-11 携程计算机技术(上海)有限公司 Image replication removing method and image replication removing system
CN106708951B (en) * 2016-11-25 2019-10-11 西安电子科技大学 The client image of ownership certification is supported to obscure De-weight method
CN110427895A (en) * 2019-08-06 2019-11-08 李震 A kind of video content similarity method of discrimination based on computer vision and system

Also Published As

Publication number Publication date
CN111553259A (en) 2020-08-18

Similar Documents

Publication Publication Date Title
CN111553259B (en) Image duplicate removal method and system
KR102155182B1 (en) Video recording method, server, system and storage medium
JP4616702B2 (en) Image processing
CN106937114B (en) Method and device for detecting video scene switching
US9189867B2 (en) Adaptive image processing apparatus and method based in image pyramid
KR101891225B1 (en) Method and apparatus for updating a background model
EP1542155A1 (en) Object detection
JP2018010621A (en) Method and device for updating background model used for background difference of image
WO2021139049A1 (en) Detection method, detection apparatus, monitoring device, and computer readable storage medium
EP1914994A1 (en) Detection of gradual transitions in video sequences
EP1542153A1 (en) Object detection
Muller-Schneiders et al. Performance evaluation of a real time video surveillance system
JPH07508367A (en) How to detect changes in video images
US20030112874A1 (en) Apparatus and method for detection of scene changes in motion video
CN111062273A (en) Tracing detection and alarm method for left-over articles
CN111723773B (en) Method and device for detecting carryover, electronic equipment and readable storage medium
EP1542152A1 (en) Object detection
EP1542154A2 (en) Object detection
CN109800329B (en) Monitoring method and device
CN116543334A (en) Key frame extraction method, device, electronic equipment and storage medium
CN111611944A (en) Identity recognition method and device, electronic equipment and storage medium
CN109359530B (en) Intelligent video monitoring method and device
CN110769262B (en) Video image compression method, system, equipment and storage medium
CN111723713B (en) Video key frame extraction method and system based on optical flow method
CN112581489A (en) Video compression method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant