CN113781334A - Method, device, terminal and storage medium for comparing difference between images based on colors - Google Patents

Method, device, terminal and storage medium for comparing difference between images based on colors Download PDF

Info

Publication number
CN113781334A
CN113781334A CN202110998472.0A CN202110998472A CN113781334A CN 113781334 A CN113781334 A CN 113781334A CN 202110998472 A CN202110998472 A CN 202110998472A CN 113781334 A CN113781334 A CN 113781334A
Authority
CN
China
Prior art keywords
pixel
value
difference
channel
image
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.)
Withdrawn
Application number
CN202110998472.0A
Other languages
Chinese (zh)
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202110998472.0A priority Critical patent/CN113781334A/en
Publication of CN113781334A publication Critical patent/CN113781334A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • G06T5/94
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Processing (AREA)

Abstract

The technical scheme of the invention provides a color-based image difference comparison method, a device, a terminal and a storage medium, aiming at each pixel, pixel difference values of an R channel, a G channel and a B channel of two frames of images are respectively calculated; selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared; comparing whether the difference value to be compared is larger than a preset difference value threshold value or not; if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image; note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region. According to the invention, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are reserved, the region with obvious color change and large change range is used as the change region between the two frames of images, and the accuracy of image contrast is improved.

Description

Method, device, terminal and storage medium for comparing difference between images based on colors
Technical Field
The invention relates to the field of image difference comparison, in particular to a method, a device, a terminal and a storage medium for difference comparison among images of colors.
Background
In the image processing process, the difference between two frames of images at different times before and after the comparison is sometimes needed to analyze the change of the target in the image, for example, in the product defect detection, the produced product can be compared with the picture of the corresponding standard product, and whether the produced product is qualified or not can be quickly judged. At present, there is a mature algorithm with good effect, such as a frame difference method, and the basic principle is to subtract gray pixel values of two frames of images, and then compare the obtained difference value with a preset threshold, and a pixel with a large change is regarded as a change area of a target. Because the frame difference method calculates the difference value of the gray pixel values, the color image needs to be converted into the gray image, only the brightness information is reserved and the color information is lost in the conversion process, when the color changes between two frame images, a certain error is generated by the current algorithm, and the accuracy of the algorithm is reduced.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method, an apparatus, a terminal and a storage medium for comparing differences between images based on color, which perform pixel processing based on R, G, B color channels to improve the accuracy of image comparison.
In a first aspect, a technical solution of the present invention provides a color-based contrast method for difference between images, including the following steps:
respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
Further, before recording that a continuous region composed of pixels with a pixel value of T1 in the changed image is a changed region, the method further includes the following steps:
and carrying out filtering processing on the changed image.
Further, the filtering processing is performed on the changed image, specifically:
and filtering the changed image through a median filtering algorithm.
Further, if the difference to be compared is greater than the preset difference threshold, setting the pixel value of the pixel to be T1; otherwise, setting the pixel value of the pixel to T2, specifically:
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
In a second aspect, the present invention provides a color-based contrast device for difference between images, comprising,
a pixel difference value calculation module: respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
a to-be-compared difference selecting module: selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
a difference comparison module: comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
a pixel reset module: if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
a change area recording module: note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
Further, the device also comprises a control device,
a filtering module: and carrying out filtering processing on the changed image.
Further, the filtering module performs filtering processing on the change image through a median filtering algorithm.
Further, if the difference to be compared is greater than the preset difference threshold, the pixel resetting module sets the pixel value of the pixel to be T1; otherwise, setting the pixel value of the pixel to T2, specifically:
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
In a third aspect, a technical solution of the present invention provides a terminal, including:
a memory for storing a color-based inter-image difference contrast program;
a processor for implementing the steps of the color-based inter-image difference contrast method according to any one of the above-mentioned claims when executing the color-based inter-image difference contrast program.
In a fourth aspect, the present invention provides a computer readable storage medium storing a computer program, the readable storage medium storing a color-based inter-image difference contrast program, when executed by a processor, implementing the steps of the color-based inter-image difference contrast method according to any one of the above.
Compared with the prior art, the method, the device, the terminal and the storage medium for comparing the difference between the images based on the colors have the following beneficial effects: the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with a set threshold value, pixels with large changes are reserved, the area with obvious color changes and large change range is used as the change area between the two frames of images, the accuracy of image contrast is improved, and a good foundation is laid for analyzing the front and back changes of the target between the images.
Drawings
For a clearer explanation of the embodiments or technical solutions of the prior art of the present application, the drawings needed for the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a color-based contrast method for difference between images according to an embodiment of the present invention;
FIG. 2 is a schematic flowchart of a color-based contrast method for difference between images according to a second embodiment of the present invention;
FIG. 3 is a schematic block diagram of a color-based contrast device for difference between images according to a third embodiment of the present invention;
FIG. 4 is a schematic block diagram of a device for comparing differences between images based on colors according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all 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 application.
In the image processing process, the difference between two frames of images at different times before and after the comparison is sometimes needed to analyze the change of the target in the image, for example, in the product defect detection, the produced product can be compared with the picture of the corresponding standard product, and whether the produced product is qualified or not can be quickly judged. At present, there is a mature algorithm with good effect, such as a frame difference method, and the basic principle is to subtract gray pixel values of two frames of images, and then compare the obtained difference value with a preset threshold, and a pixel with a large change is regarded as a change area of a target. Because the frame difference method calculates the difference value of the gray pixel values, the color image needs to be converted into the gray image, only the brightness information is reserved and the color information is lost in the conversion process, when the color changes between two frame images, a certain error is generated by the current algorithm, and the accuracy of the algorithm is reduced.
Therefore, the invention provides a color-based image difference contrast scheme, which carries out pixel processing based on R, G, B color channels and improves the accuracy of image contrast.
Example one
Fig. 1 is a schematic flow chart of a color-based contrast method between images according to a first embodiment of the present invention, which includes the following steps.
S101, respectively calculating pixel difference values of an R channel, a G channel and a B channel of two frames of images aiming at each pixel;
s102, selecting the maximum value in the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
s103, comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
s104, if the difference value to be compared is larger than a preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
s105, recording a continuous area formed by pixels with the pixel value of T1 in the change image as a change area.
Wherein R is red, G is green, and B is blue.
Note that the two compared frame images are images of the same size. In specific implementation, the pixel value of each pixel in the change image is obtained through the following formula:
Figure BDA0003234655560000051
wherein i represents the abscissa of the point, and takes a value from 1 to W; w is the width of the image;
j represents the vertical coordinate of the point, and the value is from 1 to H; h is the height of the image;
r1(i, j) is the R channel pixel value for the point at first frame image coordinate (i, j);
r2(i, j) is the R channel pixel value for the point at second frame image coordinate (i, j);
g1(i, j) is the G channel pixel value of the point at the first frame image coordinate (i, j);
g2(i, j) is the G channel pixel value for the point at second frame image coordinate (i, j);
b1(i, j) is the B channel pixel value for the point at the first frame image coordinate (i, j);
b2(i, j) is the B channel pixel value for the point at second frame image coordinate (i, j);
| represents taking an absolute value;
max represents taking the maximum value;
t is a preset difference threshold value.
Specifically, the change matrix R (i, j) is calculated by the following steps.
Step one, calculating the difference values delta R, delta G and delta B of pixels at two frames of images (i, j) with the same size.
ΔR=|R1(i,j)-R2(i,j)|
ΔG=|G1(i,j)-G2(i,j)|
ΔB=|B1(i,j)-B2(i,j)|
And step two, comparing the difference values delta R, delta G and delta B calculated by the three channels, and selecting a maximum value D.
D=Max(ΔR,ΔG,ΔB)
And step three, comparing the selected pixel difference maximum value D with a preset difference threshold value T, removing the pixels of which the pixel difference maximum value D is smaller than the preset difference threshold value T, and reserving the pixels of which the pixel difference maximum value D is larger than the preset difference threshold value T to obtain a result R (i, j).
Figure BDA0003234655560000061
For convenience of processing, in the implementation, T1 is 255 (pure white), T2 is 0 (pure black), that is, if the difference to be compared is greater than the preset difference threshold in step S104, the pixel value of the pixel is set to T1; otherwise, setting the pixel value of the pixel to T2, specifically:
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
In the color-based image difference comparison method provided by the embodiment, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are reserved, the area with obvious color change and large change range is used as the change area between the two frames of images, the image comparison accuracy is improved, and a good foundation is laid for analyzing the front and back change of the target between the images.
Example two
In order to eliminate the noise effect and remove the pixels with obvious changes but isolated, the method for comparing the difference between the images based on the colors provided by the second embodiment further performs filtering processing on the obtained changed images, thereby improving the accuracy of the difference comparison between the images.
Fig. 2 is a schematic flow chart of a color-based contrast method between images according to the second embodiment, which includes the following steps.
S201, respectively calculating pixel difference values of an R channel, a G channel and a B channel of two frames of images aiming at each pixel;
s202, selecting the maximum value in the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
s203, comparing whether the difference value to be compared is larger than a preset difference value threshold value;
s204, if the difference value to be compared is larger than a preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
s205, filtering the changed image
S206, a continuous region composed of pixels with a pixel value of T1 in the changed image is regarded as a changed region.
In step S205, the filtering process for the changed image may specifically adopt a median filtering algorithm, that is, the filtering process is performed on the changed image by using the median filtering algorithm.
In the method for comparing difference between images based on color provided in the second embodiment, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are retained, the pixels with small change are removed, the retained isolated pixels are removed through median filtering, the region with obvious color change and large change range is used as the change region between the two frames of images, the accuracy of image comparison is improved, and a good foundation is laid for analyzing the front and back change of the target between the images.
In a specific embodiment, a color-based contrast method between images is implemented by the following steps.
Step one, calculating the difference values delta R, delta G and delta B of pixels at two frames of images (i, j) with the same size.
ΔR=|R1(i,j)-R2(i,j)|
ΔG=|G1(i,j)-G2(i,j)|
ΔB=|B1(i,j)-B2(i,j)|
Wherein i represents the abscissa of the point, and takes a value from 1 to W; w is the width of the image;
j represents the vertical coordinate of the point, and the value is from 1 to H; h is the height of the image;
r1(i, j) is the R channel pixel value for the point at first frame image coordinate (i, j);
r2(i, j) is the R channel pixel value for the point at second frame image coordinate (i, j);
g1(i, j) is the G channel pixel value of the point at the first frame image coordinate (i, j);
g2(i, j) is the G channel pixel value for the point at second frame image coordinate (i, j);
b1(i, j) is the B channel pixel value for the point at the first frame image coordinate (i, j);
b2(i, j) is the B channel pixel value for the point at second frame image coordinate (i, j);
| represents taking an absolute value;
t is a preset difference threshold value.
And step two, comparing the difference values delta R, delta G and delta B calculated by the three channels, and selecting a maximum value D.
D=Max(ΔR,ΔG,ΔB)
Where Max represents taking the maximum value.
And step three, comparing the selected pixel difference maximum value D with a preset difference threshold value T, removing the pixels of which the pixel difference maximum value D is smaller than the preset difference threshold value T, and reserving the pixels of which the pixel difference maximum value D is larger than the preset difference threshold value T to obtain a result R (i, j).
Figure BDA0003234655560000091
And step four, performing median filtering processing on the change image formed by the results R (i, j).
And step five, recording a continuous area formed by the pixels with the pixel value of 255 in the change image as a change area.
EXAMPLE III
The present embodiment provides a color-based contrast device for difference between images, which implements the color-based contrast method between images of the above embodiments.
Fig. 3 is a schematic block diagram of a structure of a color-based contrast device for difference between images according to a third embodiment, which includes the following functional modules.
A pixel difference value calculation module: respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
a to-be-compared difference selecting module: selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
a difference comparison module: comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
a pixel reset module: if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
a change area recording module: note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
In specific implementation, the pixel value of each pixel in the change image is obtained through the following formula:
Figure BDA0003234655560000101
wherein i represents the abscissa of the point, and takes a value from 1 to W; w is the width of the image;
j represents the vertical coordinate of the point, and the value is from 1 to H; h is the height of the image;
r1(i, j) is the R channel pixel value for the point at first frame image coordinate (i, j);
r2(i, j) is the R channel pixel value for the point at second frame image coordinate (i, j);
g1(i, j) is the G channel pixel value of the point at the first frame image coordinate (i, j);
g2(i, j) is the G channel pixel value for the point at second frame image coordinate (i, j);
b1(i, j) is the B channel pixel value for the point at the first frame image coordinate (i, j);
b2(i, j) is the B channel pixel value for the point at second frame image coordinate (i, j);
| represents taking an absolute value;
max represents taking the maximum value;
t is a preset difference threshold value.
Specifically, each functional module obtains a change matrix R (i, j) by performing calculation by the following formula.
The pixel difference value calculating module calculates the difference value delta R, delta G and delta B of the pixels at the two frames of images (i, j) with the same size.
ΔR=|R1(i,j)-R2(i,j)|
ΔG=|G1(i,j)-G2(i,j)|
ΔB=|B1(i,j)-B2(i,j)|
The difference value selecting module to be compared and the difference value comparing module compare the difference values delta R, delta G and delta B calculated by the three channels and select the maximum value D.
D=Max(ΔR,ΔG,ΔB)
The pixel resetting module compares the selected pixel difference maximum value D with a preset difference threshold value T, removes the pixels of which the pixel difference maximum value D is smaller than the preset difference threshold value T, and reserves the pixels of which the pixel difference maximum value D is larger than the preset difference threshold value T to obtain a result R (i, j).
Figure BDA0003234655560000111
For convenience of processing, in the implementation, T1 is 255 (pure white), T2 is 0 (pure black), that is, if the difference to be compared by the pixel reset module is greater than the preset difference threshold, the pixel value of the pixel is set to T1; otherwise, setting the pixel value of the pixel to T2, specifically:
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
In the color-based image difference comparison device provided by the third embodiment, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are reserved, the area with obvious color change and large change range is used as the change area between the two frames of images, the image comparison accuracy is improved, and a good foundation is laid for analyzing the front and back change of the target between the images.
Example four
In order to eliminate the noise effect and remove the pixels with obvious changes but isolated, the color-based inter-image difference comparison apparatus provided in the fourth embodiment further performs filtering processing on the obtained changed images, thereby improving the accuracy of inter-image difference comparison.
Fig. 4 is a schematic block diagram of a structure of a color-based contrast device for difference between images according to a fourth embodiment of the present invention, which includes the following functional blocks.
A pixel difference value calculation module: respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
a to-be-compared difference selecting module: selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
a difference comparison module: comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
a pixel reset module: if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
a filtering module: and carrying out filtering processing on the changed image.
A change area recording module: note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
The filtering module may specifically adopt a median filtering algorithm to filter the changing image, that is, the median filtering algorithm is used to filter the changing image.
In the color-based image difference comparison device provided by the fourth embodiment, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are retained, the pixels with small change are removed, the retained isolated pixels are removed through median filtering, the region with obvious color change and large change range is used as the change region between the two frames of images, the image comparison accuracy is improved, and a good foundation is laid for analyzing the front and back changes of the target between the images.
In a specific embodiment, each functional module implements a color-based contrast method for differences between images by the following formula.
The pixel difference value calculating module calculates the difference value delta R, delta G and delta B of the pixels at the two frames of images (i, j) with the same size.
ΔR=|R1(i,j)-R2(i,j)|
ΔG=|G1(i,j)-G2(i,j)|
ΔB=|B1(i,j)-B2(i,j)|
Wherein i represents the abscissa of the point, and takes a value from 1 to W; w is the width of the image;
j represents the vertical coordinate of the point, and the value is from 1 to H; h is the height of the image;
r1(i, j) is the R channel pixel value for the point at first frame image coordinate (i, j);
r2(i, j) is the R channel pixel value for the point at second frame image coordinate (i, j);
g1(i, j) is the G channel pixel value of the point at the first frame image coordinate (i, j);
g2(i, j) is the G channel pixel value for the point at second frame image coordinate (i, j);
b1(i, j) is the B channel pixel value for the point at the first frame image coordinate (i, j);
b2(i, j) is the B channel pixel value for the point at second frame image coordinate (i, j);
| represents taking an absolute value;
t is a preset difference threshold value.
The difference value selecting module to be compared and the difference value comparing module compare the difference values delta R, delta G and delta B calculated by the three channels and select the maximum value D.
D=Max(ΔR,ΔG,ΔB)
Where Max represents taking the maximum value.
The pixel resetting module compares the selected pixel difference maximum value D with a preset difference threshold value T, removes the pixels of which the pixel difference maximum value D is smaller than the preset difference threshold value T, and reserves the pixels of which the pixel difference maximum value D is larger than the preset difference threshold value T to obtain a result R (i, j).
Figure BDA0003234655560000131
The filtering module performs median filtering processing on the change image composed of the results R (i, j).
The change area recording module records a continuous area formed by pixels with the pixel value of 255 in the change image as a change area.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a terminal device 500 according to an embodiment of the present invention, including: a processor 510, a memory 520, and a communication unit 530. The processor 510 is configured to implement the color-based inter-image contrast program stored in the memory 520 to implement the following steps:
respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
According to the invention, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are reserved, the region with obvious color change and large change range is used as the change region between the two frames of images, the accuracy of image contrast is improved, and a good foundation is laid for analyzing the front and back change of the target between the images.
In some embodiments, when the processor 510 executes the sub-program of the color-based image difference comparison method stored in the memory 520, the following steps may be specifically implemented: and carrying out filtering processing on the changed image.
In some embodiments, when the processor 510 executes the sub-program of the color-based image difference comparison method stored in the memory 520, the following steps may be specifically implemented: and filtering the changed image through a median filtering algorithm.
In some embodiments, when the processor 510 executes the sub-program of the color-based image difference comparison method stored in the memory 520, the following steps may be specifically implemented: if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
Among them, the terminal apparatus 500 may include: a processor 510, a memory 520, and a communication unit 530. The components communicate via one or more buses, and those skilled in the art will appreciate that the architecture of the servers shown in the figures is not intended to be limiting, and may be a bus architecture, a star architecture, a combination of more or less components than those shown, or a different arrangement of components.
The memory 520 may be used for storing instructions executed by the processor 510, and the memory 520 may be implemented by any type of volatile or non-volatile storage terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The executable instructions in memory 520, when executed by processor 510, enable terminal 500 to perform some or all of the steps in the method embodiments described below.
The processor 510 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by operating or executing software programs and/or modules stored in the memory 520 and calling data stored in the memory. The processor may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions. For example, processor 510 may include only a Central Processing Unit (CPU). In the embodiment of the present invention, the CPU may be a single operation core, or may include multiple operation cores.
A communication unit 530 for establishing a communication channel so that the storage terminal can communicate with other terminals. And receiving user data sent by other terminals or sending the user data to other terminals.
EXAMPLE seven
The present invention also provides a computer storage medium, wherein the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
A computer storage medium storing a color-based inter-image disparity contrast program that when executed by a processor performs the steps of:
respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
According to the invention, the three-channel pixel values of the two frames of images R, G, B are subtracted, the obtained maximum difference value is compared with the set threshold value, the pixels with large change are reserved, the region with obvious color change and large change range is used as the change region between the two frames of images, the accuracy of image contrast is improved, and a good foundation is laid for analyzing the front and back change of the target between the images.
In some embodiments, when the color-based inter-image difference contrast subroutine stored in the readable storage medium is executed by the processor, the method may specifically include: and carrying out filtering processing on the changed image.
In some embodiments, when the color-based inter-image difference contrast subroutine stored in the readable storage medium is executed by the processor, the method may specifically include: and filtering the changed image through a median filtering algorithm.
In some embodiments, when the color-based inter-image difference contrast subroutine stored in the readable storage medium is executed by the processor, the method may specifically include: if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in the form of a software product, where the computer software product is stored in a storage medium, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like, and the storage medium can store program codes, and includes instructions for enabling a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, and the like) to perform all or part of the steps of the method in the embodiments of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The above disclosure is only for the preferred embodiments of the present invention, but the present invention is not limited thereto, and any non-inventive changes that can be made by those skilled in the art and several modifications and amendments made without departing from the principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for contrast between images based on color, comprising the steps of:
respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
2. The method for contrasting differences between color-based images according to claim 1, wherein before a continuous region composed of pixels with a pixel value of T1 in the changed image is a changed region, the method further comprises the following steps:
and carrying out filtering processing on the changed image.
3. The method for contrast between color-based images according to claim 2, wherein the filtering process is performed on the changed image, specifically:
and filtering the changed image through a median filtering algorithm.
4. A method for comparing differences between color-based images according to claim 1, 2 or 3, wherein if the difference to be compared is greater than a preset difference threshold, the pixel value of the pixel is set to T1; otherwise, setting the pixel value of the pixel to T2, specifically:
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
5. A color-based contrast device between images, comprising,
a pixel difference value calculation module: respectively calculating pixel difference values of an R channel, a G channel and a B channel of the two frames of images aiming at each pixel;
a to-be-compared difference selecting module: selecting the maximum value of the pixel difference values of the R channel, the G channel and the B channel as a difference value to be compared;
a difference comparison module: comparing whether the difference value to be compared is larger than a preset difference value threshold value or not;
a pixel reset module: if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel as T1; otherwise, setting the pixel value of the pixel as T2 to obtain a change image;
a change area recording module: note that a continuous region made up of pixels having a pixel value of T1 in the changed image is a changed region.
6. The color-based contrast device for difference between images according to claim 5, further comprising,
a filtering module: and carrying out filtering processing on the changed image.
7. The apparatus according to claim 6, wherein the filter module performs a filtering process on the variation image by a median filter algorithm.
8. The apparatus according to claim 5, 6 or 7, wherein the pixel resetting module sets the pixel value of the pixel to T1 if the difference to be compared is greater than a preset difference threshold;
otherwise, setting the pixel value of the pixel to T2, specifically:
if the difference value to be compared is larger than the preset difference value threshold value, setting the pixel value of the pixel to be 255; otherwise, the pixel value of the pixel is set to 0.
9. A terminal, comprising:
a memory for storing a color-based inter-image difference contrast program;
a processor for implementing the steps of the color-based inter-image disparity comparison method according to any one of claims 1 to 4 when executing the color-based inter-image disparity comparison procedure.
10. A readable storage medium having stored thereon a color-based inter-image disparity contrast program, which when executed by a processor implements the steps of the color-based inter-image disparity contrast method according to any one of claims 1 to 4.
CN202110998472.0A 2021-08-27 2021-08-27 Method, device, terminal and storage medium for comparing difference between images based on colors Withdrawn CN113781334A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110998472.0A CN113781334A (en) 2021-08-27 2021-08-27 Method, device, terminal and storage medium for comparing difference between images based on colors

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110998472.0A CN113781334A (en) 2021-08-27 2021-08-27 Method, device, terminal and storage medium for comparing difference between images based on colors

Publications (1)

Publication Number Publication Date
CN113781334A true CN113781334A (en) 2021-12-10

Family

ID=78839886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110998472.0A Withdrawn CN113781334A (en) 2021-08-27 2021-08-27 Method, device, terminal and storage medium for comparing difference between images based on colors

Country Status (1)

Country Link
CN (1) CN113781334A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055710A (en) * 2022-08-10 2023-05-02 荣耀终端有限公司 Video time domain noise evaluation method, device and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055710A (en) * 2022-08-10 2023-05-02 荣耀终端有限公司 Video time domain noise evaluation method, device and system
CN116055710B (en) * 2022-08-10 2023-10-20 荣耀终端有限公司 Video time domain noise evaluation method, device and system

Similar Documents

Publication Publication Date Title
US20210224954A1 (en) Image processing method and device, storage medium and computer device
CN108615227A (en) A kind of suppressing method and equipment of image moire fringes
CN108600783B (en) Frame rate adjusting method and device and terminal equipment
CN109903265B (en) Method and system for setting detection threshold value of image change area and electronic device thereof
CN112907457A (en) Image processing method, image processing device and computer equipment
CN111161188A (en) Method for reducing image color noise, computer device and computer readable storage medium
CN116091321B (en) Image scaling method, device, equipment and storage medium
CN113112424A (en) Image processing method, image processing device, computer equipment and storage medium
CN111429371B (en) Image processing method and device and terminal equipment
CN111163301B (en) Color adjustment method, device and computer readable storage medium
CN113781334A (en) Method, device, terminal and storage medium for comparing difference between images based on colors
CN112929672A (en) Video compression method, device, equipment and computer readable storage medium
CN111445487A (en) Image segmentation method and device, computer equipment and storage medium
CN113099230B (en) Encoding method, encoding device, electronic equipment and computer readable storage medium
CN111539975B (en) Method, device, equipment and storage medium for detecting moving object
US6671401B1 (en) Removing color moire patterns from digital images having known chromaticities
JPWO2019041842A5 (en)
CN113256487B (en) Image processing method, device, equipment and storage medium
CN111476735B (en) Face image processing method and device, computer equipment and readable storage medium
CN111445411B (en) Image denoising method, image denoising device, computer equipment and storage medium
CN113824894A (en) Exposure control method, device, equipment and storage medium
CN113382246A (en) Encoding method, encoding device, electronic equipment and computer readable storage medium
CN107103318B (en) Image point positioning method and image point positioning device
CN108062773B (en) Image processing method and device and robot
US20220245819A1 (en) Method for processing images, electronic 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
WW01 Invention patent application withdrawn after publication

Application publication date: 20211210

WW01 Invention patent application withdrawn after publication