Quick image retrieval method based on similarity
By extracting color features and pixel depth analysis of the image, marking pixel breakpoints and generating image tag data, the problem of large color differences in image search results in the prior art is solved, and the accuracy and user experience of the search results are improved.
Patent Information
- Application Number
- CN202510442577.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-05-09
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing rapid image search method cannot further screen similar images through pixel color comparison, resulting in large color differences in the search results and poor user experience.
By obtaining the color characteristics of the user input image and the image to be retrieved, color similarity evaluation and pixel depth analysis are performed, pixel breakpoints are marked, image marking data is generated, and image search is finally performed to obtain the best search image.
The color accuracy and user experience of the search results are improved, and through pixel depth analysis and marking, the images that best match the user input image are effectively filtered out.
Smart Images

Figure CN119961480A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image retrieval, relates to a similarity analysis technology, and specifically is a similarity-based rapid image retrieval method. Background Art
[0002] The existing image fast retrieval methods have the following specific defects when performing image retrieval: 1. The existing image fast retrieval method can only retrieve multiple images similar to the user input image, and cannot further screen the multiple similar images obtained by pixel color comparison, resulting in a color difference between the final retrieved image and the user output image, resulting in poor retrieval effect; 2. The existing image rapid retrieval method segments the image content of the user input image and multiple images to be retrieved, but cannot perform area coverage analysis on the segmented region based on the segmentation results. Ultimately, it cannot screen out the best retrieval image based on the analysis results. In actual operation, multiple retrieval images will still be output, requiring users to manually identify multiple retrieval images, resulting in a poor user experience.
[0003] To this end, we propose a similarity-based fast image retrieval method. Summary of the invention
[0004] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a method for rapid image retrieval based on similarity, which aims to improve the accuracy of retrieval results and the user's retrieval experience.
[0005] In order to achieve the above object, the present invention adopts the following technical solution: a method for rapid image retrieval based on similarity, comprising the following specific steps: Step S1: obtaining a user input image and a plurality of images to be retrieved, extracting and analyzing color features of the user input image and each image to be retrieved, evaluating the color similarity between each image to be retrieved and the user input image according to the analysis results, and obtaining color retrieval image data according to the evaluation results; Step S2: performing image pixel depth analysis on the user input image and multiple color-similar images according to the color retrieval image data, marking pixel discontinuities in the user input image and each color-similar image according to the analysis results, and obtaining image marking data; Step S3: performing image retrieval on the user-input tagged image and multiple tagged images with similar colors according to the image tag data, obtaining the best retrieval image corresponding to the user-input tagged image according to the retrieval, and outputting it.
[0006] Furthermore, the step S1 further includes the following specific steps: Step S11: obtaining a user input image through the user interface, using the existing visual model to compare the content consistency between each image in the retrieval database and the user input image, obtaining images with consistent content, and obtaining multiple images to be retrieved; Step S12: Compare the image size consistency of each image to be retrieved with the image input by the user. If the image input by the user is larger than or equal to the image to be retrieved, the image to be retrieved is enlarged until the size of the image input by the user is consistent with that of the image to be retrieved. If the image input by the user is smaller than the image to be retrieved, the image input by the user is enlarged until the size of the image input by the user is consistent with that of the image to be retrieved, and randomly select a sample color retrieval image from the image to be retrieved that is consistent with the size of the image input by the user. Step S13: performing color similarity analysis on the user input image and the sample color retrieval image, and obtaining the color similarity corresponding to the sample color retrieval image according to the analysis result; Step S14: performing color similarity analysis on each image to be retrieved and the image input by the user to obtain multiple color similarities; Step S15: Obtain a color similarity benchmark interval. If the color similarity is within the color similarity benchmark interval, the corresponding image to be retrieved is marked as a color similarity image. If the color similarity is not within the color similarity benchmark interval, the corresponding image to be retrieved is marked as a non-color similarity image. The multiple color similarity images obtained are defined as color retrieval image data.
[0007] Furthermore, the step S13 further includes the following specific steps: Step S131: converting the user input image and the sample color retrieval image into a preset comparison image resolution; Step S132: Take the lower left vertex of the image input by the user as the coordinate origin, draw a straight line through the coordinate origin parallel to the upper edge of the image to obtain the coordinate x-axis, draw a straight line through the coordinate origin perpendicular to the upper edge of the image to obtain the coordinate y-axis, and mark the plane rectangular coordinate system composed of the coordinate x-axis, the coordinate y-axis and the coordinate origin as the image comparison coordinate system; Step S133: Divide the user input image coverage area in the image comparison coordinate system into Tz image rectangles, obtain the diagonal intersection points corresponding to each image rectangle respectively, obtain multiple image rectangle midpoints, and respectively obtain the rectangle midpoint coordinate values of each image rectangle midpoint in the image comparison coordinate system, and use the rectangle midpoint coordinate values to name the corresponding image rectangle, and obtain multiple (m, n) input image rectangles; Step S134: aligning the lower left vertex of the sample color retrieval image with the coordinate origin of the image comparison coordinate system, and using the image rectangle in the image comparison coordinate system to divide the sample color retrieval image into a plurality of image rectangles, to obtain a plurality of (m, n) comparison image rectangles; Step S135: Perform color analysis on the (m, n) input image rectangle, and obtain the number of rectangles with normal colors according to the analysis result; Step S136: Calculate the ratio of the number of color normal rectangles to Tz to obtain the color similarity corresponding to the sample color retrieval image.
[0008] Furthermore, the step S135 further includes the following specific steps: Acquire a plurality of image pixel points in the (m, n) input image rectangle, arbitrarily select a first image pixel point from the acquired plurality of image pixel points, and acquire an image pixel point with the same coordinates as the first image pixel point in the (m, n) comparison image rectangle to obtain a second image pixel point; Obtaining the color RGB value of the pixel point of the first image in the RGB color model to obtain the RGB value of the first pixel point, and obtaining the color RGB value of the pixel point of the second image in the RGB color model to obtain the RGB value of the second pixel point; The RGB value of the first pixel and the RGB value of the second pixel are calculated to obtain the RGB weighted deviation corresponding to the pixel of the first image; ; Wherein, Scp is the RGB weighted deviation corresponding to the pixel of the first image, Rz1 is the R value in the RGB value of the first pixel, Rz2 is the R value in the RGB value of the second pixel, Gz1 is the G value in the RGB value of the first pixel, Gz2 is the G value in the RGB value of the second pixel, Bz1 is the B value in the RGB value of the first pixel, Bz2 is the B value in the RGB value of the second pixel, s1 and s2 are the set weighting coefficients, and s1 and s2 are both greater than 0; Obtain the RGB weighted deviation corresponding to each image pixel in the (m, n) comparison image rectangle, and average the obtained multiple RGB weighted deviations to obtain the (m, n) image color deviation; Get the (m,n) image color deviation threshold. If the (m,n) image color deviation is greater than or equal to the image color deviation threshold, mark the corresponding (m,n) input image rectangle as a color abnormal rectangle. If the (m,n) image color deviation is less than the image color deviation threshold, mark the corresponding (m,n) input image rectangle as a color normal rectangle, and obtain the numerical value of the color normal rectangle to obtain the number of color normal rectangles.
[0009] Furthermore, the step S2 further includes the following specific steps: Step S21: acquiring color retrieval image data, acquiring a user input image and a plurality of color-similar images according to the color retrieval image data, and arbitrarily selecting a sample color-similar image from the acquired plurality of color-similar images; Step S22: marking the edge of the target graphic on the user input image to obtain an input edge marked image; Step S23: acquiring and marking each pixel discontinuity point in each color-similar image respectively to obtain a plurality of color-marked images; Step S24: defining the user input tag image and a plurality of tag images with similar colors as image tag data.
[0010] Furthermore, the step S22 further includes the following specific steps: Step S221: graying the user input image to obtain a user input grayed image, acquiring each pixel point in the user input grayed image, and arbitrarily selecting a sample pixel point from the acquired multiple pixel points; Step S222: analyzing the sample pixel points, and acquiring the pixel discontinuity index corresponding to the sample pixel points according to the analysis result; Step S223: acquiring the pixel discontinuity index corresponding to each pixel respectively to obtain a plurality of pixel discontinuity indexes; Step S224: obtaining a preset interval of pixel discontinuity index corresponding to each pixel point, and if the pixel discontinuity index is not within the preset interval of pixel discontinuity index, marking the sample pixel point as a pixel discontinuity point; if the pixel discontinuity index is within the preset interval of pixel discontinuity index, marking the sample pixel point as a pixel continuous point; Step S225: Mark each pixel discontinuity point in the user input image to obtain a user input marked image.
[0011] Furthermore, the step S222 further includes the following specific steps: Obtaining the pixel depth value corresponding to the sample pixel point to obtain the sample pixel depth value; In the grayscale image input by the user, pixel points adjacent to the sample pixel point are acquired to obtain a plurality of sample adjacent pixel points, a pixel depth corresponding to each sample adjacent pixel point is numerically acquired to obtain a plurality of adjacent pixel depth values, and an average value of the plurality of adjacent pixel depth values is calculated to obtain an adjacent average pixel depth value; Calculate the difference between the sample pixel depth value and the adjacent average pixel depth value, and take the absolute value of the obtained difference to obtain the adjacent pixel average depth deviation corresponding to the sample pixel point; Calculate the difference between each adjacent pixel depth value and the sample pixel depth value, and take the absolute value of the obtained multiple pixel depth differences to obtain multiple adjacent pixel depth deviations, and arrange the obtained multiple adjacent pixel depth deviations in descending order; If the first-ranked adjacent pixel depth deviations are tied, two first-ranked adjacent pixel depth deviations are selected and marked as the first adjacent pixel depth deviation and the second adjacent pixel depth deviation; if the first-ranked adjacent pixel depth deviations are not tied, the first-ranked adjacent pixel depth deviation is marked as the first adjacent pixel depth deviation, and the second-ranked adjacent pixel depth deviation is marked as the second adjacent pixel depth deviation; The pixel discontinuity index corresponding to the sample pixel is obtained by calculating the average depth deviation of adjacent pixels, the first adjacent pixel depth deviation and the second adjacent pixel depth deviation; The pixel discontinuity index corresponding to the sample pixel is calculated. The specific formula is as follows: ; Among them, Jdz is the pixel discontinuity index corresponding to the sample pixel, Xsp is the average depth deviation of adjacent pixels, Xp1 is the first adjacent pixel depth deviation, and Xp2 is the second adjacent pixel depth deviation.
[0012] Furthermore, the step S3 further includes the following specific steps: Step S31: acquiring image tag data, and acquiring a user input tag image and a plurality of color-similar tag images according to the image tag data; Step S32: dividing the user input marked image and each color-similar marked image into regions to obtain a plurality of image closed regions; Step S33: randomly selecting a sample marked image from the multiple color-similar marked images obtained, performing regional area analysis on the sample marked image, and obtaining a regional graphic similarity ratio corresponding to the sample marked image according to the analysis result; Step S34: respectively obtain the regional graphic similarity ratio corresponding to each color-similar marked image to obtain multiple regional graphic similarity ratios, compare the numerical values of the obtained multiple regional graphic similarity ratios, mark the color-similar marked image corresponding to the maximum regional graphic similarity ratio as the best retrieval image, and output the best retrieval image.
[0013] Furthermore, the step S32 further includes the following specific steps: Acquire a plurality of pixel discontinuity points marked in the user input marked image to obtain a plurality of pixel discontinuity points; The eight-neighborhood pixel points of each pixel discontinuity point are obtained. If two or more pixel points among the eight-neighborhood pixel points of the pixel discontinuity point are pixel discontinuity pixel points, the corresponding pixel discontinuity point is marked as a graphic edge pixel point. If two or more pixel points among the eight-neighborhood pixel points of the pixel discontinuity point are not pixel discontinuity pixel points, the corresponding pixel discontinuity point is marked as a non-graphic edge pixel point. The graphic edge pixel points of the user input mark image are connected to obtain a number of graphic edge lines, and the closed area surrounded by the graphic edge lines in the user input mark image is obtained to obtain a plurality of image closed areas, and the obtained plurality of image closed areas are named F1 image closed area to Fz image closed area.
[0014] Furthermore, the step S33 further includes the following specific steps: Overlay the F1 image closed area in the sample marked image, mark the F1 image closed area of the user input marked image as the first F1 closed area, mark the F1 image closed area corresponding to the sample marked image as the second F1 closed area, and mark the overlapping part of the first F1 closed area and the second F1 closed area as the F1 closed overlapping area; Acquire the F2 closed overlapping area to the Fz closed overlapping area in the sample marked image respectively; Get the area value of the F1 image closed area to the Fz image closed area in the sample marked image, and get the area value of the F1 closed area to the Fz closed area; Obtain the area value of the closed overlapping area from F1 to Fz in the sample marked image, and obtain the area value of the overlapping area from F1 to Fz; The area similarity ratio of the sample marked image is obtained by calculating the area value of the F1 closed area to the area value of the Fz closed area and the area value of the F1 overlapping area to the area value of the Fz overlapping area; The similarity ratio of the regional graphics corresponding to the sample labeled image is calculated. The specific formula is as follows: ; Among them, Qtx is the regional graphic similarity ratio corresponding to the sample marked image, Mcdi is the area value of the Fi overlapping area, Mfbi is the area value of the Fi closed area, and z is the quantity value corresponding to the closed area of the image.
[0015] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are: 1. The present invention further screens the obtained multiple similar images by pixel color comparison, which can reduce the color difference between the final search image and the user output image, thereby ensuring the color accuracy of the search result; 2. The present invention performs image content segmentation on the user input image and multiple images to be retrieved, performs area coverage analysis on the segmented regions according to the segmentation results, and selects the best retrieval image through the analysis results, which can effectively improve the matching degree between the best retrieval image and the user input image. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.
[0017] Figure 1 It is a diagram of the implementation steps of the present invention; Figure 2 It is a schematic diagram of the image comparison coordinate system of the present invention; Figure 3 Schematic diagram of eight-neighborhood pixel points of the present invention. DETAILED DESCRIPTION
[0018] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] Embodiment 1 See also Figure 1 The present invention provides a technical solution: a method for rapid image retrieval based on similarity, comprising the following specific steps: Step S1: obtaining a user input image and a plurality of images to be retrieved, extracting and analyzing color features of the user input image and each image to be retrieved, evaluating the color similarity between each image to be retrieved and the user input image according to the analysis results, and obtaining color retrieval image data according to the evaluation results; The step S1 further includes the following specific steps: Obtain a user input image through a user interface, use an existing visual model to compare the content consistency between each image in the retrieval database and the user input image, obtain images with consistent content comparison, and obtain multiple images to be retrieved; It should be noted here that: The multiple images to be retrieved involved here have the same image content as the image input by the user; For example, if the user inputs an image of a flower, then each image to be retrieved is an image of a flower.
[0020] Compare the image size consistency of each image to be retrieved with the image input by the user. If the image input by the user is larger than or equal to the image to be retrieved, enlarge the image to be retrieved until the size of the image input by the user is consistent with that of the image to be retrieved. If the image input by the user is smaller than the image to be retrieved, enlarge the image input by the user until the size of the image input by the user is consistent with that of the image to be retrieved. Randomly select a sample color retrieval image from the image to be retrieved that is consistent with the size of the image input by the user. It should be noted here that: In the present application, the user interface referred to herein is specifically a search dialog box in an image search interface, in which a user can input an image as a search reference, and the search database referred to herein is specifically a database storing images to be searched; Perform color similarity analysis on the user input image and the sample color retrieval image, and obtain the color similarity corresponding to the sample color retrieval image according to the analysis result; The details are as follows: Converting both the user input image and the sample color retrieval image to a preset comparison image resolution; It should be noted here that: In the present application, the preset comparison image resolution involved here is 256×256.
[0021] See also Figure 2 , take the lower left vertex of the image input by the user as the coordinate origin, draw a straight line through the coordinate origin parallel to the upper edge of the image to obtain the coordinate x-axis, draw a straight line through the coordinate origin perpendicular to the upper edge of the image to obtain the coordinate y-axis, and mark the plane rectangular coordinate system composed of the coordinate x-axis, coordinate y-axis and coordinate origin as the image comparison coordinate system; The user input image coverage area in the image comparison coordinate system is divided into Tz image rectangles, and the diagonal intersection points corresponding to each image rectangle are obtained respectively to obtain multiple image rectangle midpoints. The rectangle midpoint coordinate values of each image rectangle midpoint in the image comparison coordinate system are respectively obtained, and the corresponding image rectangle is named using the rectangle midpoint coordinate values to obtain multiple (m, n) input image rectangles; It should be noted here that: In the present application, the m involved here can be the horizontal coordinate of the midpoint of any image rectangle, and n can be the vertical coordinate of the midpoint of any image rectangle, that is, the (m, n) input image rectangle can represent each image rectangle of the user input image coverage area.
[0022] Repeat the process of obtaining multiple (m, n) input image rectangles, overlap the lower left vertex of the sample color retrieval image with the coordinate origin of the image comparison coordinate system, and use the image rectangle in the image comparison coordinate system to divide the sample color retrieval image into several image rectangles to obtain multiple (m, n) comparison image rectangles; It should be noted here that: The (m,n) input image rectangle and the (m,n) comparison image rectangle are in the same image region in the image comparison coordinate system.
[0023] Acquire a plurality of image pixel points in the (m, n) input image rectangle, and arbitrarily select a first image pixel point from the acquired plurality of image pixel points; Acquire the image pixel point with the same coordinates as the first image pixel point in the (m, n) comparison image rectangle to obtain the second image pixel point; Obtaining the color RGB value of the pixel point of the first image in the RGB color model to obtain the RGB value of the first pixel point, and obtaining the color RGB value of the pixel point of the second image in the RGB color model to obtain the RGB value of the second pixel point; The RGB value of the first pixel and the RGB value of the second pixel are calculated to obtain the RGB weighted deviation corresponding to the pixel of the first image; The details are as follows: ; Wherein, Scp is the RGB weighted deviation corresponding to the pixel of the first image, Rz1 is the R value in the RGB value of the first pixel, Rz2 is the R value in the RGB value of the second pixel, Gz1 is the G value in the RGB value of the first pixel, Gz2 is the G value in the RGB value of the second pixel, Bz1 is the B value in the RGB value of the first pixel, Bz2 is the B value in the RGB value of the second pixel, s1 and s2 are the set weighting coefficients, and s1 and s2 are both greater than 0; It should be noted here that: In a specific implementation, if the experimentally measured RGB value of the first pixel is (22, 34, 43) and the RGB value of the second pixel is (25, 37, 46), then the Scp can be calculated to be 8.5; if the experimentally measured RGB value of the first pixel is (28, 38, 47) and the RGB value of the second pixel is (25, 35, 46), then the Scp can be calculated to be 7.83; if the experimentally measured RGB value of the first pixel is (56, 66, 56) and the RGB value of the second pixel is (59, 43, 46), then the Scp can be calculated to be 44; In the existing human visual system, cones are most sensitive to green light (about 555nm), followed by red light (about 650nm), and blue light (about 450nm) is the weakest. In actual visual perception, the human eye is twice as sensitive to the green channel as the red channel and five times as sensitive to the blue channel. Therefore, green sensitivity = 5×blue sensitivity, red sensitivity = 2.5×blue sensitivity, so the proportional coefficient s1 is 2.5, and the proportional coefficient s2 is 5.
[0024] Obtain the RGB weighted deviation corresponding to each image pixel in the (m, n) comparison image rectangle, and average the obtained multiple RGB weighted deviations to obtain the (m, n) image color deviation; Get the (m,n) image color deviation threshold. If the (m,n) image color deviation is greater than or equal to the image color deviation threshold, then mark the corresponding (m,n) input image rectangle as a color abnormal rectangle. If the (m,n) image color deviation is less than the image color deviation threshold, then mark the corresponding (m,n) input image rectangle as a color normal rectangle. Get the value of the color normal rectangle to get the number of color normal rectangles. It should be noted here that: The image color deviation threshold set here is specifically 2 pixel units. In the process of calculating the RGB weighted deviation, the RGB weighted deviation is obtained by taking the blue channel in the RGB color model as the base conversion unit. In the human visual system, when the blue channel in the RGB color model has a color channel deviation of 20 units, the human eye can perceive obvious color deviation, so the image color deviation threshold is set here to 30.
[0025] Calculate the ratio of the number of color normal rectangles to Tz to obtain the color similarity corresponding to the sample color retrieval image; Repeat the process of obtaining the color similarity corresponding to the sample color retrieval image, and perform color similarity analysis on each image to be retrieved and the user input image to obtain multiple color similarities; Obtain a color similarity reference interval, if the color similarity is within the color similarity reference interval, mark the corresponding image to be retrieved as a color similarity image, if the color similarity is not within the color similarity reference interval, mark the corresponding image to be retrieved as a non-color similarity image, and define the obtained multiple color similarity images as color retrieval image data; It should be noted here that: The color similarity reference interval involved here needs to be obtained based on historical image retrieval data. Select a number of historical retrieval images, obtain the color similarity between each historical retrieval image and the corresponding user input image, and average the obtained multiple color similarities to obtain the historical average similarity. Calculate the standard deviation of the obtained multiple color similarities to obtain the historical similarity standard deviation. Calculate the difference between the historical average similarity and the historical similarity standard deviation to obtain the lower limit of the color similarity reference interval. When the historical retrieval image is the same as the user input image, the corresponding color similarity is 100%, so the upper limit of the color similarity benchmark interval can be 100%, and the value between the lower limit of the color similarity benchmark interval and the upper limit of the color similarity benchmark interval is used as the color similarity benchmark interval; The color similarity images involved here include the to-be-retrieved images whose color similarity is at the boundary of the color similarity reference interval.
[0026] Step S2: performing image pixel depth analysis on the user input image and multiple color-similar images according to the color retrieval image data, marking pixel discontinuities in the user input image and each color-similar image according to the analysis results, and obtaining image marking data; The step S2 further includes the following specific steps: Acquire color retrieval image data, acquire a user input image and a plurality of color-similar images according to the color retrieval image data, and arbitrarily select a sample color-similar image from the acquired plurality of color-similar images; Marking the edge of the target graph on the user input image to obtain an input edge marked image; The details are as follows: Performing image grayscale processing on the user input image to obtain the user input grayscale image, acquiring each pixel point in the user input grayscale image, and arbitrarily selecting a sample pixel point from the acquired multiple pixel points; Analyze the sample pixel points, and obtain the pixel discontinuity index corresponding to the sample pixel points according to the analysis result; The details are as follows: Obtaining the pixel depth value corresponding to the sample pixel point to obtain the sample pixel depth value; In the grayscale image input by the user, pixel points adjacent to the sample pixel point are acquired to obtain a plurality of sample adjacent pixel points, a pixel depth corresponding to each sample adjacent pixel point is numerically acquired to obtain a plurality of adjacent pixel depth values, and an average value of the plurality of adjacent pixel depth values is calculated to obtain an adjacent average pixel depth value; Calculate the difference between the sample pixel depth value and the adjacent average pixel depth value, and take the absolute value of the obtained difference to obtain the adjacent pixel average depth deviation corresponding to the sample pixel point; Calculate the difference between each adjacent pixel depth value and the sample pixel depth value, and take the absolute value of the obtained multiple pixel depth differences to obtain multiple adjacent pixel depth deviations, and arrange the obtained multiple adjacent pixel depth deviations in descending order; If the first-ranked adjacent pixel depth deviations are tied, two first-ranked adjacent pixel depth deviations are selected and marked as the first adjacent pixel depth deviation and the second adjacent pixel depth deviation; if the first-ranked adjacent pixel depth deviations are not tied, the first-ranked adjacent pixel depth deviation is marked as the first adjacent pixel depth deviation, and the second-ranked adjacent pixel depth deviation is marked as the second adjacent pixel depth deviation; The pixel discontinuity index corresponding to the sample pixel is obtained by calculating the average depth deviation of adjacent pixels, the first adjacent pixel depth deviation and the second adjacent pixel depth deviation; The pixel discontinuity index corresponding to the sample pixel is calculated. The specific formula is as follows: ; Wherein, Jdz is the pixel discontinuity index corresponding to the sample pixel, Xsp is the average depth deviation of adjacent pixels, Xp1 is the first adjacent pixel depth deviation, and Xp2 is the second adjacent pixel depth deviation; It should be noted here that: In the present application, the pixel discontinuity index corresponding to the sample pixel point is an indicator value for measuring whether the sample pixel point is a graphic edge contour line. If the sample pixel point is a graphic edge contour line, the sample pixel point and several adjacent pixel points will show a phenomenon of pixel depth interruption. Therefore, the pixel discontinuity index is positively correlated with the average depth deviation of adjacent pixels. Since the graphic edge contour line is not limited to one isolated point, it is connected to at least two adjacent points. Therefore, the pixel discontinuity index is negatively correlated with the average value of the first adjacent pixel depth deviation and the second adjacent pixel depth deviation. Repeat the process of obtaining the pixel discontinuity index corresponding to the sample pixel point, respectively obtain the pixel discontinuity index corresponding to each pixel point, and obtain multiple pixel discontinuity indexes; Obtaining a preset interval of pixel discontinuity index corresponding to each pixel point, if the pixel discontinuity index is not within the preset interval of pixel discontinuity index, marking the sample pixel point as a pixel discontinuity point, and if the pixel discontinuity index is within the preset interval of pixel discontinuity index, marking the sample pixel point as a pixel continuous point; It should be noted here that: The pixel continuous points involved here include the interval boundary corresponding to the preset interval of the pixel discontinuity index; The preset interval of the pixel discontinuity index involved here is specifically set according to the pixel discontinuity index corresponding to the pixel point, and the preset interval of the pixel discontinuity index involved here is specifically between plus or minus 20% of the pixel discontinuity index obtained by the corresponding pixel point; If the pixel discontinuity index corresponding to the existing pixel is 61, the lower limit of the preset interval of the pixel discontinuity index is 61×(1-20%)=48.8, and the upper limit of the preset interval of the pixel discontinuity index is 73.2.
[0027] Mark each pixel discontinuity point in the user input image to obtain a user input marked image; Repeat the process of acquiring the user input marked image, respectively acquire and mark each pixel discontinuity point in each color-similar image, and obtain multiple color-marked images; defining a user input marked image and a plurality of color-similar marked images as image marked data; Step S3: performing image retrieval on the user input tagged image and multiple tagged images with similar colors according to the image tag data, obtaining the best retrieval image corresponding to the user input tagged image according to the retrieval, and outputting it; The step S3 further includes the following specific steps: Acquire image tag data, and acquire a user input tag image and a plurality of color-similar tag images according to the image tag data; Performing image region division on the user input marked image to obtain multiple image closed regions; The details are as follows: Acquire a plurality of pixel discontinuity points marked in the user input marked image to obtain a plurality of pixel discontinuity points; See also Figure 3 , obtain the eight-neighborhood pixel points of each pixel discontinuity point, if there are two or more pixel points as pixel discontinuity pixel points among the eight-neighborhood pixel points of the pixel discontinuity point, then mark the corresponding pixel discontinuity point as a graphic edge pixel point, if there are not two or more pixel points as pixel discontinuity pixel points among the eight-neighborhood pixel points of the pixel discontinuity point, then mark the corresponding pixel discontinuity point as a non-graphic edge pixel point; Connect the edge pixel points of the graphic of the user input mark image to obtain a plurality of graphic edge lines, obtain the closed area surrounded by the graphic edge lines in the user input mark image, obtain a plurality of image closed areas, and name the obtained plurality of image closed areas as F1 image closed area to Fz image closed area respectively; It should be noted here that: In the present application, F referred to herein is a marking symbol corresponding to a closed area of the image, z is a numerical value corresponding to the closed area of the image, and z is an integer greater than 1.
[0028] Repeat the process of dividing the image region for the user input marked image, and divide each color-similar marked image into regions respectively; A sample marked image is randomly selected from the multiple color-similar marked images obtained, the F1 image closed area is covered in the sample marked image, the F1 image closed area of the user input marked image is marked as a first F1 closed area, the F1 image closed area corresponding to the sample marked image is marked as a second F1 closed area, and the overlapping part of the first F1 closed area and the second F1 closed area is marked as an F1 closed overlapping area; Repeat the process of acquiring the F1 closed overlapping area, and acquire the F2 closed overlapping area to the Fz closed overlapping area in the sample marked image respectively; Get the area value of the F1 image closed area to the Fz image closed area in the sample marked image, and get the area value of the F1 closed area to the Fz closed area; Obtain the area value of the closed overlapping area from F1 to Fz in the sample marked image, and obtain the area value of the overlapping area from F1 to Fz; The area similarity ratio of the sample marked image is obtained by calculating the area value of the F1 closed area to the area value of the Fz closed area and the area value of the F1 overlapping area to the area value of the Fz overlapping area; The similarity ratio of the regional graphics corresponding to the sample labeled image is calculated. The specific formula is as follows: ; Among them, Qtx is the regional graphic similarity ratio corresponding to the sample marked image, Mcdi is the area value of the overlapping area of Fi, Mfbi is the area value of the closed area of Fi, and z is the number value corresponding to the closed area of the image; It should be noted here that: In the present application, the overlapping area value of Fi involved here may be any overlapping area value from the overlapping area value of F1 to the overlapping area value of Fz, and the closed area value of Fi involved here may be any closed area value from the closed area value of F1 to the closed area value of Fz; In the specific implementation, there are the following experimental data: The experimental results show that the closed area of F1 is 9.1 cm 2 ,F2 closed area value: 7.5cm 2 ,F3 closed area value: 8.5cm2 ,F1 overlap area value: 3.2cm 2 ,F2 overlap area value: 2.2cm 2 ,F2 overlap area value: 3.6cm 2 ; The calculated regional graphic similarity ratio is 0.356.
[0029] Repeat the process of obtaining the regional graphic similarity ratio corresponding to the sample marked image, obtain the regional graphic similarity ratio corresponding to each color similarity marked image respectively, obtain multiple regional graphic similarity ratios, compare the numerical values of the multiple regional graphic similarity ratios obtained, mark the color similarity marked image corresponding to the maximum regional graphic similarity ratio as the best retrieval image, and output the best retrieval image.
[0030] It should be noted here that: In the present application, if the maximum regional graphic similarity ratios are tied, a plurality of optimal search images are output.
[0031] In this application, if corresponding calculation formulas appear, the above calculation formulas are all dimensionless and take their numerical calculations. The weight coefficients, weighting coefficients and other coefficients in the formulas are set to a result value obtained by quantifying each parameter. The size of the weight coefficients and weighting coefficients is sufficient as long as it does not affect the proportional relationship between the parameters and the result values.
[0032] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A method for rapid image retrieval based on similarity, characterized in that: include: Step S1: obtaining a user input image and a plurality of images to be retrieved, extracting and analyzing color features of the user input image and each image to be retrieved respectively, evaluating the color similarity between each image to be retrieved and the user input image according to the analysis results, and obtaining color retrieval image data according to the evaluation results; Step S2: performing image pixel depth analysis on the user input image and multiple color-similar images according to the color retrieval image data, marking pixel discontinuities in the user input image and each color-similar image according to the analysis results, and obtaining image marking data; Step S3: performing image retrieval on the user-input tagged image and multiple tagged images with similar colors according to the image tag data, obtaining the best retrieval image corresponding to the user-input tagged image according to the retrieval, and outputting it.
2. The method for rapid image retrieval based on similarity according to claim 1, characterized in that: The step S1 further includes the following specific steps: Step S11: obtaining a user input image through the user interface, performing content consistency comparison between each image in the search database and the user input image, obtaining images with consistent content, and obtaining multiple images to be searched; Step S12: Compare the image size consistency of each image to be retrieved with the image input by the user, adjust the image size according to the comparison result, and randomly select a sample color retrieval image; Step S13: performing color similarity analysis on the user input image and the sample color retrieval image, and obtaining the color similarity corresponding to the sample color retrieval image according to the analysis result; Step S14: performing color similarity analysis on each image to be retrieved and the image input by the user to obtain multiple color similarities; Step S15: Obtain a color similarity benchmark interval. If the color similarity is within the color similarity benchmark interval, the corresponding image to be retrieved is marked as a color similarity image. If the color similarity is not within the color similarity benchmark interval, the corresponding image to be retrieved is marked as a non-color similarity image. The multiple color similarity images obtained are defined as color retrieval image data.
3. The method for rapid image retrieval based on similarity according to claim 2, characterized in that: The step S13 further includes the following specific steps: Step S131: converting the user input image and the sample color retrieval image into a preset comparison image resolution; Step S132: creating an image comparison coordinate system in the user input image; Step S133: Divide the user input image coverage area in the image comparison coordinate system into Tz image rectangles, obtain the diagonal intersection points corresponding to each image rectangle, obtain multiple image rectangle midpoints, and use the rectangle midpoint coordinate values to name the image rectangles, and obtain multiple (m, n) input image rectangles; Step S134: aligning the lower left vertex of the sample color retrieval image with the coordinate origin of the image comparison coordinate system, and using the image rectangle to divide the sample color retrieval image into a plurality of image rectangles to obtain a plurality of (m, n) comparison image rectangles; Step S135: Perform color analysis on the (m, n) input image rectangle, and obtain the number of rectangles with normal colors according to the analysis result; Step S136: Calculate the ratio of the number of color normal rectangles to Tz to obtain the color similarity corresponding to the sample color retrieval image.
4. The method for rapid image retrieval based on similarity according to claim 3, characterized in that: The step S135 further includes the following specific steps: A first image pixel point is selected from the (m, n) input image rectangle, and an image pixel point having the same coordinates as the first image pixel point is acquired in the (m, n) comparison image rectangle to obtain a second image pixel point; Obtain the color RGB value of the first image pixel in the RGB color model, obtain the RGB value of the first pixel, and obtain the RGB value of the second pixel; The RGB value of the first pixel (Rz1, Gz1, Bz1) and the RGB value of the second pixel (Rz2, Gz2, Bz2) are calculated to obtain the RGB weighted deviation Scp corresponding to the pixel of the first image: ; Among them, s1 and s2 are set weighting coefficients, and both s1 and s2 are greater than 0; Obtain the RGB weighted deviation corresponding to each image pixel in the (m, n) comparison image rectangle, and average the obtained multiple RGB weighted deviations to obtain the (m, n) image color deviation; Get the (m,n) image color deviation threshold. If the (m,n) image color deviation is greater than or equal to the image color deviation threshold, mark the corresponding (m,n) input image rectangle as a color abnormal rectangle. If the (m,n) image color deviation is less than the image color deviation threshold, mark the corresponding (m,n) input image rectangle as a color normal rectangle, and obtain the numerical value of the color normal rectangle to obtain the number of color normal rectangles.
5. The method for rapid image retrieval based on similarity according to claim 1, characterized in that: The step S2 further includes the following specific steps: Step S21: acquiring color retrieval image data, acquiring a user input image and a plurality of color-similar images according to the color retrieval image data, and arbitrarily selecting a sample color-similar image from the acquired plurality of color-similar images; Step S22: marking the edge of the target graphic on the user input image to obtain an input edge marked image; Step S23: acquiring and marking each pixel discontinuity point in each color-similar image to obtain a plurality of color-marked images; Step S24: defining the user input tag image and a plurality of tag images with similar colors as image tag data.
6. The method for rapid image retrieval based on similarity according to claim 5, characterized in that: The step S22 further includes the following specific steps: Step S221: grayscale the user input image to obtain a user input grayscale image, and select a sample pixel point from a plurality of pixel points in the user input grayscale image; Step S222: analyzing the sample pixel points, and acquiring the pixel discontinuity index corresponding to the sample pixel points according to the analysis result; Step S223: acquiring the pixel discontinuity index corresponding to each pixel to obtain a plurality of pixel discontinuity indexes; Step S224: obtaining a preset interval of pixel discontinuity index corresponding to each pixel point, and if the pixel discontinuity index is not within the preset interval of pixel discontinuity index, marking the sample pixel point as a pixel discontinuity point; if the pixel discontinuity index is within the preset interval of pixel discontinuity index, marking the sample pixel point as a pixel continuous point; Step S225: Mark each pixel discontinuity point in the user input image to obtain a user input marked image.
7. The method for rapid image retrieval based on similarity according to claim 6, characterized in that: The step S222 further includes the following specific steps: Obtaining the pixel depth value corresponding to the sample pixel point to obtain the sample pixel depth value; In the grayscale image input by the user, pixel points adjacent to the sample pixel point are acquired to obtain a plurality of sample adjacent pixel points, a pixel depth corresponding to each sample adjacent pixel point is numerically acquired to obtain a plurality of adjacent pixel depth values, and an average value of the plurality of adjacent pixel depth values is calculated to obtain an adjacent average pixel depth value; Calculate the difference between the sample pixel depth value and the adjacent average pixel depth value, and take the absolute value of the obtained difference to obtain the adjacent pixel average depth deviation corresponding to the sample pixel point; Calculate the difference between each adjacent pixel depth value and the sample pixel depth value, and take the absolute value of the obtained multiple pixel depth differences to obtain multiple adjacent pixel depth deviations, and arrange the obtained multiple adjacent pixel depth deviations in descending order; If the first-ranked adjacent pixel depth deviations are tied, two first-ranked adjacent pixel depth deviations are selected and marked as the first adjacent pixel depth deviation and the second adjacent pixel depth deviation; if the first-ranked adjacent pixel depth deviations are not tied, the first-ranked adjacent pixel depth deviation is marked as the first adjacent pixel depth deviation, and the second-ranked adjacent pixel depth deviation is marked as the second adjacent pixel depth deviation; The pixel discontinuity index Jdz corresponding to the sample pixel is obtained. The specific formula is as follows: ; Wherein, Xsp is the average depth deviation of adjacent pixels, Xp1 is the depth deviation of the first adjacent pixel, and Xp2 is the depth deviation of the second adjacent pixel.
8. The method for rapid image retrieval based on similarity according to claim 1, characterized in that: The step S3 further includes the following specific steps: Step S31: acquiring image tag data, and acquiring a user input tag image and a plurality of color-similar tag images according to the image tag data; Step S32: dividing the user input marked image and each color-similar marked image into regions to obtain a plurality of image closed regions; Step S33: randomly selecting a sample marked image from the multiple color-similar marked images obtained, performing regional area analysis on the sample marked image, and obtaining a regional graphic similarity ratio corresponding to the sample marked image according to the analysis result; Step S34: respectively obtain the regional graphic similarity ratio corresponding to each color-similar marked image to obtain multiple regional graphic similarity ratios, compare the numerical values of the obtained multiple regional graphic similarity ratios, mark the color-similar marked image corresponding to the maximum regional graphic similarity ratio as the best retrieval image, and output the best retrieval image.
9. The method for rapid image retrieval based on similarity according to claim 8, characterized in that: The step S32 further includes the following specific steps: Acquire a plurality of pixel discontinuity points marked in the user input marked image to obtain a plurality of pixel discontinuity points; The eight-neighborhood pixel points of each pixel discontinuity point are obtained. If two or more pixel points among the eight-neighborhood pixel points of the pixel discontinuity point are pixel discontinuity pixel points, the corresponding pixel discontinuity point is marked as a graphic edge pixel point. If two or more pixel points among the eight-neighborhood pixel points of the pixel discontinuity point are not pixel discontinuity pixel points, the corresponding pixel discontinuity point is marked as a non-graphic edge pixel point. The graphic edge pixel points of the user input mark image are connected to obtain a number of graphic edge lines, and the closed areas surrounded by the graphic edge lines are obtained to obtain a plurality of image closed areas, and the obtained plurality of image closed areas are named F1 image closed area to Fz image closed area.
10. The method for rapid image retrieval based on similarity according to claim 8, characterized in that: The step S33 further includes the following specific steps: Overlay the F1 image closed area in the sample marked image, mark the F1 image closed area of the user input marked image as the first F1 closed area, mark the F1 image closed area corresponding to the sample marked image as the second F1 closed area, and mark the overlapping part of the first F1 closed area and the second F1 closed area as the F1 closed overlapping area; Acquire the F2 closed overlapping area to the Fz closed overlapping area in the sample marked image respectively; Get the area value of the F1 image closed area to the Fz image closed area in the sample marked image, and get the area value of the F1 closed area to the Fz closed area; Obtain the area value of the closed overlapping area from F1 to Fz in the sample marked image, and obtain the area value of the overlapping area from F1 to Fz; The area similarity ratio of the sample marked image is obtained by calculating the area value of the F1 closed area to the area value of the Fz closed area and the area value of the F1 overlapping area to the area value of the Fz overlapping area; The similarity ratio of the regional graphics corresponding to the sample labeled image is calculated. The specific formula is as follows: ; Among them, Qtx is the regional graphic similarity ratio corresponding to the sample marked image, Mcdi is the area value of the Fi overlapping area, Mfbi is the area value of the Fi closed area, and z is the quantity value corresponding to the closed area of the image.
Citation Information
Patent Citations
Color image searching method based on multiple features
CN104484425A
Image retrieval method
CN104809245A
Image similarity judgment method, electronic equipment and storage medium
CN109948653A
Depth image up-sampling method and system based on depth edge points and color image
CN111489383A
Image similarity determination method and device, equipment and storage medium
CN114202665A