CN114972817A - Image similarity matching method, device and storage medium - Google Patents

Image similarity matching method, device and storage medium Download PDF

Info

Publication number
CN114972817A
CN114972817A CN202210441209.6A CN202210441209A CN114972817A CN 114972817 A CN114972817 A CN 114972817A CN 202210441209 A CN202210441209 A CN 202210441209A CN 114972817 A CN114972817 A CN 114972817A
Authority
CN
China
Prior art keywords
image
similarity
character string
matching
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.)
Pending
Application number
CN202210441209.6A
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.)
Shenzhen Skyworth RGB Electronics Co Ltd
Original Assignee
Shenzhen Skyworth RGB Electronics 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 Shenzhen Skyworth RGB Electronics Co Ltd filed Critical Shenzhen Skyworth RGB Electronics Co Ltd
Priority to CN202210441209.6A priority Critical patent/CN114972817A/en
Publication of CN114972817A publication Critical patent/CN114972817A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Landscapes

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

Abstract

The invention discloses an image similarity matching method, equipment and a storage medium, wherein the method comprises the following steps: acquiring an image to be detected and a standard image, separating the image to be detected and the standard image into color channel images, and determining the histogram similarity of the color channel images; if the histogram similarity is higher than a first preset threshold, extracting a character string area image in the color channel image, and determining a structural similarity index of the character string area image; if the structural similarity index is higher than a second preset threshold value, extracting feature point information in the character string area image; and matching the characteristic points according to the characteristic point information to judge whether the image to be detected is the same as the standard image. The invention realizes the technical effect of improving the matching efficiency of the similarity of the character and the image.

Description

Image similarity matching method, device and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image similarity matching method, device, and storage medium.
Background
With the continuous growth of economy and the high-speed development of the internet, the development of terminal equipment based on application programs is endless, and the intelligent application programs bring convenience and fun to the life of people. Before the application program product is released in a mass production manner, a large number of software tests are often required to ensure the reliability and stability of the use of the software product.
In terms of the development of language word translation software, in the software testing stage, when characters of different countries are selected, the characters need to be compared with standard template characters, and if the characters of different countries are different, the characters of the countries need to be translated again and displayed. At present, whether characters are the same or not is verified by testing personnel mainly through line-by-line one-to-one comparison, the work is tedious, the long-time work can cause eye fatigue, the work efficiency is low, and mistakes are easy to make.
Disclosure of Invention
The invention mainly aims to provide an image similarity matching method, image similarity matching equipment and a storage medium, and aims to solve the problem of low efficiency of character similarity matching.
In order to achieve the above object, the present invention provides an image similarity matching method, including:
acquiring an image to be detected and a standard image, separating the image to be detected and the standard image into color channel images, and determining the histogram similarity of the color channel images;
if the histogram similarity is higher than a first preset threshold, extracting a character string area image in the color channel image, and determining a structural similarity index of the character string area image;
if the structural similarity index is higher than a second preset threshold value, extracting feature point information in the character string area image;
and matching the characteristic points according to the characteristic point information to judge whether the image to be detected is the same as the standard image.
Optionally, the step of obtaining an image to be detected and a standard image, separating the image to be detected and the standard image into color channel images, and calculating the histogram similarity of the color channel images includes:
acquiring a standard image by using a preset text control, positioning the position of a text box of a text to be tested in a test page, and intercepting the image to be tested according to the position of the text box;
separating the image to be detected and the standard image into three-channel images;
calculating the frequency score of each pixel point in the three-channel image by using a preset frequency formula;
and in each channel, taking the average value of all pixel points as the channel score of a single channel, and taking the average value of all the channel scores as the histogram similarity.
Optionally, before the step of separating the image to be measured and the standard image into three-channel images, the method further includes:
extracting the height value and the width value of the image to be detected and the standard image, and comparing the height value difference and the width value difference between the image to be detected and the standard image;
if the height value difference and the width value difference are both within a preset interval, the step of separating the image to be detected and the standard image into three-channel images is executed;
and if the height value difference or the width value difference is not within a preset interval, executing the steps of extracting the character string area image in the color channel image and calculating the structural similarity index of the character string area image.
Optionally, the step of extracting a character string region image in the color channel image, and calculating a structural similarity index of the character string region image includes:
sequentially carrying out graying and binarization processing on the color channel image;
positioning an area covering all characters in the color channel image after binarization, and intercepting a character string area image in the area;
normalizing the character string area images to keep the sizes of the character string area images consistent;
and processing the normalized character string region image by using a preset structure similarity algorithm to obtain a structure similarity index of the character string region image.
Optionally, the step of locating an area covering all characters in the binarized color channel image, where the step of capturing a character string area image in the area includes:
performing preset row cutting and column cutting on the color channel image after binarization to obtain the coordinate position of each character;
and acquiring a start character coordinate position and an end character coordinate position in the coordinate positions, and intercepting a character string area image according to the start character coordinate position and the end character coordinate position.
Optionally, the step of performing feature point matching according to the feature point information to determine whether the image to be detected and the standard image are the same includes:
obtaining an initial matching point of the feature point according to a descriptor in the feature point information;
if the number of the initial matching points is smaller than the preset number, taking the initial matching points as final matching points;
calculating the difference degree and the contact degree of the feature points according to the number of the final matching points;
and if the difference degree is smaller than a preset difference degree threshold value and the contact ratio is larger than a preset contact ratio threshold value, judging that the image to be detected is the same as the standard image.
Optionally, the step of obtaining the initial matching point of the feature point according to the descriptor in the feature point information includes:
establishing an index tree according to the multidimensional data of the feature points;
comparing the node feature vector in the index tree with the descriptor, traversing the nodes of the index tree, and obtaining the nearest neighbor point and the next nearest neighbor point of the feature point;
and calculating the distance ratio of the nearest neighbor point to the next neighbor point, and if the distance ratio is smaller than a preset distance threshold, taking the nearest neighbor point and the next neighbor point as initial matching points.
Optionally, before the step of calculating the difference degree and the coincidence degree of the feature points according to the number of the final matching points, the method further includes:
if the number of the initial matching points is larger than or equal to the preset number, removing characteristic points which are mismatched in the initial matching points by using a preset random sampling consistency algorithm;
and taking the initial matching point after the elimination as a final matching point.
In addition, to achieve the above object, the present invention also provides an electronic device including: a memory, a processor and an image similarity matching program stored on the memory and executable on the processor, the image similarity matching program being configured to implement the steps of the image similarity matching method as described above.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon an image similarity matching program which, when executed by a processor, implements the steps of the image similarity matching method as recited in the above.
The method comprises the steps of obtaining an image to be detected and a standard image, determining the histogram similarity of the image to be detected and the standard image, integrally evaluating the similarity of the image to be detected and the standard image in terms of image backgrounds, extracting a character string region image if the histogram similarity is higher than a first preset threshold, determining the structural similarity index of the character string region image of the standard image of the image to be detected and the image backgrounds of the image to be detected and the standard image of the image to be detected, further integrally evaluating the similarity of the image to the standard image of the character string region image to be detected in terms of image structures, extracting feature point information in the character string region image if the structural similarity index is higher than a second preset threshold, and carrying out local similarity evaluation through the matching degree of feature point matching to obtain a final similarity matching result.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of an image similarity matching method according to the present invention;
FIG. 3 is a flowchart illustrating an image similarity matching method according to a second embodiment of the present invention;
FIG. 4 is a flowchart illustrating an image similarity matching method according to a third embodiment of the present invention;
fig. 5 is a flowchart illustrating an image similarity matching method according to a fourth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The existing word similarity matching technology is based on the existing data, and the following problems can be faced if the word content is detected, identified and compared with the difference between the two types of data: firstly, characters outside the data set cannot be identified; secondly, punctuation marks or special marks cannot be identified, and the special characters have great influence on the accuracy rate of character detection; and finally, the existing data set model is large in storage and calculation amount and difficult to apply to android embedded equipment.
The main technical scheme of the invention is as follows: acquiring an image to be detected and a standard image, separating the image to be detected and the standard image into color channel images, and determining the histogram similarity of the color channel images; if the histogram similarity is higher than a first preset threshold, extracting a character string area image in the color channel image, and determining a structural similarity index of the character string area image; if the structural similarity index is higher than a second preset threshold value, extracting feature point information in the character string area image; and matching the characteristic points according to the characteristic point information to judge whether the image to be detected is the same as the standard image.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the electronic device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and an image similarity matching program.
In the electronic device shown in fig. 1, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the electronic device according to the present invention may be provided in the electronic device, and the electronic device calls the image similarity matching program stored in the memory 1005 through the processor 1001 and executes the image similarity matching method provided by the embodiment of the present invention.
An embodiment of the present invention provides an image similarity matching method, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the image similarity matching method according to the present invention.
In this embodiment, the image similarity matching method includes:
step S10, acquiring an image to be detected and a standard image, separating the image to be detected and the standard image into color channel images, and determining the histogram similarity of the color channel images;
when the characters are displayed on the terminal equipment, the characters can be regarded as an image, namely, the characters and the area where the characters are located are taken as a whole, and the characters have measuring indexes such as color tone, background, structure and the like. When the character similarity is matched, a text box can be selected according to the display position of the text to be detected, an image to be detected is obtained, and a standard image of a known standard text is taken out.
The color channel refers to a channel that holds image color information. Each image has one or more channels, and the default number of color channels in an image depends on its color mode, i.e., the color mode of each image will determine the number of color channels. The CYMK (Cyan, Magenta, Yellow, blacK) image has 4 channels by default, and the RGB (Red Green Blue) image and the Lab image have 3 channels by default.
And after the image to be detected and the standard image are separated into color channel images, calculating the histogram similarity of each single channel. The histogram can be drawn to count the occurrence frequency of all pixels in the digital image according to the size of the gray value. For the frequency difference of the pixel points in the image to be detected and the standard image, the larger the frequency difference is, the larger the difference between the two images is.
Step S20, if the histogram similarity is higher than a first preset threshold, extracting a character string area image in the color channel image, and determining a structural similarity index of the character string area image;
according to the similarity requirement in the actual scene, if the similarity requirement is high, the first preset threshold value can be set to be high, the to-be-detected image which is not matched with the standard image is eliminated on the whole, and the matching efficiency is improved. In a possible implementation manner, the first preset threshold is set to 0.9, if the histogram similarity is higher than or equal to 0.9, the character string region image is extracted from the color channel image, and if the histogram similarity is lower than 0.9, it may be directly determined that the image to be measured is different from the standard image.
When extracting the character string area image, positioning all character areas in a character cutting mode, performing horizontal projection and vertical projection on the character areas to obtain the coordinate position of each character, and obtaining the character string area image according to the coordinate position. Characters include words and symbols. The character string region image can remove the space between the characters.
The Structural Similarity index can be characterized using SSIM (Structural Similarity). The structural similarity index defines structural information from an image composition perspective as being independent of brightness and contrast, and reflects attributes of object structures in a scene. When the SSIM value is 1, it indicates that the two images are identical.
Step S30, if the structural similarity index is higher than a second preset threshold value, extracting feature point information in the character string area image;
the structural similarity index can evaluate the similarity between the two images in the dimension of the overall structure of the images, and in a scene with a high similarity requirement, the second preset threshold value can be set to be high, so that the image to be detected which is not matched with the standard image is removed from the overall structure. In a possible implementation manner, the second preset threshold is set to 0.5, if the structural similarity index is greater than or equal to 0.5, the feature point information in the image of the character string region may be extracted, and if the structural similarity index is less than 0.5, it is directly determined that the image to be measured is different from the standard image.
The feature point information in the character string region can be extracted through an image feature point extraction algorithm. Image Feature point extraction algorithms such as Harris corner detection, SIFT (Scale Invariant Feature Transform), SURF (Speeded Up Robust Features), FAST corner detection, BRIEF (Binary Robust Independent Elementary Features) descriptor, ORB (Oriented FAST and Rotated BRIEF), and the like.
Step S40, matching feature points according to the feature point information to judge whether the image to be detected is the same as the standard image;
when the feature point matching is carried out, the initial matching can be carried out through the descriptors in the feature point information, and the initial matching point is obtained. If the number of the initial matching points is large, the initial matching points can be removed, and points with wrong matching in the initial matching points are removed to obtain final matching points. And evaluating the difference degree and the contact ratio of the matching degree of the final matching point, and if the difference degree and the contact ratio meet the requirements, judging that the image to be detected is the same as the standard image.
In the embodiment, an image to be detected and a standard image are obtained, the image to be detected and the standard image are separated into color channel images, and the histogram similarity of the color channel images is determined; if the histogram similarity is higher than a first preset threshold, extracting a character string area image in the color channel image, and determining a structural similarity index of the character string area image; if the structural similarity index is higher than a second preset threshold value, extracting feature point information in the character string area image; and matching the characteristic points according to the characteristic point information to judge whether the image to be detected is the same as the standard image.
Further, in a second embodiment of the image similarity matching method of the present invention, referring to fig. 3, the method includes:
step S11, acquiring a standard image by using a preset text control, positioning the position of a text box of a text to be tested in a test page, and intercepting the image to be tested according to the position of the text box;
when the text control is designed, the text control has the functions of positioning the specific position of each section of text in the image, intercepting the text, and finding out the standard characters of the corresponding national language to obtain the image to be detected and the standard image. In the actual test process, a tester pauses the page of the display device, the text control can intercept a text box area in the test page, and an image in the text box area is an image to be tested.
Step S12, extracting the height value and the width value of the image to be detected and the standard image, and comparing the height value difference and the width value difference between the image to be detected and the standard image;
the height value and the width value of the image can be expressed in terms of pixel values, i.e., the pixel values in the height direction are height values and the pixel values in the width direction are width values. And dividing the height value of the image to be detected and the height value of the standard image to obtain a height value difference, and dividing the width value of the image to be detected and the width value of the standard image to obtain a width value difference.
Step S13, if the height value difference and the width value difference are both in a preset interval, separating the image to be detected and the standard image into three-channel images;
in an implementation mode, the preset interval is set to be 0.8-1.2, and if the height value difference and the width value difference are both in the range of 0.8-1.2, the size between the image to be measured and the standard image is basically consistent. The sizes of the two images are basically consistent, and the number and density distribution of pixel points in the images are considered to be basically consistent, so that the subsequent image processing steps are facilitated.
After the image to be measured and the standard image are separated into three-channel images, the pixel point frequency is counted in each single-channel image.
Step S14, calculating the frequency score of each pixel point in the three-channel image by using a preset frequency formula;
the preset frequency formula may be:
Socre=(1-|hist1-hist2|)/Max(hist1,hist2)
the Score represents a Score, the hist1 represents the frequency of the single pixel points in the image to be detected, the hist2 represents the frequency of the single pixel points in the standard image, and the Max represents the maximum value. According to the frequency formula, the larger the frequency difference of a single pixel point, the larger the denominator, the smaller the frequency score, i.e., the larger the frequency difference, the lower the score.
Step S15, in each channel, the average value of all the pixel points is taken as the channel score of a single channel, and the average value of all the channel scores is taken as the histogram similarity.
In a single channel, the average value of all the pixel points is a single-channel score, the average value of the three-channel scores is a frequency score, and the frequency score is used for representing the similarity of the histogram. A higher frequency score may indicate a smaller background difference between the measured image and the standard image.
In the embodiment, the text control is used for acquiring the image to be detected and the standard image, and the difference of the image to be detected and the standard image on the whole background is judged according to the histogram similarity between the image to be detected and the standard image, so that the background difference and the character deformation condition of the text can be effectively identified.
Further, in a third embodiment of the image similarity matching method of the present invention, referring to fig. 4, the method includes:
step S21, if the height value difference and the width value difference are not in the preset interval, sequentially carrying out graying and binarization processing on the color channel image;
the height value difference or the width value difference is not in the preset interval, which indicates that the size difference between the image to be detected and the standard image is large, the difference between the number of pixel points and the distribution density is large, and the size of the image to be detected and the size of the standard image can be uniformly processed in the follow-up process, and then the structural similarity of the image to be detected and the structural similarity of the standard image can be judged.
The color channel image is grayed and then subjected to binarization processing, and the color channel image is converted into a gray image and then converted into a black-and-white image. When actually comparing the image to be measured with the standard image, the two images often have a large gray scale difference, such as a difference in brightness and contrast, and the standard template of the text is susceptible to noise. The shape of the image generated by using the self-adaptive binarization is basically kept unchanged at the corresponding position, so that the interference caused by gray difference can be effectively eliminated, and meanwhile, the interference is reduced for extracting horizontal and vertical coordinate pixel points for subsequent cut characters.
Step S22, preset row cutting and column cutting are carried out on the color channel image after binarization, and the coordinate position of each character is obtained;
during cutting, a completely black background image can be defined, the number of white pixel points of each line is circularly counted to obtain horizontal projection, a vertical segmentation position is obtained according to the horizontal projection, and then the lines are segmented. Column division is obtained in the same manner as row division, and the coordinate position of each character is obtained by row division and column division.
Step S23, acquiring a start character coordinate position and an end character coordinate position in the coordinate positions, and intercepting a character string area image according to the start character coordinate position and the end character coordinate position;
acquiring the coordinate positions of the starting character and the ending character, extracting a coordinate point at the upper left corner of the starting character and a coordinate point at the lower right corner of the ending character, drawing a rectangle through the two coordinate points, and intercepting a character string area to obtain a character string area image. The character string region image includes only letters and symbols.
Step S24 of normalizing the character string region images so that the sizes of the character string region images are kept consistent;
and carrying out equal-scale amplification on the image of the intercepted character string area. In an actual application scene, because the size of an image intercepted by a character control is small, the small size can cause the quantity of subsequently extracted feature points to be small and even the feature points cannot be extracted, so that the handwriting width of characters needs to be increased by amplifying the image, and the detection number of the feature points is increased. And then normalizing the sizes of the two images, and amplifying the image with the smaller size into the same size as the image with the larger size, so that the sizes of the character string region images of the image to be measured and the standard image are kept consistent.
And step S25, processing the normalized character string area image by using a preset structural similarity algorithm to obtain a structural similarity index of the character string area image.
The structural similarity index may be an SSIM index, calculated using the following structural similarity formula:
Figure BDA0003613638710000101
wherein the image to be detected is x, and the standard image is y, mu x Is the average value of x, μ y Is the average value of the values of y,
Figure BDA0003613638710000102
is the variance of x and is the sum of the differences,
Figure BDA0003613638710000103
variance of y, σ xy Is the covariance of x and y, c 1 And c 2 For maintaining a stable constant, c 1 =(k 1 L) 2 ,c 2 =(k 2 L) 2 L is the dynamic range of the pixel value, k 1 =0.01,k 2 =0.03。
In the embodiment, the structural similarity index is used for judging the integral structural difference between the image to be detected and the standard image, the characters used in different countries with the same semantic content are completely different, and whether the characters in the image to be detected and the standard image are the same language characters can be effectively identified through the structural difference.
Further, in a fourth embodiment of the image similarity matching method of the present invention, referring to fig. 5, the method includes:
step S31, establishing an index tree according to the multidimensional data of the feature points;
the algorithm used when extracting the feature points can be an SIFT algorithm, in the extraction process, the extreme point detection is firstly carried out in a scale space to find out the feature points, then the stability detection is carried out on the candidate feature points, the SIFT feature points are detected to pass, then the sampling is carried out in a domain window, the main direction of the feature points is determined, and finally, SIFT feature point descriptors, namely 128-dimensional feature vectors, are generated.
The index tree may be a KD (K-Dimensional) tree, which is a query index structure and widely applied to database indexing. Firstly, calculating variance of multidimensional data of each feature point in a feature point set, selecting a median with the largest variance to divide the feature point set into two subsets, and repeating the operation until all the subsets are divided, thereby generating the KD tree.
Step S32, comparing the node feature vector in the index tree with the descriptor, traversing the nodes of the index tree, and obtaining the nearest neighbor point and the next nearest neighbor point of the feature point;
and inquiring the KD tree from the root node, comparing the feature vector of the inquired node with the descriptor on the generated KD tree, and continuously traversing to find the nearest neighbor point and the next nearest neighbor point.
Step S33, calculating the ratio of the nearest neighbor point to the next nearest neighbor point, and if the ratio is smaller than a preset distance threshold, taking the nearest neighbor point and the next nearest neighbor point as initial matching points;
and obtaining the nearest neighbor point and the next neighbor point of the feature point, calculating the distance ratio of the nearest neighbor point and the next neighbor point, and when the ratio is smaller than a preset distance threshold value, considering that the nearest neighbor point is matched with the next neighbor point. In one possible embodiment, the preset distance threshold may be 0.75. And if the ratio is greater than or equal to the preset distance threshold, discarding the nearest neighbor point and the next nearest neighbor point. And storing all matched feature points in a list, wherein the length of the list is the number of the initial matching points.
Step S34, if the number of the initial matching points is less than the preset number, the initial matching points are used as final matching points;
after the preliminary matching, a larger number of initial matching points may be obtained. And setting the preset number of the initial matching points, and further removing the characteristic points which are mismatched in the initial matching points. The preset number may be 8. If the number of the initial matching points is less than 8, the initial matching points can be used as final matching points.
Step S35, if the number of the initial matching points is larger than or equal to the preset number, a preset random sampling consistency algorithm is used for removing the characteristic points which are mistakenly matched in the initial matching points;
the random Sample consensus algorithm RANSAC (random Sample consensus) can better eliminate mismatched feature points, and the ideal result is that connecting lines between matching points are parallel, and the mismatched points with inclined connecting lines of the matching points are eliminated. In the removing process, initializing eight internal points randomly from the initial matching points, normalizing the matched feature points, performing singular value decomposition on linear equations corresponding to the eight pairs of initial matching points to obtain a basic matrix, calculating the distance from other points to epipolar lines of the basic matrix, determining the internal points if the distance is smaller than a preset value, otherwise determining the external points, repeating iteration, and taking the feature points with the largest number of internal points as final results.
Step S36, the initial matching points after the elimination processing are taken as final matching points;
after the elimination, the characteristic points that are incorrectly matched in the initial matching points can be removed, and the matching point with the largest number of inner points is taken as the final matching point.
Step S37, calculating the difference degree and the contact ratio of the characteristic points according to the number of the final matching points;
the calculation formula of the difference degree can be as follows: d ═ P 1 -P 2 |/Max(P 1 ,P 2 )
Wherein, P 1 Representing the number of initial matching points, P, in the image to be measured 2 The number of initial matching points in the standard image is represented, Max represents the maximum value, and D represents the difference.
The contact ratio calculation formula can be: c ═ R/P
Wherein R represents the number of final matching points, P represents the number of initial matching points, and C represents the contact ratio.
Step S38, if the difference is smaller than a preset difference threshold and the contact ratio is greater than a preset contact ratio threshold, determining that the to-be-detected image is the same as the standard image.
The difference degree represents the overall difference degree of the extracted feature points of the two images, and when the difference between the two images is too large, the difference of the image features is large, and the two images can be judged to be different. The contact ratio represents the similarity of the extracted feature points, the average value of the contact ratios of the two images is taken as a final result, and if the images are judged to be identical, the more feature points are matched, the better the result is. The preset difference threshold may be 0.1, and the preset contact ratio threshold may be 0.8.
And if the difference degree is greater than a preset difference degree threshold value or the contact ratio is less than a preset contact ratio threshold value, judging that the image to be detected is different from the standard image.
In the embodiment, the feature point information in the character string region image is extracted, the feature points are subjected to primary matching and secondary matching, the feature point matching degree between the image to be detected and the standard image is comprehensively judged by using the difference degree and the coincidence degree, and the matching accuracy of the character image similarity is improved.
An embodiment of the present invention further provides an electronic device, where the electronic device includes: a memory, a processor and an image similarity matching program stored on the memory and executable on the processor, the image similarity matching program being configured to implement the steps of the image similarity matching method as described above.
An embodiment of the present invention further provides a computer-readable storage medium, where an image similarity matching program is stored on the computer-readable storage medium, and when executed by a processor, the image similarity matching program implements the steps of the image similarity matching method described above.
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, method, article, or system 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, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or system in which the element is included.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An image similarity matching method, characterized by comprising the steps of:
acquiring an image to be detected and a standard image, separating the image to be detected and the standard image into color channel images, and determining the histogram similarity of the color channel images;
if the histogram similarity is higher than a first preset threshold, extracting a character string area image in the color channel image, and determining a structural similarity index of the character string area image;
if the structural similarity index is higher than a second preset threshold value, extracting feature point information in the character string area image;
and matching the characteristic points according to the characteristic point information to judge whether the image to be detected is the same as the standard image.
2. The image similarity matching method according to claim 1, wherein the step of obtaining an image to be measured and a standard image, separating the image to be measured and the standard image into color channel images, and calculating the histogram similarity of the color channel images comprises:
acquiring a standard image by using a preset text control, positioning the position of a text box of a text to be tested in a test page, and intercepting the image to be tested according to the position of the text box;
separating the image to be detected and the standard image into three-channel images;
calculating the frequency score of each pixel point in the three-channel image by using a preset frequency formula;
and in each channel, taking the average value of all pixel points as the channel score of a single channel, and taking the average value of all the channel scores as the histogram similarity.
3. The image similarity matching method according to claim 2, further comprising, before the step of separating the image to be measured and the standard image into three-channel images:
extracting the height value and the width value of the image to be detected and the standard image, and comparing the height value difference and the width value difference between the image to be detected and the standard image;
if the height value difference and the width value difference are both within a preset interval, the step of separating the image to be detected and the standard image into three-channel images is executed;
and if the height value difference or the width value difference is not within a preset interval, executing the step of extracting the character string area image in the color channel image and calculating the structural similarity index of the character string area image.
4. The image similarity matching method according to claim 1, wherein the step of extracting a character string region image in the color channel image and calculating a structural similarity index of the character string region image includes:
sequentially carrying out graying and binarization processing on the color channel image;
positioning an area covering all characters in the color channel image after binarization, and intercepting a character string area image in the area;
normalizing the character string area images to keep the sizes of the character string area images consistent;
and processing the normalized character string region image by using a preset structure similarity algorithm to obtain a structure similarity index of the character string region image.
5. The image similarity matching method according to claim 4, wherein the step of locating the area covering all characters in the binarized color channel image, and truncating a character string area image in the area comprises:
performing preset row cutting and column cutting on the color channel image after binarization to obtain the coordinate position of each character;
and acquiring a start character coordinate position and an end character coordinate position in the coordinate positions, and intercepting a character string area image according to the start character coordinate position and the end character coordinate position.
6. The image similarity matching method according to claim 1, wherein the step of performing feature point matching according to the feature point information to determine whether the image to be measured and the standard image are the same includes:
obtaining an initial matching point of the feature point according to a descriptor in the feature point information;
if the number of the initial matching points is smaller than the preset number, taking the initial matching points as final matching points;
calculating the difference degree and the contact degree of the feature points according to the number of the final matching points;
and if the difference degree is smaller than a preset difference degree threshold value and the contact ratio is larger than a preset contact ratio threshold value, judging that the image to be detected is the same as the standard image.
7. The image similarity matching method according to claim 6, wherein the step of obtaining the initial matching points of the feature points according to the descriptors in the feature point information includes:
establishing an index tree according to the multidimensional data of the feature points;
comparing the node feature vector in the index tree with the descriptor, traversing the nodes of the index tree, and obtaining the nearest neighbor point and the next nearest neighbor point of the feature point;
and calculating the distance ratio of the nearest neighbor point to the next neighbor point, and if the distance ratio is smaller than a preset distance threshold, taking the nearest neighbor point and the next neighbor point as initial matching points.
8. The image similarity matching method according to claim 6, wherein before the step of calculating the degree of difference and the degree of coincidence of the feature points based on the number of the final matching points, the method further comprises:
if the number of the initial matching points is larger than or equal to the preset number, removing characteristic points which are mismatched in the initial matching points by using a preset random sampling consistency algorithm;
and taking the initial matching point after the elimination processing as a final matching point.
9. An electronic device, characterized in that the electronic device comprises: a memory, a processor and an image similarity matching program stored on the memory and executable on the processor, the image similarity matching program being configured to implement the steps of the image similarity matching method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that an image similarity matching program is stored thereon, which when executed by a processor implements the steps of the image similarity matching method according to any one of claims 1 to 8.
CN202210441209.6A 2022-04-25 2022-04-25 Image similarity matching method, device and storage medium Pending CN114972817A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210441209.6A CN114972817A (en) 2022-04-25 2022-04-25 Image similarity matching method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210441209.6A CN114972817A (en) 2022-04-25 2022-04-25 Image similarity matching method, device and storage medium

Publications (1)

Publication Number Publication Date
CN114972817A true CN114972817A (en) 2022-08-30

Family

ID=82979038

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210441209.6A Pending CN114972817A (en) 2022-04-25 2022-04-25 Image similarity matching method, device and storage medium

Country Status (1)

Country Link
CN (1) CN114972817A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115423855A (en) * 2022-11-04 2022-12-02 深圳市壹倍科技有限公司 Image template matching method, device, equipment and medium
CN116363668A (en) * 2023-05-31 2023-06-30 山东一品文化传媒有限公司 Intelligent book checking method and system
CN116907349A (en) * 2023-09-12 2023-10-20 北京宝隆泓瑞科技有限公司 Universal switch state identification method based on image processing
CN117648889A (en) * 2024-01-30 2024-03-05 中国石油集团川庆钻探工程有限公司 Method for measuring velocity of blowout fluid based on interframe difference method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115423855A (en) * 2022-11-04 2022-12-02 深圳市壹倍科技有限公司 Image template matching method, device, equipment and medium
CN116363668A (en) * 2023-05-31 2023-06-30 山东一品文化传媒有限公司 Intelligent book checking method and system
CN116363668B (en) * 2023-05-31 2023-08-29 山东一品文化传媒有限公司 Intelligent book checking method and system
CN116907349A (en) * 2023-09-12 2023-10-20 北京宝隆泓瑞科技有限公司 Universal switch state identification method based on image processing
CN116907349B (en) * 2023-09-12 2023-12-08 北京宝隆泓瑞科技有限公司 Universal switch state identification method based on image processing
CN117648889A (en) * 2024-01-30 2024-03-05 中国石油集团川庆钻探工程有限公司 Method for measuring velocity of blowout fluid based on interframe difference method
CN117648889B (en) * 2024-01-30 2024-04-26 中国石油集团川庆钻探工程有限公司 Method for measuring velocity of blowout fluid based on interframe difference method

Similar Documents

Publication Publication Date Title
CN114972817A (en) Image similarity matching method, device and storage medium
US9367766B2 (en) Text line detection in images
WO2019169772A1 (en) Picture processing method, electronic apparatus, and storage medium
WO2016065701A1 (en) Image text recognition method and device
CN110728687B (en) File image segmentation method and device, computer equipment and storage medium
CN110807110B (en) Image searching method and device combining local and global features and electronic equipment
US20190163971A1 (en) Text line segmentation method
KR20030029187A (en) Face detecting method depend on image
CN104915664B (en) Contact object identifier obtaining method and device
US8787702B1 (en) Methods and apparatus for determining and/or modifying image orientation
KR20130015452A (en) Method on sub image retrieval using local alignment
CN111553241A (en) Method, device and equipment for rejecting mismatching points of palm print and storage medium
CN111582134A (en) Certificate edge detection method, device, equipment and medium
CN113627423A (en) Circular seal character recognition method and device, computer equipment and storage medium
CN115410191B (en) Text image recognition method, device, equipment and storage medium
JP4967045B2 (en) Background discriminating apparatus, method and program
CN115393748A (en) Method for detecting infringement trademark based on Logo recognition
CN112288045B (en) Seal authenticity distinguishing method
CN113158745B (en) Multi-feature operator-based messy code document picture identification method and system
CN113095147A (en) Skin area detection method, system, image processing terminal and storage medium
CN111783737B (en) Mathematical formula identification method and device
CN112287932B (en) Method, device, equipment and storage medium for determining image quality
KR101937859B1 (en) System and Method for Searching Common Objects in 360-degree Images
CN108133210B (en) Image format identification method and device
CN111209922B (en) Image color system style marking method, device, equipment and medium based on svm and opencv

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