CN113127670A - Method, device, storage medium and processor for searching target color - Google Patents

Method, device, storage medium and processor for searching target color Download PDF

Info

Publication number
CN113127670A
CN113127670A CN201911425488.1A CN201911425488A CN113127670A CN 113127670 A CN113127670 A CN 113127670A CN 201911425488 A CN201911425488 A CN 201911425488A CN 113127670 A CN113127670 A CN 113127670A
Authority
CN
China
Prior art keywords
color
image
target object
target
vector
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
CN201911425488.1A
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.)
Flybook Digital Technology Shanghai Co ltd
Original Assignee
Flybook Digital Technology Shanghai 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 Flybook Digital Technology Shanghai Co ltd filed Critical Flybook Digital Technology Shanghai Co ltd
Priority to CN201911425488.1A priority Critical patent/CN113127670A/en
Publication of CN113127670A publication Critical patent/CN113127670A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • G06F16/5838Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content using colour
    • 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)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Image Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a device, a storage medium and a processor for searching target colors. The method comprises the following steps: identifying whether a target object is included in images in an image library, wherein the image library comprises a plurality of images; acquiring the color of a target object in an image under the condition that the target object is included in the image; acquiring a cosine value and/or a sine value of an included angle between a first vector and a second vector, wherein the first vector is a vector of a target color, and the second vector is a vector of a color of a target object in an image; whether the color of the target object in the image is similar to the target color is determined at least according to the cosine value and/or the sine value. And identifying whether the image in the image library comprises a target object, if so, acquiring the color of the target object, determining the cosine value and/or sine value of an included angle between the color vector of the target object and the color vector of the target object, and determining whether the color of the target object in the image is similar to the color of the target object, thereby realizing accurate search for acquiring the image of the target object with a certain color.

Description

Method, device, storage medium and processor for searching target color
Technical Field
The present application relates to the field of image processing, and in particular, to a method, an apparatus, a storage medium, and a processor for searching for a target color.
Background
In the existing search engine, a user needs to find a target color α, and has a picture set, knowing the main color of each picture (calculated from the area ratio of the color in the picture), α is used for vector comparison with each picture, and the closer rows are the farther forward, thereby achieving the purpose of 'searching α and finding pictures close to α'.
When applied to a particular scene, the user searches for an object or concept while specifying a color. Such as green and birds, the user may want to find a map with green birds, and with the prior art search engine described above, the search results are a map with green birds instead of a map with green birds. Therefore, the search scheme adopted by the search engine is not suitable for the case of searching for objects and colors at the same time.
The above information disclosed in this background section is only for enhancement of understanding of the background of the technology described herein and, therefore, certain information may be included in the background that does not form the prior art that is already known in this country to a person of ordinary skill in the art.
Disclosure of Invention
The present application mainly aims to provide a method, an apparatus, a storage medium, and a processor for searching for a target color, so as to solve the problem in the prior art that there is no method suitable for searching for an object and a color at the same time.
In order to achieve the above object, according to one aspect of the present application, there is provided a method of target color search, the method including: identifying whether a target object is included in an image library, the image library including a plurality of the images; acquiring the color of the target object in the image under the condition that the target object is included in the image; acquiring a cosine value and/or a sine value of an included angle between a first vector and a second vector, wherein the first vector is a vector of a target color, and the second vector is a vector of the color of the target object in the image; determining whether a color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value.
Further, obtaining a cosine value and/or a sine value of an included angle between the first vector and the second vector comprises: respectively converting the target color and the color of the target object in the image into a hexagonal pyramid model; determining the first vector and the second vector according to the corresponding hexagonal pyramid model; and calculating the cosine value and/or the sine value.
Further, determining whether a color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value comprises: determining that the color of the target object in the image is similar to the target color if the cosine value is 1; determining that the color of the target object in the image is dissimilar to the target color if the cosine value is 0.
Further, determining whether a color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value comprises: determining that the color of the target object in the image is similar to the target color if the sine value is 0; in a case where the sine value is 1, it is determined that the color of the target object in the image is not similar to the target color.
Further, before determining whether the color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value, the method further comprises: acquiring the proportion of the area of the target object in the image to the area of the image, and determining whether the color of the target object in the image is similar to the target color according to at least the cosine value and/or the sine value, wherein the determining comprises the following steps: and determining whether the color of the target object in the image is similar to the target color according to the specific gravity of the area and the cosine value.
Further, the determining whether the color of the target object in the image is similar to the target color according to the specific gravity of the area and the cosine value includes: calculating the similarity by using a formula S ═ cos (alpha) × log (beta × m), wherein S represents the similarity, alpha represents an included angle between a target color and each color of the target object, beta represents the specific gravity, and m is a constant; determining that the color of the target object in the image is similar to the target color if the similarity is greater than or equal to a predetermined value; determining that the color of the target object in the image is not similar to the target color if the similarity is less than a predetermined value.
According to another aspect of the present application, there is provided an apparatus for object color search, the apparatus including: an identifying unit configured to identify whether a target object is included in images in an image library including a plurality of the images; a first acquisition unit configured to acquire a color of the target object in the image in a case where the target object is included in the image; a second obtaining unit, configured to obtain a cosine value and/or a sine value of an included angle between a first vector and a second vector, where the first vector is a vector of a target color, and the second vector is a vector of a color of the target object in the image; a first determination unit configured to determine whether a color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value.
Further, the second obtaining unit includes: the conversion module is used for respectively converting the target color and the color of the target object in the image into a hexagonal pyramid model; the determining module is used for determining the first vector and the second vector according to the corresponding hexagonal pyramid model; a calculation module for calculating the cosine value and/or the sine value.
According to another aspect of the application, there is provided a storage medium comprising a stored program, wherein the program performs any of the methods described herein.
According to another aspect of the application, there is provided another processor for executing a program, wherein the program executes to perform any one of the methods.
According to the technical scheme, firstly, whether a target object is included in an image library is identified, the image library includes a plurality of images, then, when the target object is included in the image, the color of the target object in the image is obtained, secondly, a cosine value and/or a sine value of an included angle between a first vector and a second vector are obtained, the first vector is a vector of a target color, the second vector is a vector of the color of the target object in the image, and finally, whether the color of the target object in the image is similar to the target color is determined at least according to the cosine value and/or the sine value. Firstly, whether a target object is included in an image library or not is identified, then, in the case that the target object is included in the image, the color of the target object is obtained, and then, whether the color of the target object in the image is similar to the color of the target object or not is determined at least by determining the cosine value and/or sine value of an included angle between a vector of the target color and a vector of the color of the target object, finally, accurate searching for obtaining an image of the target object with a certain color, such as an image of a bird with green color, is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
FIG. 1 illustrates a flow diagram of a method of target color search according to an embodiment of the present application; and
fig. 2 shows a schematic diagram of an apparatus for object color search according to an embodiment of the application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It will be understood that when an element such as a layer, film, region, or substrate is referred to as being "on" another element, it can be directly on the other element or intervening elements may also be present. Also, in the specification and claims, when an element is described as being "connected" to another element, the element may be "directly connected" to the other element or "connected" to the other element through a third element.
For convenience of description, some terms or expressions referred to in the embodiments of the present application are explained below:
HSV: the hexagonal pyramid model (Hue, Value) is a color space created according to the intuitive characteristics of colors, the parameters of the colors in the model include Hue (H), Saturation (S) and lightness (V), the Hue is measured by angle, the Value range is 0-360 degrees, the calculation is started from red according to the counterclockwise direction, the red is 0 degree, the green is 120 degrees, and the blue is 240 degrees; the saturation degree represents the degree to which the color approaches the spectral color; lightness represents the degree to which a color is bright.
As described in the background section, in the prior art, when a user wants to search for a colored object, the user searches for the object and the color, but the search result is not the result intended by the user, and to solve the problem of the prior art that the user lacks a method for searching for a colored object, an exemplary embodiment of the present application provides a method, an apparatus, a storage medium and a processor for searching for a target color.
According to an embodiment of the present application, a method of target color search is provided. Fig. 1 is a flowchart of a method of target color search according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S101, identifying whether an image in an image library comprises a target object or not, wherein the image library comprises a plurality of images;
step S102, acquiring the color of the target object in the image under the condition that the target object is included in the image;
step S103, acquiring a cosine value and/or a sine value of an included angle between a first vector and a second vector, wherein the first vector is a vector of a target color, and the second vector is a vector of the color of the target object in the image;
and step S104, determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value.
In the above aspect, first, it is recognized whether or not an object is included in an image library including a plurality of images, then, in a case where the object is included in the image, a color of the object in the image is acquired, then, a cosine value and/or a sine value of an angle between a first vector and a second vector is acquired, the first vector being a vector of a target color, the second vector being a vector of a color of the object in the image, and finally, whether or not the color of the object in the image is similar to the target color is determined based on at least the cosine value and/or the sine value. Firstly, whether a target object is included in an image library or not is identified, then, in the case that the target object is included in the image, the color of the target object is obtained, and then, whether the color of the target object in the image is similar to the color of the target object or not is determined at least by determining the cosine value and/or sine value of an included angle between a vector of the target color and a vector of the color of the target object, finally, accurate searching for obtaining an image of the target object with a certain color, such as an image of a bird with green color, is achieved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
In an embodiment of the present application, obtaining a cosine value and/or a sine value of an included angle between a first vector and a second vector includes: converting the target color and the color of the target object in the image into a hexagonal pyramid model respectively; determining the first vector and the second vector according to the corresponding hexagonal pyramid model; and calculating the cosine value and/or the sine value. For example, the target color α to be searched has three graphs A, B, C, and their colors are:
a is area dominant color A1, body color A2;
b is area dominant color B1, body color B2;
c, area dominant color C1, and body color C2.
RGB values are commonly used in computers to describe colors, such as red (255, 0, 0), black (255, 255, 255), yellow (255, 245, 0), however, because the numerical values of different colors of RGB are not in linear relationship, it is difficult to measure the similarity of two colors by the numerical value, so that RGB is converted into HSV for comparison, namely Hue, Saturation, Value lightness, treating the HSV of a color as a vector, the target color is a first vector, the target color in the image is a second vector, the cosine value and/or the sine value, that is, the cosine and/or the sine of the vector angle, are calculated, and then the similarity between the color of the target object in the image and the target color can be measured according to the comparison cosine and/or the sine, so as to compare the similarity of the colors, for example, the calculation formula of the cosine value is as follows.
A={x1,x2,x3...xn} B={y1,y2,y3...yn}
Figure BDA0002353462390000051
In an embodiment of the application, determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value includes: determining that the color of the target object in the image is similar to the target color if the cosine value is 1; and determining that the color of the target object in the image is not similar to the target color when the cosine value is 0. That is, if the angle between the two vectors is small, the cos value is close to 1, indicating that they are similar, and if the angle is 0 degrees, the cos value is 1, then it is determined that they are similar, and if the angle between the two vectors is 90 degrees, the cos value is 0, indicating that they are not similar, so that it can be determined whether the color of the target object in the image is similar to the target color according to the cosine value.
In an embodiment of the application, determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value includes: determining that the color of the target object in the image is similar to the target color if the sine value is 0; in a case where the sine value is 1, it is determined that the color of the target object in the image is not similar to the target color. That is, if the angle between the two vectors is large, the sin value is close to 1, indicating that they are similar, if the angle is 180 degrees, the sin value is 0, then it is determined that they are similar, if the angle between the two vectors is 90 degrees, the sin value is 0, indicating that they are not similar, and thus it can be determined whether the color of the target object in the image is similar to the target color according to the sine value.
Of course, the determining whether the color of the target object in the image is similar to the target color is not limited to the above method, and may be any other suitable method, and in an embodiment of the present application, before determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value, the method further includes: acquiring a proportion of an area of the target object in the image to an area of the image, and determining whether a color of the target object in the image is similar to the target color according to at least the cosine value and/or the sine value, including: and determining whether the color of the target object in the image is similar to the target color according to the proportion of the area and the cosine value. Thus, for example, in some pictures, the area occupied by the bird is extremely small, and only 1/15 or 1/20 of the picture, other objects in the picture, such as flowers, whose color is pink, other flowers of various colors, colored art words, purple and yellow containers, and brown borders, and the background color of the picture is purple, in such pictures, although there are birds, the importance in the picture is too low, so that the picture may not actually meet the result desired by the user, so we need to consider the importance (area) of the found object color in the whole picture, and determine whether the color of the object in the picture is similar to the target color according to the importance in the picture and the cosine value, so as to find the object with color required by the user, and the specific gravity of the target object in the image is relatively large.
In still another embodiment of the present application, the determining whether the color of the target object in the image is similar to the target color according to the area specific gravity and the cosine value includes: calculating a similarity by using a formula S ═ cos (α) × log (β × m), where S denotes the similarity, α denotes an angle between a target color and a color of each of the target objects, β denotes the specific gravity, and m is a constant; determining that the color of the target object in the image is similar to the target color when the similarity is greater than or equal to a predetermined value; and determining that the color of the target object in the image is not similar to the target color when the similarity is smaller than a predetermined value. The area is also calculated, but a relatively small weight is given to influence the final score, the similarity can be calculated according to a formula, S is cos (α) × log (β × m), m can be a constant, determined according to actual conditions, can be 100, or can be other constants, and finally the degree of similarity between the picture and the target color α is judged according to the size of the comparison S, so that the object picture of the color required by the user can be found more accurately.
In an embodiment of the application, in the case that the object in each of the images has multiple colors, the method further includes comparing the multiple colors in the object with the target color, respectively, determining a cosine value of an included angle between the multiple colors and the target color according to a comparison result, and determining a similarity between the color of each of the objects and the target color according to a magnitude of the cosine value. If there is usually more than one color in the picture and the object has more than one color, then comparing the colors in the object with the target color, determining cosine values of included angles between the colors and the target color, and determining similarity according to the size of the cosine values, such as 1 or 0.
The embodiment of the present application further provides an apparatus for searching a target color, and it should be noted that the apparatus for searching a target color of the embodiment of the present application may be used to execute the method for searching a target color provided by the embodiment of the present application. The following describes an apparatus for searching for a target color according to an embodiment of the present application.
Fig. 2 is a schematic diagram of an apparatus for target color search according to an embodiment of the present application. As shown in fig. 2, the apparatus includes:
an identifying unit 10 configured to identify whether a target object is included in images in an image library, the image library including a plurality of the images;
a first acquiring unit 20 configured to acquire a color of the target object in the image when the target object is included in the image;
a second obtaining unit 30, configured to obtain a cosine value and/or a sine value of an included angle between a first vector and a second vector, where the first vector is a vector of a target color, and the second vector is a vector of a color of the target object in the image;
a first determining unit 40, configured to determine whether a color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value.
In the above apparatus, the identifying unit identifies whether or not a target object is included in images in an image library including a plurality of the images, the first acquiring unit acquires a color of the target object in the images in a case where the target object is included in the images, the second acquiring unit acquires a cosine value and/or a sine value of an angle between a first vector and a second vector, the first vector being a vector of a target color, the second vector being a vector of a color of the target object in the images, and the first determining unit determines whether or not the color of the target object in the images is similar to the target color based on at least the cosine value and/or the sine value. Firstly, whether a target object is included in the images in the image library is identified, then, in the case that the target object is included in the images, the color of the target object is obtained, and then, whether the color of the target object in the images is similar to the color of the target object is determined at least by determining the cosine value and/or sine value of the included angle between the vector of the target color and the vector of the color of the target object, finally, accurate search for obtaining the image of the target object with a certain color, such as the image of a green bird, is realized. The method solves the problem that the prior art is lack of a method suitable for searching colored objects.
In an embodiment of the application, the second obtaining unit includes a converting module, a first determining module and a calculating module, the converting module is configured to convert the target color and the color of the target object in the image into a hexagonal pyramid model respectively, the determining first module is configured to determine the first vector and the second vector according to the corresponding hexagonal pyramid model, and the calculating module is configured to calculate the cosine value and/or the sine value. For example, the target color α to be searched has three graphs A, B, C, and their colors are:
a is area dominant color A1, body color A2;
b is area dominant color B1, body color B2;
c, area dominant color C1, body color C2;
RGB values are commonly used in computers to describe colors, such as red (255, 0, 0), black (255, 255, 255), yellow (255, 245, 0), however, because the numerical values of different colors of RGB are not in linear relationship, it is difficult to measure the similarity of two colors by the numerical value, so that RGB is converted into HSV for comparison, namely Hue, Saturation, Value lightness, treating the HSV of a color as a vector, the target color is a first vector, the target color in the image is a second vector, the cosine value and/or the sine value, that is, the cosine and/or the sine of the vector angle, are calculated, and then the similarity between the color of the target object in the image and the target color can be measured according to the comparison cosine and/or the sine, so as to compare the similarity of the colors, for example, the calculation formula of the cosine value is as follows.
A={x1,x2,x3...xn} B={y1,y2,y3...yn}
Figure BDA0002353462390000071
In an embodiment of the present application, the first determining unit includes a second determining module configured to determine that the color of the target object in the image is similar to the target color if the cosine value is 1, and a third determining module configured to determine that the color of the target object in the image is not similar to the target color if the cosine value is 0. That is, if the angle between the two vectors is small, the cos value is close to 1, indicating that they are similar, and if the angle is 0 degrees, the cos value is 1, then it is determined that they are similar, and if the angle between the two vectors is 90 degrees, the cos value is 0, indicating that they are not similar, so that it can be determined whether the color of the target object in the image is similar to the target color according to the cosine value.
In an embodiment of the present application, the first determining unit includes a fourth determining module and a fifth determining module, the fourth determining module is configured to determine that the color of the target object in the image is similar to the target color if the sine value is 0, and the fifth determining module is configured to determine that the color of the target object in the image is not similar to the target color if the sine value is 1. That is, if the angle between the two vectors is large, the sin value is close to 1, indicating that they are similar, if the angle is 180 degrees, the sin value is 0, then it is determined that they are similar, if the angle between the two vectors is 90 degrees, the sin value is 0, indicating that they are not similar, and thus it can be determined whether the color of the target object in the image is similar to the target color according to the sine value.
Of course, the determining whether the color of the target object in the image is similar to the target color is not limited to the above method, and may be any other suitable method, in an embodiment of the present application, the apparatus further includes a third obtaining unit, the first determining unit further includes a sixth determining module, the third obtaining unit is configured to obtain a proportion of an area of the target object in the image to an area of the image before determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value, and the sixth determining module is configured to determine whether the color of the target object in the image is similar to the target color according to the proportion of the area and the cosine value. Thus, for example, in some pictures, the area occupied by the bird is extremely small, and only 1/15 or 1/20 of the picture, other objects in the picture, such as flowers, whose color is pink, other flowers of various colors, colored art words, purple and yellow containers, and brown borders, and the background color of the picture is purple, in such pictures, although there are birds, the importance in the picture is too low, so that the picture may not actually meet the result desired by the user, so we need to consider the importance (area) of the found object color in the whole picture, and determine whether the color of the object in the picture is similar to the target color according to the importance in the picture and the cosine value, so as to find the object with color required by the user, and the specific gravity of the target object in the image is relatively large.
In an embodiment of the application, the sixth determining submodule further includes a calculating submodule, and the first determining submodule and the second determining submodule are configured to calculate a similarity using a formula S ═ cos (α) × log (β × m), where S denotes the similarity, α denotes an angle between a target color and a color of each of the target objects, β denotes the specific gravity, and m is a constant, the first determining submodule is configured to determine that the color of the target object in the image is similar to the target color if the similarity is greater than or equal to a predetermined value, and the second determining submodule is configured to determine that the color of the target object in the image is not similar to the target color if the similarity is less than the predetermined value. The area is also calculated, but a relatively small weight is given to influence the final score, the similarity can be calculated according to a formula, S is cos (α) × log (β × m), m can be a constant, determined according to actual conditions, can be 100, or can be other constants, and finally the degree of similarity between the picture and the target color α is judged according to the size of the comparison S, so that the object picture of the color required by the user can be found more accurately.
In an embodiment of the application, the apparatus further includes a comparing unit, a second determining unit, and a third determining unit, where the comparing unit is configured to compare a plurality of colors of the object with the target color, respectively, when the object in each of the images has the plurality of colors, the second determining unit is configured to determine a cosine value of an included angle between the plurality of colors and the target color according to a comparison result, and the third determining unit is configured to determine a similarity between the color of each of the objects and the target color according to a magnitude of the cosine value. If there is usually more than one color in the picture and the object has more than one color, then comparing the colors in the object with the target color, determining cosine values of included angles between the colors and the target color, and determining similarity according to the size of the cosine values, such as 1 or 0.
The device for searching the target color comprises a processor and a memory, wherein the identification unit, the first acquisition unit, the second acquisition unit, the first determination unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the object and the color can be searched simultaneously by adjusting the parameters of the kernel.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium having a program stored thereon, which when executed by a processor, implements the above-described method of target color search.
The embodiment of the invention provides a processor, which is used for running a program, wherein the method for searching the target color is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein when the processor executes the program, at least the following steps are realized:
step S101, identifying whether an image in an image library comprises a target object or not, wherein the image library comprises a plurality of images;
step S102, acquiring the color of the target object in the image under the condition that the target object is included in the image;
step S103, acquiring a cosine value and/or a sine value of an included angle between a first vector and a second vector, wherein the first vector is a vector of a target color, and the second vector is a vector of the color of the target object in the image;
and step S104, determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program of initializing at least the following method steps when executed on a data processing device:
step S101, identifying whether an image in an image library comprises a target object or not, wherein the image library comprises a plurality of images;
step S102, acquiring the color of the target object in the image under the condition that the target object is included in the image;
step S103, acquiring a cosine value and/or a sine value of an included angle between a first vector and a second vector, wherein the first vector is a vector of a target color, and the second vector is a vector of the color of the target object in the image;
and step S104, determining whether the color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. 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 apparatus that comprises the element. From the above description, it can be seen that the above-described embodiments of the present application achieve the following technical effects:
1) the method for searching for a target color of the present application includes, first, identifying whether a target object is included in an image library, the image library including a plurality of images, then, acquiring a color of the target object in the image if the target object is included in the image, then, acquiring a cosine value and/or a sine value of an angle between a first vector and a second vector, the first vector being a vector of a target color, the second vector being a vector of a color of the target object in the image, and finally, determining whether the color of the target object in the image is similar to the target color based on at least the cosine value and/or the sine value. Firstly, whether a target object is included in an image library or not is identified, then, in the case that the target object is included in the image, the color of the target object is obtained, and then, whether the color of the target object in the image is similar to the color of the target object or not is determined at least by determining the cosine value and/or sine value of an included angle between a vector of the target color and a vector of the color of the target object, finally, accurate searching for obtaining an image of the target object with a certain color, such as an image of a bird with green color, is achieved.
2) The object color searching device of the present application, wherein the identifying unit identifies whether or not an object is included in an image library, the image library includes a plurality of images, the first acquiring unit acquires a color of the object in the image when the object is included in the image, the second acquiring unit acquires a cosine value and/or a sine value of an angle between a first vector and a second vector, the first vector is a vector of an object color, the second vector is a vector of a color of the object in the image, and the first determining unit determines whether or not the color of the object in the image is similar to the object color based on at least the cosine value and/or the sine value. Firstly, whether a target object is included in the images in the image library is identified, then, in the case that the target object is included in the images, the color of the target object is obtained, and then, whether the color of the target object in the images is similar to the color of the target object is determined at least by determining the cosine value and/or sine value of the included angle between the vector of the target color and the vector of the color of the target object, finally, accurate search for obtaining the image of the target object with a certain color, such as the image of a green bird, is realized. The method solves the problem that the prior art is lack of a method suitable for searching colored objects.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A method of target color search, comprising:
identifying whether a target object is included in an image library, the image library including a plurality of the images;
acquiring the color of the target object in the image under the condition that the target object is included in the image;
acquiring a cosine value and/or a sine value of an included angle between a first vector and a second vector, wherein the first vector is a vector of a target color, and the second vector is a vector of the color of the target object in the image;
determining whether a color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value.
2. The method of claim 1, wherein obtaining cosine and/or sine values of an angle between the first vector and the second vector comprises:
respectively converting the target color and the color of the target object in the image into a hexagonal pyramid model;
determining the first vector and the second vector according to the corresponding hexagonal pyramid model;
calculating the cosine value and/or the sine value.
3. The method of claim 1, wherein determining whether the color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value comprises:
determining that the color of the target object in the image is similar to the target color if the cosine value is 1;
determining that the color of the target object in the image is dissimilar to the target color if the cosine value is 0.
4. The method of claim 1, wherein determining whether the color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value comprises:
determining that the color of the target object in the image is similar to the target color if the sine value is 0;
in a case where the sine value is 1, it is determined that the color of the target object in the image is not similar to the target color.
5. The method of claim 1,
before determining whether the color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value, the method further comprises:
acquiring the proportion of the area of the target object in the image to the area of the image,
determining whether a color of the target object in the image is similar to the target color based at least on the cosine value and/or the sine value, including:
and determining whether the color of the target object in the image is similar to the target color according to the specific gravity of the area and the cosine value.
6. The method of claim 5, wherein determining whether the color of the target object in the image is similar to the target color based on the area specific gravity and the cosine value comprises:
calculating the similarity by using a formula S ═ cos (alpha) × log (beta × m), wherein S represents the similarity, alpha represents an included angle between a target color and each color of the target object, beta represents the specific gravity, and m is a constant;
determining that the color of the target object in the image is similar to the target color if the similarity is greater than or equal to a predetermined value;
determining that the color of the target object in the image is not similar to the target color if the similarity is less than a predetermined value.
7. An apparatus for object color search, comprising:
an identifying unit configured to identify whether a target object is included in images in an image library including a plurality of the images;
a first acquisition unit configured to acquire a color of the target object in the image in a case where the target object is included in the image;
a second obtaining unit, configured to obtain a cosine value and/or a sine value of an included angle between a first vector and a second vector, where the first vector is a vector of a target color, and the second vector is a vector of a color of the target object in the image;
a first determination unit configured to determine whether a color of the target object in the image is similar to the target color at least according to the cosine value and/or the sine value.
8. The apparatus of claim 7, wherein the second obtaining unit comprises:
the conversion module is used for respectively converting the target color and the color of the target object in the image into a hexagonal pyramid model;
the first determining module is used for determining the first vector and the second vector according to the corresponding hexagonal pyramid model;
a calculation module for calculating the cosine value and/or the sine value.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program performs the method of any one of claims 1 to 7.
10. A processor, characterized in that the processor is configured to run a program, wherein the program when running performs the method of any of claims 1 to 7.
CN201911425488.1A 2019-12-31 2019-12-31 Method, device, storage medium and processor for searching target color Pending CN113127670A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911425488.1A CN113127670A (en) 2019-12-31 2019-12-31 Method, device, storage medium and processor for searching target color

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911425488.1A CN113127670A (en) 2019-12-31 2019-12-31 Method, device, storage medium and processor for searching target color

Publications (1)

Publication Number Publication Date
CN113127670A true CN113127670A (en) 2021-07-16

Family

ID=76771050

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911425488.1A Pending CN113127670A (en) 2019-12-31 2019-12-31 Method, device, storage medium and processor for searching target color

Country Status (1)

Country Link
CN (1) CN113127670A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216830A (en) * 2007-12-28 2008-07-09 腾讯科技(深圳)有限公司 Method and system for search commercial articles according to colors
CN103699532A (en) * 2012-09-27 2014-04-02 中国电信股份有限公司 Image color retrieval method and system
CN104462481A (en) * 2014-12-18 2015-03-25 浪潮(北京)电子信息产业有限公司 Comprehensive image retrieval method based on colors and shapes
CN104778170A (en) * 2014-01-09 2015-07-15 阿里巴巴集团控股有限公司 Method and device for searching and displaying commodity image
CN105580006A (en) * 2013-02-07 2016-05-11 禅色公司 System and method for identifying, searching and matching products based on color
CN105608234A (en) * 2016-03-18 2016-05-25 北京京东尚科信息技术有限公司 Image retrieval method and device
US20160267088A1 (en) * 2012-12-28 2016-09-15 Wal-Mart Stores, Inc. Ranking search results based on color
CN107291855A (en) * 2017-06-09 2017-10-24 中国电子科技集团公司第五十四研究所 A kind of image search method and system based on notable object
CN108256566A (en) * 2018-01-10 2018-07-06 广东工业大学 A kind of adaptive masterplate matching process and device based on cosine similarity
CN108763580A (en) * 2018-06-08 2018-11-06 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment, computer storage media
CN108804581A (en) * 2018-05-24 2018-11-13 广州中大百迅信息技术有限公司 A kind of congener physical examination rope method and system based on deep learning

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216830A (en) * 2007-12-28 2008-07-09 腾讯科技(深圳)有限公司 Method and system for search commercial articles according to colors
CN103699532A (en) * 2012-09-27 2014-04-02 中国电信股份有限公司 Image color retrieval method and system
US20160267088A1 (en) * 2012-12-28 2016-09-15 Wal-Mart Stores, Inc. Ranking search results based on color
CN105580006A (en) * 2013-02-07 2016-05-11 禅色公司 System and method for identifying, searching and matching products based on color
CN104778170A (en) * 2014-01-09 2015-07-15 阿里巴巴集团控股有限公司 Method and device for searching and displaying commodity image
CN104462481A (en) * 2014-12-18 2015-03-25 浪潮(北京)电子信息产业有限公司 Comprehensive image retrieval method based on colors and shapes
CN105608234A (en) * 2016-03-18 2016-05-25 北京京东尚科信息技术有限公司 Image retrieval method and device
CN107291855A (en) * 2017-06-09 2017-10-24 中国电子科技集团公司第五十四研究所 A kind of image search method and system based on notable object
CN108256566A (en) * 2018-01-10 2018-07-06 广东工业大学 A kind of adaptive masterplate matching process and device based on cosine similarity
CN108804581A (en) * 2018-05-24 2018-11-13 广州中大百迅信息技术有限公司 A kind of congener physical examination rope method and system based on deep learning
CN108763580A (en) * 2018-06-08 2018-11-06 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment, computer storage media

Similar Documents

Publication Publication Date Title
KR102316230B1 (en) Image processing method and device
CN111612834B (en) Method, device and equipment for generating target image
CN104112284A (en) Method and equipment for detecting similarity of images
CA3090504A1 (en) Systems and methods for sensor-independent illuminant determination
CN104881657A (en) Profile face identification method and system, and profile face construction method and system
US20170316585A1 (en) Image processing device and method for color balancing
CN108805872A (en) The detection method and device of product
US20100092077A1 (en) Dominant color descriptors
RU2510935C2 (en) Method of indexing and searching digital images
CN111800568B (en) Light supplement method and device
EP3008690A1 (en) Image processing including adjoin feature based object detection, and/or bilateral symmetric object segmentation
CN113127670A (en) Method, device, storage medium and processor for searching target color
You et al. The technique of color and shape-based multi-feature combination of trademark image retrieval
CN112348057A (en) Target identification method and device based on YOLO network
CN113111687A (en) Data processing method and system and electronic equipment
CN112785595A (en) Target attribute detection, neural network training and intelligent driving method and device
US20240011792A1 (en) Method and apparatus for updating confidence of high-precision map
CN115578796A (en) Training method, device, equipment and medium for living body detection model
Banić et al. Illumination estimation is sufficient for indoor-outdoor image classification
CN114494398A (en) Processing method and device for inclined target, storage medium and processor
Dravyakar et al. Private content based multimedia information retrieval using map-reduce
US20100260425A1 (en) Method and Device for the Automated Comparison of Two Sets of Measurement Values
CN112364181A (en) Insurance product matching degree determination method and device
Han et al. An improved saliency detection method based on non-uniform quantification and channel-weighted color distance
Alvarado-Robles et al. Segmentation of green areas using bivariate histograms based in hue-saturation type color spaces

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210716

RJ01 Rejection of invention patent application after publication