CN109934262B - Picture variability judging method, device, computer equipment and storage medium - Google Patents

Picture variability judging method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109934262B
CN109934262B CN201910101305.4A CN201910101305A CN109934262B CN 109934262 B CN109934262 B CN 109934262B CN 201910101305 A CN201910101305 A CN 201910101305A CN 109934262 B CN109934262 B CN 109934262B
Authority
CN
China
Prior art keywords
pictures
gray
picture
difference
pixel points
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
CN201910101305.4A
Other languages
Chinese (zh)
Other versions
CN109934262A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910101305.4A priority Critical patent/CN109934262B/en
Priority to PCT/CN2019/089058 priority patent/WO2020155485A1/en
Publication of CN109934262A publication Critical patent/CN109934262A/en
Application granted granted Critical
Publication of CN109934262B publication Critical patent/CN109934262B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a picture difference judging method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring two pictures to be identified; carrying out graying treatment on the two pictures to obtain two gray pictures; calculating an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculating an average value B of gray values of all pixel points in the gray picture; according to the formula:calculating the overall variance of the mth column or the mth row of the gray pictureWhere N is the total number of columns or rows in the grayscale picture; according to the formula:obtaining the difference between the overall variances of the mth column or the mth row of the two gray picturesJudgingWhether the variance error threshold is smaller than a preset variance error threshold; if it isAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different. Therefore, the picture identification and judgment time is reduced on the basis of ensuring the picture difference judgment accuracy.

Description

Picture variability judging method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a method and apparatus for determining image variability, a computer device, and a storage medium.
Background
Picture identification is a widely used technology and has important roles in various fields. At present, the identification of pictures is generally based on the comparison of pixel points, and if the pixel points of two pictures are the same, the two pictures are not different. However, this manner of recognizing pictures has technical drawbacks, including at least: the calculated amount is large, three primary colors of pixel points of any picture to be compared are required to be compared one by one, and the time consumption is long, and the calculation resources are more; the pictures processed by zooming and the like cannot be identified, and identification errors are easy to cause; for pictures with larger files, lengthy recognition times and excessive computing resources are required. Therefore, the above-mentioned technical drawbacks to be solved in the prior art picture recognition method exist.
Disclosure of Invention
The application mainly aims to provide a picture difference judging method, a picture difference judging device, computer equipment and a storage medium, and aims to reduce picture identification and judging time on the basis of ensuring picture difference judging accuracy.
In order to achieve the above object, the present application provides a method for judging the difference of pictures, comprising the following steps:
acquiring two pictures to be identified;
Carrying out graying treatment on the two pictures to obtain two gray pictures;
calculating an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculating an average value B of gray values of all pixel points in the gray picture;
according to the formula:calculating the overall variance of the mth column or the mth row of the gray pictureWhere N is the total number of columns or rows in the grayscale picture;
according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture;
judgingWhether the variance error threshold is smaller than a preset variance error threshold;
if it isAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
Further, the step of performing graying processing on the two pictures to obtain two gray pictures includes:
the resolution, the picture length and the picture width of the two pictures are obtained, and according to the formula: the total number of pixel points = resolution x picture length + resolution x picture width, and the total number of pixel points of the two pictures is calculated respectively;
Judging whether the total number of the pixel points of the two pictures is the same or not;
and if the total number of the pixel points of the two pictures is the same, carrying out graying treatment on the two pictures to obtain two gray pictures.
Further, if the total number of pixels of the two pictures is the same, performing graying processing on the two pictures to obtain two gray pictures, including:
if the total number of the pixel points of the two pictures is the same, acquiring the file sizes of the two pictures, and judging whether the difference of the file sizes of the two pictures is smaller than a preset file size threshold value or not;
if the difference of the file sizes of the two pictures is not smaller than a preset file size threshold, respectively intercepting pixel points of a designated column or row of the two pictures to form two intercepted pictures;
and carrying out graying treatment on the two intercepted pictures to obtain two gray pictures.
Further, the step of performing graying processing on the two pictures to obtain two gray pictures includes:
respectively acquiring the appointed number of pixel points of the two pictures by using a preset acquisition rule, and analyzing the color value range of the appointed number of pixel points to respectively obtain the number of bits of the color depth of the two pictures;
Judging whether the bit numbers of the color depth of the two pictures are smaller than a preset color depth threshold value or not;
and if the bit numbers of the color depths of the two pictures are smaller than the preset color depth threshold value, carrying out graying treatment on the two pictures to obtain two gray pictures.
Further, the step of calculating the average value Am of the gray values of all the pixels in the mth column or the mth row of the gray picture, and calculating the average value B of the gray values of all the pixels in the gray picture includes:
collecting gray values of all pixel points in the gray picture;
adding the gray values of all the pixel points in the mth column or the mth row of the gray picture to obtain an mth column or an mth row added value, dividing the mth column or the mth row added value by the number of all the pixel points in the mth column or the mth row to obtain an average value Am of the gray values of all the pixel points in the mth column or the mth row of the gray picture;
and adding the gray values of all the pixel points in the gray picture to obtain an added value of the gray picture, and dividing the added value of the gray picture by the total number of all the pixel points in the gray picture to obtain an average value B of the gray values of all the pixel points in the gray picture.
Further, the judgmentAfter the step of determining whether the variance error threshold is smaller than the preset variance error threshold, the method comprises the following steps:
if it isIf the difference is not smaller than the preset variance error threshold, judging that the two pictures are different;
acquisition ofAnd marking the column or row corresponding to the value not smaller than the preset variance error threshold as a difference column or a difference row.
Further, the acquiringAfter the step of marking the column or row corresponding to the value not smaller than the preset variance error threshold as the difference column or the difference row, the method comprises the following steps:
restoring the pixel points of the difference columns or the difference rows to the color before the graying treatment to obtain restoring columns or restoring rows;
and comparing pixel points of the reduction columns or the reduction rows in the two gray level pictures one by one to obtain difference pixel points, and carrying out special marking on the difference pixel points.
The application provides a picture difference judging device, comprising:
the picture acquisition unit is used for acquiring two pictures to be identified;
the gray level picture acquisition unit is used for carrying out gray level treatment on the two pictures to obtain two gray level pictures;
A gray average value calculating unit, configured to calculate an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculate an average value B of gray values of all pixel points in the gray picture;
a total variance calculating unit for calculating a total variance according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture;
a difference calculation unit of the overall variance, for calculating the difference according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture;
variance error threshold value judging unit for judgingWhether the variance error threshold is smaller than a preset variance error threshold;
no difference judging unit for ifAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
The present application provides a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
The present application provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the preceding claims.
The picture difference judging method, the picture difference judging device, the computer equipment and the storage medium of the application obtain two gray pictures by carrying out gray processing on the two pictures and calculate the overall variance of the mth column or the mth row of the gray picturesObtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>If it isAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different, thereby reducing the picture identification and judgment time on the basis of ensuring the picture difference judgment accuracy.
Drawings
FIG. 1 is a flowchart of a method for determining a difference between pictures according to an embodiment of the present application;
FIG. 2 is a block diagram schematically illustrating a device for determining a difference between pictures according to an embodiment of the present application;
fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Referring to fig. 1, an embodiment of the present application provides a method for determining a difference between pictures, including the following steps:
s1, acquiring two pictures to be identified;
s2, carrying out gray processing on the two pictures to obtain two gray pictures;
s3, calculating an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculating an average value B of gray values of all pixel points in the gray picture;
s4, according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture;
s5, according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture;
s6, judgingWhether the variance error threshold is smaller than a preset variance error threshold;
s7, ifAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
As described in step S1, two pictures to be identified are acquired. The two pictures to be identified may be two unknown pictures, or may be a pre-stored reference picture and an unknown picture (used for judging the difference between other pictures and the reference picture). Wherein the parameters of the two pictures are preferably the same, e.g. the preferred resolution is the same.
And (2) performing graying treatment on the two pictures to obtain two gray pictures. Here, graying means that a color is expressed as one gray color, for example, in an RGB model, if r=g=b, the color is expressed as one gray color, wherein the value of r=g=b is called a gray value, and thus, only one byte is required for each pixel of a gray image to store the gray value (also called an intensity value, a brightness value), thereby reducing the storage amount. The gray scale range is, for example, 0-255 (when the values of R, G, and B are all 0-255, they will also change with the change of the value ranges of R, G, and B. The method for applying the gradation processing may be any method, for example, a component method, a maximum value method, an average value method, a weighted average method, or the like. The number of the gray values is 256, and the calculation amount can be greatly reduced by comparing the images on the basis.
As described in the above step S3, the average value Am of the gray values of all the pixels in the mth column or the mth row of the gray picture is calculated, and the average value B of the gray values of all the pixels in the gray picture is calculated. The process of calculating the average value Am of the gray values of all the pixel points of the mth column or the mth row of the gray picture comprises the following steps: and collecting the gray values of all the pixel points in the m-th column or m-th row of the gray picture, adding the gray values of all the pixel points in the m-th column or m-th row, dividing the sum of the gray values obtained by adding the gray values by the number of all the pixel points in the m-th column or m-th row of the gray picture, and obtaining the average value Am of the gray values of all the pixel points in the m-th column or m-th row of the gray picture. The process of calculating the average value B of the gray values of all the pixel points in the gray picture comprises the following steps: and calculating the sum of the gray values of all the pixel points in the gray image, and dividing the sum of the gray values by the number of the pixel points to obtain an average value B of the gray values of all the pixel points in the gray image.
As described in step S4 above, according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture. In the application, the overall variance is used for measuring the difference between the average value Am of the gray values of the pixel points in the m-th column or m-th row of the gray picture and the average value B of the gray values of all the pixel points in the gray picture.
As described in step S5 above, according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>Is the overall variance of the mth column or the mth row of the second gray picture. Difference of overall variance->The difference of the gray values of the m-th column or m-th row of the two gray pictures is reflected. When->Smaller, for example 0, indicates +.>Equal to or approximately equal to->The gray value of the m-th column or m-th row of the first gray scale picture can be regarded as the same or approximately the same as the gray value of the m-th column or m-th row of the second gray scale picture (approximate judgment is performed to save calculation power, and the overall variances of the two different pictures are generally not equal, so that the judgment accuracy is high), otherwise, the gray value of the m-th column or m-th row of the first gray scale picture is regarded as different from the gray value of the m-th column or m-th row of the second gray scale picture.
As described in the above step S6, judgmentWhether less than a preset variance error threshold. Wherein->The return value of (2) is +.>Maximum value of (1)Less than a preset variance error threshold, indicating all +.>The gray values of all columns or all rows of the first gray level picture are the same or approximately the same as the gray values of all columns or all rows of the second gray level picture, i.e. the gray values of all pixels of the first gray level picture are the same as the gray values of the second gray level picture.
If, as described in the above step S7And if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different. As mentioned above, if->Less than a preset variance error threshold, indicating all +.>The gray values of all columns or all rows of the first gray image are the same as or approximately the same as the gray values of all columns or all rows of the second gray image, i.e., the gray values of all pixels of the first gray image are the same as the gray values of the second gray image, so as to determine that the two images are not different (approximate determination, since all gray values of the gray images converted by two different images are generally not equal and all gray values of the gray images converted by the same image are generally equal), the accuracy of the determination is ensured.
In one embodiment, the step S2 of performing the graying process on the two pictures to obtain two gray-scale pictures includes:
s201, acquiring the resolution, the picture length and the picture width of the two pictures, and according to the formula: the total number of pixel points = resolution x picture length + resolution x picture width, and the total number of pixel points of the two pictures is calculated respectively;
s202, judging whether the total number of pixels of the two pictures is the same or not;
and S203, if the total number of the pixels of the two pictures is the same, carrying out gray processing on the two pictures to obtain two gray pictures.
As described above, the two pictures are subjected to the graying processing on the premise that the total number of the pixels of the two pictures is the same, and two gray pictures are obtained. In general, it is difficult to determine that two pictures are identical, but it is simpler to determine that two pictures are different. When the total pixel point numbers of the two pictures are different, the two pictures are judged to be different. Accordingly, the total number of pixels of the picture is calculated. The total number of pixels is directly related to the resolution of the picture, the length of the picture and the width of the picture, and the formula is as follows: the total number of pixels=resolution×picture length+resolution×picture width, and the total number of pixels of the two pictures can be calculated respectively. And after the total number of the pixel points of the two pictures is the same, carrying out graying treatment on the two pictures to obtain two gray pictures. Where resolution is a parameter that measures how much data is in an image, typically expressed as pixels per inch (ppi) and dots per inch (dpi).
In one embodiment, if the total number of pixels of the two pictures is the same, the step S203 of performing graying processing on the two pictures to obtain two gray-scale pictures includes:
s2031, if the total number of pixels of the two pictures is the same, acquiring file sizes of the two pictures, and judging whether the difference of the file sizes of the two pictures is smaller than a preset file size threshold;
s2032, if the difference of the file sizes of the two pictures is not smaller than a preset file size threshold, respectively intercepting pixel points of a designated column or row of the two pictures to form two intercepted pictures;
and S2033, carrying out graying treatment on the two intercepted pictures to obtain two gray pictures.
As described above, it is achieved to reduce the amount of computation by taking pictures. When the file size of the picture is too large, the comparison of the pictures consumes excessive calculation amount. According to the embodiment, the pixel points of the designated columns or the designated rows are intercepted to form two intercepted pictures, and the file size is reduced to reduce the calculated amount on the premise that the information of the intercepted pictures is not lost. Wherein the designated column or row may be any column or row, for example, a continuous column or continuous row, preferably including a designated column or row 1. Further, the truncated picture is composed of a specified column or a specified row selected in an arithmetic sequence or an arithmetic sequence.
In one embodiment, the step S2 of performing the graying process on the two pictures to obtain two gray-scale pictures includes:
s211, respectively acquiring a specified number of pixel points of the two pictures by using a preset acquisition rule, and analyzing the color value range of the specified number of pixel points to respectively obtain the number of bits of the color depth of the two pictures;
s212, judging whether the bit numbers of the color depths of the two pictures are smaller than a preset color depth threshold value or not;
s213, if the number of bits of the color depth of the two pictures is smaller than a preset color depth threshold, carrying out graying treatment on the two pictures to obtain two gray pictures.
As described above, the color requirement of the picture is judged by the number of bits of the color depth, and the picture is subjected to the graying processing under the condition of lower color requirement. The color depth represents the number of bits used to store a 1-pixel color (e.g., any one of the three primary colors RGB), also referred to as bits/pixel (bpp), in a bitmap or video frame buffer. The higher the color depth, the more colors are available, if the color depth is n bits, i.e., there are n color choices to the power of 2, and the number of bits used per pixel is stored as n. That is, the larger the number of bits n of the color depth is, the higher the requirement of the picture on the color is, and therefore, the gradation processing should not be performed (the higher the requirement of the color is, the more information is lost in the gradation processing, and erroneous judgment is likely to occur). The preset acquisition rules comprise random acquisition, acquisition according to an arithmetic series and other arbitrary feasible modes. The color value range of the pixel points refers to the number of optional colors (n times of 2, namely color depth) of the pixel points, and the color value range can be obtained by confirming the specific numerical value of the collected pixel points. Specifically, the process of analyzing the color value range of the specified number of pixels to obtain the number of bits of the color depth of the picture includes: obtaining the maximum values of the three primary colors of the specified number of pixel points; taking the maximum value +1 in the maximum value of each of the three primary colors (because the color value is initially 0) as the maximum value of the color value range of the pixel point; according to the formula: 2 × the maximum value of the range of color values, obtaining the minimum value of n, and taking the minimum value of n as the number of bits of the color depth of the picture. Further, if the number of bits of the color depth of the two pictures is not less than the preset color depth threshold, the picture difference judging means in other embodiments is still used to perform the picture difference judgment, where the gray value is replaced by the tri-primary value (although the calculated amount is increased by about two times, the accuracy of the difference judgment can be ensured).
In one embodiment, the step S3 of calculating the average value Am of the gray values of all the pixels in the m-th column or m-th row of the gray picture and calculating the average value B of the gray values of all the pixels in the gray picture includes:
s301, collecting gray values of all pixel points in the gray picture;
s302, adding the gray values of all the pixels in the mth column or the mth row of the gray picture to obtain an mth column or an mth row added value, dividing the mth column or the mth row added value by the number of all the pixels in the mth column or the mth row to obtain an average value Am of the gray values of all the pixels in the mth column or the mth row of the gray picture;
and S303, adding the gray values of all the pixel points in the gray level picture to obtain an added value of the gray level picture, and dividing the added value of the gray level picture by the total number of all the pixel points in the gray level picture to obtain an average value B of the gray level values of all the pixel points in the gray level picture.
As described above, it is achieved that the calculation of the average value Am of the gradation values of all the pixel points in the m-th column or m-th row of the gradation picture and the calculation of the average value B of the gradation values of all the pixel points in the gradation picture are performed using arithmetic average values. The average value B of the gray values of all the pixel points in the gray image is the average value of the gray values of the pixel points in the column or all the rows in the gray image. The gray values of all the pixel points in the gray picture are collected, and then the addition and division processing is carried out, so that the average value Am of the gray values of all the pixel points in the mth column or the mth row of the gray picture and the average value B of the gray values of all the pixel points in the gray picture are respectively calculated.
In one embodiment, the determiningAfter step S6, if it is smaller than the preset variance error threshold, it includes:
s61, ifIf the difference is not smaller than the preset variance error threshold, judging that the two pictures are different;
s62, obtainingAnd marking the column or row corresponding to the value not smaller than the preset variance error threshold as a difference column or a difference row.
As described above, it is achieved that the pictures are judged to be different and the difference columns or the difference rows are marked. Where the overall variance reflects the difference between the average value (i.e., variable) of each column or row and the average value (overall mean) of the gray picture. If the two pictures are identical, the overall variance should be equal or approximately equal. Accordingly, ifAnd if the difference is not smaller than the preset variance error threshold, judging that the two pictures are different. After determining that the two pictures are different, by determiningAnd obtaining the difference column or the difference row by a value which is not smaller than a preset variance error threshold value. Specifically, if->The mth column or the mth row is the difference column or the difference row, i.e. the subscript of the value not smaller than the preset variance error threshold value, represents the difference column or the difference row.
In one embodiment, the acquiringAfter step S62, in which the value of the variance error threshold is not smaller than the preset value, and the column or row corresponding to the value not smaller than the preset variance error threshold is marked as a difference column or a difference row, the method includes:
s621, restoring the pixel points of the difference columns or the difference rows to the color before the graying treatment to obtain restoring columns or restoring rows;
s622, comparing pixel points of the reduction columns or the reduction rows in the two gray level pictures one by one to obtain difference pixel points, and performing special marking on the difference pixel points.
As described above, it is achieved that the difference pixel points are specifically marked. From the known difference columns or rows, it is not clear which pixels differ. In this embodiment, the positions of the differential pixels are precisely determined by reducing the pixels in the differential columns or the differential rows to the color before the graying process and comparing the pixels one by one. Wherein the reduction to the color before the graying process includes: and replacing the pixel points before the graying treatment with the pixel points after the ash graying treatment. The pixel point process of comparing the reduction columns or the reduction rows in the two gray level pictures comprises the following steps: extracting three primary colors of pixel points of a reduction column or a reduction row in a first gray level picture, comparing the three primary colors with three primary colors of pixel points of a reduction column or a reduction row in a second gray level picture, which correspond to the pixel points of the reduction column or the reduction row in the first gray level picture, and judging as difference pixel points if the three primary colors are not uniform in comparison result. The special mark may be any mark, for example, the difference pixel point is circled in the picture.
According to the picture difference judging method, two gray pictures are obtained by carrying out gray treatment on the two pictures, and the overall variance of the mth column or the mth row of the gray pictures is calculatedObtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>If->And if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different, thereby reducing the picture identification and judgment time on the basis of ensuring the picture difference judgment accuracy.
Referring to fig. 2, an embodiment of the present application provides a device for determining a difference between pictures, including:
a picture acquisition unit 10 for acquiring two pictures to be identified;
a gray level picture obtaining unit 20, configured to perform gray level processing on the two pictures to obtain two gray level pictures;
a gray average value calculating unit 30, configured to calculate an average value Am of gray values of all pixels in an mth column or an mth row of the gray picture, and calculate an average value B of gray values of all pixels in the gray picture;
the overall variance calculating unit 40 is configured to calculate the overall variance according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture;
A difference calculation unit 50 for calculating the difference between the overall variances according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture;
a variance error threshold judging unit 60 for judgingWhether the variance error threshold is smaller than a preset variance error threshold;
a non-difference judging unit 70 for ifAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
As described in the above unit 10, two pictures to be identified are acquired. The two pictures to be identified may be two unknown pictures, or may be a pre-stored reference picture and an unknown picture (used for judging the difference between other pictures and the reference picture). Wherein the parameters of the two pictures are preferably the same, e.g. the preferred resolution is the same.
The two pictures are subjected to graying processing as described in the above unit 20, and two gray-scale pictures are obtained. Here, graying means that a color is expressed as one gray color, for example, in an RGB model, if r=g=b, the color is expressed as one gray color, wherein the value of r=g=b is called a gray value, and thus, only one byte is required for each pixel of a gray image to store the gray value (also called an intensity value, a brightness value), thereby reducing the storage amount. The gray scale range is, for example, 0-255 (when the values of R, G, and B are all 0-255, they will also change with the change of the value ranges of R, G, and B. The method for applying the gradation processing may be any method, for example, a component method, a maximum value method, an average value method, a weighted average method, or the like. The number of the gray values is 256, and the calculation amount can be greatly reduced by comparing the images on the basis.
As described in the above unit 30, the average value Am of the gradation values of all the pixel points in the m-th column or m-th row of the gradation picture is calculated, and the average value B of the gradation values of all the pixel points in the gradation picture is calculated. The process of calculating the average value Am of the gray values of all the pixel points of the mth column or the mth row of the gray picture comprises the following steps: and collecting the gray values of all the pixel points in the m-th column or m-th row of the gray picture, adding the gray values of all the pixel points in the m-th column or m-th row, dividing the sum of the gray values obtained by adding the gray values by the number of all the pixel points in the m-th column or m-th row of the gray picture, and obtaining the average value Am of the gray values of all the pixel points in the m-th column or m-th row of the gray picture. The process of calculating the average value B of the gray values of all the pixel points in the gray picture comprises the following steps: and calculating the sum of the gray values of all the pixel points in the gray image, and dividing the sum of the gray values by the number of the pixel points to obtain an average value B of the gray values of all the pixel points in the gray image.
As described in the above-described unit 40, according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture >Where N is the total number of columns or rows in the grayscale picture. In the application, the total variance is used for measuring the gray value of the pixel point of the m-th column or m-th row of the gray pictureThe difference between the average value Am and the average value B of the gray values of all pixel points in the gray picture.
As described in the above unit 50, according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>Is the overall variance of the mth column or the mth row of the second gray picture. Difference of overall variance->The difference of the gray values of the m-th column or m-th row of the two gray pictures is reflected. When->Smaller, for example 0, indicates +.>Equal to or approximately equal to->The gray value of the m-th column or m-th row of the first gray scale picture can be regarded as the same or approximately the same as the gray value of the m-th column or m-th row of the second gray scale picture (approximate judgment is performed to save calculation power, and the overall variances of the two different pictures are generally not equal, so that the judgment accuracy is high), otherwise, the gray value of the m-th column or m-th row of the first gray scale picture is regarded as different from the gray value of the m-th column or m-th row of the second gray scale picture.
Determination as described in element 60 aboveWhether less than a preset variance error threshold. Wherein->The return value of (2) is +.>Maximum value of (1)Less than a preset variance error threshold, indicating all +.>The gray values of all columns or all rows of the first gray level picture are the same or approximately the same as the gray values of all columns or all rows of the second gray level picture, i.e. the gray values of all pixels of the first gray level picture are the same as the gray values of the second gray level picture.
As described in the above unit 70, ifAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different. As mentioned above, if->Less than a preset variance error threshold, indicating all +.>All are smaller than the preset variance error threshold, and the gray values of all columns or rows of the first gray picture can be regarded as the same or nearly the same as the gray values of all columns or rows of the second gray picture, i.e. the gray values of all pixels of the first gray picture are the same as the gray values of the second gray picture, therebyAnd the two pictures are judged to be not different (approximate judgment, because all gray values of gray pictures converted by two different pictures are generally not equal and all gray values of gray pictures converted by the same picture are generally equal, the accuracy of the judgment is ensured).
In one embodiment, the gray-scale image acquisition unit 20 includes:
the pixel point total number calculation operator unit is used for acquiring the resolution, the picture length and the picture width of the two pictures and according to the formula: the total number of pixel points = resolution x picture length + resolution x picture width, and the total number of pixel points of the two pictures is calculated respectively;
the pixel point total number judging subunit is used for judging whether the total number of the pixel points of the two pictures is the same or not;
and the gray level picture obtaining first subunit is used for carrying out gray level processing on the two pictures to obtain the two gray level pictures if the total number of the pixel points of the two pictures is the same.
As described above, the two pictures are subjected to the graying processing on the premise that the total number of the pixels of the two pictures is the same, and two gray pictures are obtained. In general, it is difficult to determine that two pictures are identical, but it is simpler to determine that two pictures are different. When the total pixel point numbers of the two pictures are different, the two pictures are judged to be different. Accordingly, the total number of pixels of the picture is calculated. The total number of pixels is directly related to the resolution of the picture, the length of the picture and the width of the picture, and the formula is as follows: the total number of pixels=resolution×picture length+resolution×picture width, and the total number of pixels of the two pictures can be calculated respectively. And after the total number of the pixel points of the two pictures is the same, carrying out graying treatment on the two pictures to obtain two gray pictures. Where resolution is a parameter that measures how much data is in an image, typically expressed as pixels per inch (ppi) and dots per inch (dpi).
In one embodiment, the gray scale picture obtaining first subunit includes:
the file size judging module is used for acquiring the file sizes of the two pictures if the total number of the pixel points of the two pictures is the same, and judging whether the difference of the file sizes of the two pictures is smaller than a preset file size threshold value or not;
the picture intercepting acquisition module is used for intercepting pixel points of a designated column or a designated row of the two pictures respectively to form two intercepted pictures if the difference of file sizes of the two pictures is not smaller than a preset file size threshold value;
and the gray level picture acquisition module is used for carrying out gray level treatment on the two intercepted pictures to obtain two gray level pictures.
As described above, it is achieved to reduce the amount of computation by taking pictures. When the file size of the picture is too large, the comparison of the pictures consumes excessive calculation amount. According to the embodiment, the pixel points of the designated columns or the designated rows are intercepted to form two intercepted pictures, and the file size is reduced to reduce the calculated amount on the premise that the information of the intercepted pictures is not lost. Wherein the designated column or row may be any column or row, for example, a continuous column or continuous row, preferably including a designated column or row 1. Further, the truncated picture is composed of a specified column or a specified row selected in an arithmetic sequence or an arithmetic sequence.
In one embodiment, the gray-scale image acquisition unit 20 includes:
the color depth digit acquisition subunit is used for respectively acquiring the appointed number of pixel points of the two pictures by utilizing a preset acquisition rule, and analyzing the color value range of the appointed number of pixel points to respectively acquire the color depth digits of the two pictures;
a color depth threshold value judging subunit, configured to judge whether the number of bits of the color depth of the two pictures is smaller than a preset color depth threshold value;
and the gray level picture obtaining second subunit is used for carrying out graying treatment on the two pictures to obtain two gray level pictures if the bit numbers of the color depths of the two pictures are smaller than the preset color depth threshold value.
As described above, the color requirement of the picture is judged by the number of bits of the color depth, and the picture is subjected to the graying processing under the condition of lower color requirement. The color depth represents the number of bits used to store a 1-pixel color (e.g., any one of the three primary colors RGB), also referred to as bits/pixel (bpp), in a bitmap or video frame buffer. The higher the color depth, the more colors are available, if the color depth is n bits, i.e., there are n color choices to the power of 2, and the number of bits used per pixel is stored as n. That is, the larger the number of bits n of the color depth is, the higher the requirement of the picture on the color is, and therefore, the gradation processing should not be performed (the higher the requirement of the color is, the more information is lost in the gradation processing, and erroneous judgment is likely to occur). The preset acquisition rules comprise random acquisition, acquisition according to an arithmetic series and other arbitrary feasible modes. The color value range of the pixel points refers to the number of optional colors (n times of 2, namely color depth) of the pixel points, and the color value range can be obtained by confirming the specific numerical value of the collected pixel points. Specifically, the process of analyzing the color value range of the specified number of pixels to obtain the number of bits of the color depth of the picture includes: obtaining the maximum values of the three primary colors of the specified number of pixel points; taking the maximum value +1 in the maximum value of each of the three primary colors (because the color value is initially 0) as the maximum value of the color value range of the pixel point; according to the formula: 2 × the maximum value of the range of color values, obtaining the minimum value of n, and taking the minimum value of n as the number of bits of the color depth of the picture. Further, if the number of bits of the color depth of the two pictures is not less than the preset color depth threshold, the picture difference judging means in other embodiments is still used to perform the picture difference judgment, where the gray value is replaced by the tri-primary value (although the calculated amount is increased by about two times, the accuracy of the difference judgment can be ensured).
In one embodiment, the gray average value calculating unit 30 includes:
the gray value acquisition subunit is used for acquiring gray values of all pixel points in the gray picture;
the average value Am acquisition subunit is configured to perform addition processing on the gray values of all the pixels in the mth column or the mth row of the gray image to obtain an mth column or an mth row addition value, and divide the mth column or the mth row addition value by the number of all the pixels in the mth column or the mth row to obtain an average value Am of the gray values of all the pixels in the mth column or the mth row of the gray image;
and the average value B acquisition subunit is used for carrying out addition processing on the gray values of all the pixel points in the gray level picture to obtain an addition value of the gray level picture, and dividing the addition value of the gray level picture by the total number of all the pixel points in the gray level picture to obtain an average value B of the gray level values of all the pixel points in the gray level picture.
As described above, it is achieved that the calculation of the average value Am of the gradation values of all the pixel points in the m-th column or m-th row of the gradation picture and the calculation of the average value B of the gradation values of all the pixel points in the gradation picture are performed using arithmetic average values. The average value B of the gray values of all the pixel points in the gray image is the average value of the gray values of the pixel points in the column or all the rows in the gray image. The gray values of all the pixel points in the gray picture are collected, and then the addition and division processing is carried out, so that the average value Am of the gray values of all the pixel points in the mth column or the mth row of the gray picture and the average value B of the gray values of all the pixel points in the gray picture are respectively calculated.
In one embodiment, the apparatus comprises:
a difference judging unit for ifIf the difference is not smaller than the preset variance error threshold, judging that the two pictures are different;
a marking unit for acquiringNot less than a pre-setAnd marking the column or row corresponding to the value not smaller than the preset variance error threshold as a difference column or a difference row.
As described above, it is achieved that the pictures are judged to be different and the difference columns or the difference rows are marked. Where the overall variance reflects the difference between the average value (i.e., variable) of each column or row and the average value (overall mean) of the gray picture. If the two pictures are identical, the overall variance should be equal or approximately equal. Accordingly, ifAnd if the difference is not smaller than the preset variance error threshold, judging that the two pictures are different. After determining that the two pictures are different, by determiningAnd obtaining the difference column or the difference row by a value which is not smaller than a preset variance error threshold value. Specifically, if->The mth column or the mth row is the difference column or the difference row, i.e. the subscript of the value not smaller than the preset variance error threshold value, represents the difference column or the difference row.
In one embodiment, the apparatus comprises:
a restoring column or restoring line obtaining unit, configured to restore the pixel points of the difference column or the difference line to a color before the graying process, to obtain a restoring column or a restoring line;
and the special marking unit is used for comparing the pixel points of the reduction columns or the reduction rows in the two gray level pictures one by one to obtain difference pixel points and carrying out special marking on the difference pixel points.
As described above, it is achieved that the difference pixel points are specifically marked. From the known difference columns or rows, it is not clear which pixels differ. In this embodiment, the positions of the differential pixels are precisely determined by reducing the pixels in the differential columns or the differential rows to the color before the graying process and comparing the pixels one by one. Wherein the reduction to the color before the graying process includes: and replacing the pixel points before the graying treatment with the pixel points after the ash graying treatment. The pixel point process of comparing the reduction columns or the reduction rows in the two gray level pictures comprises the following steps: extracting three primary colors of pixel points of a reduction column or a reduction row in a first gray level picture, comparing the three primary colors with three primary colors of pixel points of a reduction column or a reduction row in a second gray level picture, which correspond to the pixel points of the reduction column or the reduction row in the first gray level picture, and judging as difference pixel points if the three primary colors are not uniform in comparison result. The special mark may be any mark, for example, the difference pixel point is circled in the picture.
According to the picture difference judging device, two gray pictures are obtained by carrying out gray processing on the two pictures, and the overall variance of the mth column or the mth row of the gray pictures is calculatedObtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>If->And if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different, thereby reducing the picture identification and judgment time on the basis of ensuring the picture difference judgment accuracy.
Referring to fig. 3, in an embodiment of the present application, there is further provided a computer device, which may be a server, and the internal structure of which may be as shown in the drawing. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data used by the picture difference judging method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method for determining picture variability.
The processor executes the picture difference judging method, and the method comprises the following steps: acquiring two pictures to be identified; carrying out graying treatment on the two pictures to obtain two gray pictures; calculating an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculating an average value B of gray values of all pixel points in the gray picture; according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture; according to the formula:>obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture; judging->Whether the variance error threshold is smaller than a preset variance error threshold; if it isAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
In one embodiment, the step of graying the two pictures to obtain two gray-scale pictures includes: the resolution, the picture length and the picture width of the two pictures are obtained, and according to the formula: the total number of pixel points = resolution x picture length + resolution x picture width, and the total number of pixel points of the two pictures is calculated respectively; judging whether the total number of the pixel points of the two pictures is the same or not; and if the total number of the pixel points of the two pictures is the same, carrying out graying treatment on the two pictures to obtain two gray pictures.
In one embodiment, if the total number of pixels of the two pictures is the same, performing grayscale processing on the two pictures to obtain two grayscale pictures, including: if the total number of the pixel points of the two pictures is the same, acquiring the file sizes of the two pictures, and judging whether the difference of the file sizes of the two pictures is smaller than a preset file size threshold value or not; if the difference of the file sizes of the two pictures is not smaller than a preset file size threshold, respectively intercepting pixel points of a designated column or row of the two pictures to form two intercepted pictures; and carrying out graying treatment on the two intercepted pictures to obtain two gray pictures.
In one embodiment, the step of graying the two pictures to obtain two gray-scale pictures includes: respectively acquiring the appointed number of pixel points of the two pictures by using a preset acquisition rule, and analyzing the color value range of the appointed number of pixel points to respectively obtain the number of bits of the color depth of the two pictures; judging whether the bit numbers of the color depth of the two pictures are smaller than a preset color depth threshold value or not; and if the bit numbers of the color depths of the two pictures are smaller than the preset color depth threshold value, carrying out graying treatment on the two pictures to obtain two gray pictures.
In one embodiment, the step of calculating the average value Am of the gray values of all the pixels in the m-th column or m-th row of the gray picture, and calculating the average value B of the gray values of all the pixels in the gray picture includes: collecting gray values of all pixel points in the gray picture; adding the gray values of all the pixel points in the mth column or the mth row of the gray picture to obtain an mth column or an mth row added value, dividing the mth column or the mth row added value by the number of all the pixel points in the mth column or the mth row to obtain an average value Am of the gray values of all the pixel points in the mth column or the mth row of the gray picture; and adding the gray values of all the pixel points in the gray picture to obtain an added value of the gray picture, and dividing the added value of the gray picture by the total number of all the pixel points in the gray picture to obtain an average value B of the gray values of all the pixel points in the gray picture.
In one embodiment, the determiningAfter the step of determining whether the variance error threshold is smaller than the preset variance error threshold, the method comprises the following steps: if->If the difference is not smaller than the preset variance error threshold, judging that the two pictures are different; acquisition- >And marking the column or row corresponding to the value not smaller than the preset variance error threshold as a difference column or a difference row.
In one embodiment, the acquiringAfter the step of marking the column or row corresponding to the value not smaller than the preset variance error threshold as the difference column or the difference row, the method comprises the following steps: restoring the pixel points of the difference columns or the difference rows to the color before the graying treatment to obtain restoring columns or restoring rows; and comparing pixel points of the reduction columns or the reduction rows in the two gray level pictures one by one to obtain difference pixel points, and carrying out special marking on the difference pixel points.
It will be appreciated by persons skilled in the art that the structures shown in the drawings are only block diagrams of portions of structures that may be associated with the aspects of the application and are not intended to limit the scope of the computer apparatus to which the aspects of the application may be applied.
The computer equipment of the application obtains two gray pictures by carrying out gray processing on the two pictures, and calculates the overall variance of the mth column or the mth row of the gray pictures Obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>If->And if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different, thereby reducing the picture identification and judgment time on the basis of ensuring the picture difference judgment accuracy.
An embodiment of the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for judging picture variability, including the steps of: acquiring two pictures to be identified; carrying out graying treatment on the two pictures to obtain two gray pictures; calculating the mth column or the mth row of the gray scale pictureAn average value Am of gray values of all pixel points in the gray picture, and an average value B of gray values of all pixel points in the gray picture; according to the formula:calculating the overall variance of the mth column or the mth row of the gray pictureWhere N is the total number of columns or rows in the grayscale picture; according to the formula:>obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +. >The overall variance of the mth column or the mth row of the second gray scale picture; judging->Whether the variance error threshold is smaller than a preset variance error threshold; if->And if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
In one embodiment, the step of graying the two pictures to obtain two gray-scale pictures includes: the resolution, the picture length and the picture width of the two pictures are obtained, and according to the formula: the total number of pixel points = resolution x picture length + resolution x picture width, and the total number of pixel points of the two pictures is calculated respectively; judging whether the total number of the pixel points of the two pictures is the same or not; and if the total number of the pixel points of the two pictures is the same, carrying out graying treatment on the two pictures to obtain two gray pictures.
In one embodiment, if the total number of pixels of the two pictures is the same, performing grayscale processing on the two pictures to obtain two grayscale pictures, including: if the total number of the pixel points of the two pictures is the same, acquiring the file sizes of the two pictures, and judging whether the difference of the file sizes of the two pictures is smaller than a preset file size threshold value or not; if the difference of the file sizes of the two pictures is not smaller than a preset file size threshold, respectively intercepting pixel points of a designated column or row of the two pictures to form two intercepted pictures; and carrying out graying treatment on the two intercepted pictures to obtain two gray pictures.
In one embodiment, the step of graying the two pictures to obtain two gray-scale pictures includes: respectively acquiring the appointed number of pixel points of the two pictures by using a preset acquisition rule, and analyzing the color value range of the appointed number of pixel points to respectively obtain the number of bits of the color depth of the two pictures; judging whether the bit numbers of the color depth of the two pictures are smaller than a preset color depth threshold value or not; and if the bit numbers of the color depths of the two pictures are smaller than the preset color depth threshold value, carrying out graying treatment on the two pictures to obtain two gray pictures.
In one embodiment, the step of calculating the average value Am of the gray values of all the pixels in the m-th column or m-th row of the gray picture, and calculating the average value B of the gray values of all the pixels in the gray picture includes: collecting gray values of all pixel points in the gray picture; adding the gray values of all the pixel points in the mth column or the mth row of the gray picture to obtain an mth column or an mth row added value, dividing the mth column or the mth row added value by the number of all the pixel points in the mth column or the mth row to obtain an average value Am of the gray values of all the pixel points in the mth column or the mth row of the gray picture; and adding the gray values of all the pixel points in the gray picture to obtain an added value of the gray picture, and dividing the added value of the gray picture by the total number of all the pixel points in the gray picture to obtain an average value B of the gray values of all the pixel points in the gray picture.
In one embodiment, the determiningAfter the step of determining whether the variance error threshold is smaller than the preset variance error threshold, the method comprises the following steps: if->If the difference is not smaller than the preset variance error threshold, judging that the two pictures are different; acquisition->And marking the column or row corresponding to the value not smaller than the preset variance error threshold as a difference column or a difference row.
In one embodiment, the acquiringAfter the step of marking the column or row corresponding to the value not smaller than the preset variance error threshold as the difference column or the difference row, the method comprises the following steps: restoring the pixel points of the difference columns or the difference rows to the color before the graying treatment to obtain restoring columns or restoring rows; and comparing pixel points of the reduction columns or the reduction rows in the two gray level pictures one by one to obtain difference pixel points, and carrying out special marking on the difference pixel points.
The computer readable storage medium of the present application obtains two gray pictures by graying the two pictures, calculates the overall variance of the mth column or the mth row of the gray pictures Obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>If->And if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different, thereby reducing the picture identification and judgment time on the basis of ensuring the picture difference judgment accuracy.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present application and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the application.

Claims (10)

1. The picture difference judging method is characterized by comprising the following steps:
acquiring two pictures to be identified;
carrying out graying treatment on the two pictures to obtain two gray pictures;
Calculating an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculating an average value B of gray values of all pixel points in the gray picture;
according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture;
according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein the method comprises the steps of,/>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture;
judgingWhether the variance error threshold is smaller than a preset variance error threshold;
if it isAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
2. The method for judging the difference between pictures according to claim 1, wherein the step of graying the two pictures to obtain two gray pictures comprises:
the resolution, the picture length and the picture width of the two pictures are obtained, and according to the formula: the total number of pixel points = resolution x picture length + resolution x picture width, and the total number of pixel points of the two pictures is calculated respectively;
Judging whether the total number of the pixel points of the two pictures is the same or not;
and if the total number of the pixel points of the two pictures is the same, carrying out graying treatment on the two pictures to obtain two gray pictures.
3. The method for judging the picture variability according to claim 2, wherein the step of performing the graying process on the two pictures to obtain the two gray-scale pictures if the total number of pixels of the two pictures is the same, comprises:
if the total number of the pixel points of the two pictures is the same, acquiring the file sizes of the two pictures, and judging whether the difference of the file sizes of the two pictures is smaller than a preset file size threshold value or not;
if the difference of the file sizes of the two pictures is not smaller than a preset file size threshold, respectively intercepting pixel points of a designated column or row of the two pictures to form two intercepted pictures;
and carrying out graying treatment on the two intercepted pictures to obtain two gray pictures.
4. The method for judging the difference between pictures according to claim 1, wherein the step of graying the two pictures to obtain two gray pictures comprises:
Respectively acquiring the appointed number of pixel points of the two pictures by using a preset acquisition rule, and analyzing the color value range of the appointed number of pixel points to respectively obtain the number of bits of the color depth of the two pictures;
judging whether the bit numbers of the color depth of the two pictures are smaller than a preset color depth threshold value or not;
and if the bit numbers of the color depths of the two pictures are smaller than the preset color depth threshold value, carrying out graying treatment on the two pictures to obtain two gray pictures.
5. The picture difference judging method according to claim 1, wherein the step of calculating an average value Am of gray values of all pixels in an mth column or an mth row of the gray picture, and calculating an average value B of gray values of all pixels in the gray picture, comprises:
collecting gray values of all pixel points in the gray picture;
adding the gray values of all the pixel points in the mth column or the mth row of the gray picture to obtain an mth column or an mth row added value, dividing the mth column or the mth row added value by the number of all the pixel points in the mth column or the mth row to obtain an average value Am of the gray values of all the pixel points in the mth column or the mth row of the gray picture;
And adding the gray values of all the pixel points in the gray picture to obtain an added value of the gray picture, and dividing the added value of the gray picture by the total number of all the pixel points in the gray picture to obtain an average value B of the gray values of all the pixel points in the gray picture.
6. The picture difference judging method according to claim 1, wherein the judgment is performedAfter the step of determining whether the variance error threshold is smaller than the preset variance error threshold, the method comprises the following steps:
if it isIf the difference is not smaller than the preset variance error threshold, judging that the two pictures are different;
acquisition ofAnd marking the column or row corresponding to the value not smaller than the preset variance error threshold as a difference column or a difference row.
7. The picture variability determination method of claim 6, wherein said obtaining comprisesAfter the step of marking the column or row corresponding to the value not smaller than the preset variance error threshold as the difference column or the difference row, the method comprises the following steps:
restoring the pixel points of the difference columns or the difference rows to the color before the graying treatment to obtain restoring columns or restoring rows;
And comparing pixel points of the reduction columns or the reduction rows in the two gray level pictures one by one to obtain difference pixel points, and carrying out special marking on the difference pixel points.
8. A picture difference judging apparatus, characterized by comprising:
the picture acquisition unit is used for acquiring two pictures to be identified;
the gray level picture acquisition unit is used for carrying out gray level treatment on the two pictures to obtain two gray level pictures;
a gray average value calculating unit, configured to calculate an average value Am of gray values of all pixel points in an mth column or an mth row of the gray picture, and calculate an average value B of gray values of all pixel points in the gray picture;
a total variance calculating unit for calculating a total variance according to the formula:calculating the overall variance of the mth column or the mth row of the gray picture>Where N is the total number of columns or rows in the grayscale picture;
a difference calculation unit of the overall variance, for calculating the difference according to the formula:obtaining the difference of the overall variance of the mth column or the mth row of two said grey scale pictures +.>Wherein (1)>For the m-th column or m-th row of the first gray picture, total variance +.>The overall variance of the mth column or the mth row of the second gray scale picture;
Variance error threshold value judging unit for judgingWhether the variance error threshold is smaller than a preset variance error threshold;
no difference judging unit for ifAnd if the difference is smaller than the preset variance error threshold, judging that the two pictures are not different.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN201910101305.4A 2019-01-31 2019-01-31 Picture variability judging method, device, computer equipment and storage medium Active CN109934262B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910101305.4A CN109934262B (en) 2019-01-31 2019-01-31 Picture variability judging method, device, computer equipment and storage medium
PCT/CN2019/089058 WO2020155485A1 (en) 2019-01-31 2019-05-29 Image difference determination method and apparatus, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910101305.4A CN109934262B (en) 2019-01-31 2019-01-31 Picture variability judging method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109934262A CN109934262A (en) 2019-06-25
CN109934262B true CN109934262B (en) 2023-08-22

Family

ID=66985474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910101305.4A Active CN109934262B (en) 2019-01-31 2019-01-31 Picture variability judging method, device, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN109934262B (en)
WO (1) WO2020155485A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110619274A (en) * 2019-08-14 2019-12-27 深圳壹账通智能科技有限公司 Identity verification method and device based on seal and signature and computer equipment
CN111177430B (en) * 2019-12-16 2023-06-20 中国平安财产保险股份有限公司 Method, device, computer equipment and storage medium for storing comprehensive image
CN112539843B (en) * 2020-12-11 2023-06-02 平安科技(深圳)有限公司 Method and device for detecting temperature and computer equipment
CN112927277A (en) * 2021-02-05 2021-06-08 广东博智林机器人有限公司 Method, device and equipment for extracting laser stripe row central line and storage medium
CN117635610B (en) * 2024-01-25 2024-04-09 青岛正大正电力环保设备有限公司 Visual detection method for oil leakage of oil pipe of hydraulic tensioning mechanism

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007071586A (en) * 2005-09-05 2007-03-22 Tokyo Seimitsu Co Ltd Image defect inspection device, image defect inspection system, defect classification device, and image defect inspection method
CN101360184A (en) * 2008-09-22 2009-02-04 腾讯科技(深圳)有限公司 System and method for extracting key frame of video
CN106650829A (en) * 2017-01-04 2017-05-10 华南理工大学 Picture similarity calculation method
CN107679568A (en) * 2017-09-25 2018-02-09 曾传德 Comparison system based on pixel difference analysis

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012000191A1 (en) * 2010-06-30 2012-01-05 France Telecom Research & Development Beijing Company Limited Pixel interpolation method and system
CN102360503B (en) * 2011-10-09 2013-04-03 西安电子科技大学 SAR (Specific Absorption Rate) image change detection method based on space approach degree and pixel similarity
CN104217416B (en) * 2013-05-31 2017-09-15 富士通株式会社 Gray level image processing method and its device
CN105637852B (en) * 2014-08-29 2019-03-01 华为技术有限公司 A kind of image processing method, device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007071586A (en) * 2005-09-05 2007-03-22 Tokyo Seimitsu Co Ltd Image defect inspection device, image defect inspection system, defect classification device, and image defect inspection method
CN101360184A (en) * 2008-09-22 2009-02-04 腾讯科技(深圳)有限公司 System and method for extracting key frame of video
CN106650829A (en) * 2017-01-04 2017-05-10 华南理工大学 Picture similarity calculation method
CN107679568A (en) * 2017-09-25 2018-02-09 曾传德 Comparison system based on pixel difference analysis

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于最大方差阈值法的火车票图像二值化处理;吕行军等;计算机应用与软件;第29卷(第07期);第249-252页 *

Also Published As

Publication number Publication date
WO2020155485A1 (en) 2020-08-06
CN109934262A (en) 2019-06-25

Similar Documents

Publication Publication Date Title
CN109934262B (en) Picture variability judging method, device, computer equipment and storage medium
EP2806374A1 (en) Method and system for automatic selection of one or more image processing algorithm
CN112001406B (en) Text region detection method and device
CN106920245B (en) Boundary detection method and device
CN110334702B (en) Data transmission method and device based on configuration platform and computer equipment
CN110889457B (en) Sample image classification training method and device, computer equipment and storage medium
CN113673530B (en) Remote sensing image semantic segmentation method, device, computer equipment and storage medium
CN111507298B (en) Face detection method, device, computer equipment and storage medium
CN113160087B (en) Image enhancement method, device, computer equipment and storage medium
CN111814776B (en) Image processing method, device, server and storage medium
CN113034514A (en) Sky region segmentation method and device, computer equipment and storage medium
CN113538271A (en) Image display method, image display device, electronic equipment and computer readable storage medium
CN111091146B (en) Picture similarity obtaining method and device, computer equipment and storage medium
CN111539238A (en) Two-dimensional code image restoration method and device, computer equipment and storage medium
CN113222921A (en) Image processing method and system
CN109996063B (en) Video image screen splash detection method and device, computer equipment and storage medium
CN111753729A (en) False face detection method and device, electronic equipment and storage medium
CN110895849A (en) Method and device for cutting and positioning crown word number, computer equipment and storage medium
CN115760653A (en) Image correction method, device, equipment and readable storage medium
CN113160103B (en) Image processing method and device, storage medium and terminal
CN110910436B (en) Distance measuring method, device, equipment and medium based on image information enhancement technology
CN111199513B (en) Image processing method, computer device, and storage medium
CN114332016A (en) Equipment screen light spot detection method and device
CN111402121A (en) Image style conversion method and device, computer equipment and storage medium
CN112183563A (en) Image recognition model generation method, storage medium and application server

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