WO2014183591A1 - 一种提供图像的方法和服务器装置以及终端装置 - Google Patents

一种提供图像的方法和服务器装置以及终端装置 Download PDF

Info

Publication number
WO2014183591A1
WO2014183591A1 PCT/CN2014/077186 CN2014077186W WO2014183591A1 WO 2014183591 A1 WO2014183591 A1 WO 2014183591A1 CN 2014077186 W CN2014077186 W CN 2014077186W WO 2014183591 A1 WO2014183591 A1 WO 2014183591A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
color
images
principal component
groups
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.)
Ceased
Application number
PCT/CN2014/077186
Other languages
English (en)
French (fr)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to RU2015153562A priority Critical patent/RU2637876C2/ru
Priority to AU2014267925A priority patent/AU2014267925B2/en
Priority to US14/891,547 priority patent/US9734164B2/en
Publication of WO2014183591A1 publication Critical patent/WO2014183591A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/10Image enhancement or restoration using non-spatial domain filtering
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details
    • G06K19/06056Constructional details the marking comprising a further embedded marking, e.g. a 1D bar code with the black bars containing a smaller sized coding
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K2019/06215Aspects not covered by other subgroups
    • G06K2019/06225Aspects not covered by other subgroups using wavelength selection, e.g. colour code
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Definitions

  • the present invention relates to a method and server apparatus for providing an image, and a terminal device. Background technique
  • the present invention provides a method for providing an image, a server device, and a terminal device, which can realize an image search according to a color, and can help a user obtain an image of a color desired by the user, and can be applied to an electronic commerce field.
  • the method for providing an image of the present invention includes: a server receiving color principal component analysis data of an image to be queried sent by a terminal device, where the color principal component analysis data includes an identifier of a preset number of principal component colors of the image to be queried And comparing the color of each of the main component colors; the server compares the color principal component analysis data of the image to be queried with the color principal component analysis data of the plurality of images in the image library, and sends the color principal component analysis data to the terminal device An identifier of the image in the plurality of image libraries having the highest degree of similarity of the primary color of the image to be queried for the terminal device to acquire an image according to the identifier; the color principal component analysis data of the image in the image library includes the image for the image The identifier of the preset number of color principal components and the proportion of each of the color principal components, and the color of the image in the image library
  • the principal component division manner is the same as the color principal component division manner for the image to be queried.
  • the method further includes performing the following steps on the multiple images of the image library: filtering the white background according to the preset RGB threshold The image is scaled so that the image width and height are specified values; foreground extraction is performed; color principal component analysis is performed; and images with similar color principal components are subjected to de-weighting processing.
  • the step of performing foreground extraction comprises: finding, from each pixel of a set of opposite boundaries of the image, finding the closest to the middle of the image in a direction perpendicular to the set of boundaries and the RGB value is less than the preset.
  • the performing the color principal component analysis comprises: dividing the HSV color space into a plurality of groups; and assigning the foreground pixels to each of the groups according to analyzing the HSV color components of the foreground pixels of the image Calculating a proportion of the number of pixels of each group in the total number of pixels of the foreground image; using the identifier of the preset number of groups having the largest ratio as the identifier of the color of the main component.
  • the step of performing deduplication processing on an image with a similar color principal component includes: removing, according to a result of the color principal component analysis, a predetermined ratio smaller than a predetermined number of groups in which the ratio is the largest Group of thresholds; comparing two or two in the same number of remaining groups, if any of the following conditions are met, it is determined that the two images are similar and deduplicated: a. After sorting by the proportion, the group of the two images The identifier and the proportion of each group are the same; b. After sorting by the proportion size, the identifiers of the groups of the two images are the same, the number is less than half of the predetermined number, and the proportion of the groups of the same identifier of the two images is poor.
  • the absolute value is not greater than the first preset difference; c. After sorting by the proportion, the identifiers of the groups of the two images are the same, the number is not less than half of the predetermined number, and the group of the same identifier of the two images
  • the absolute value of the difference is not large And a second preset difference; wherein the second preset difference is greater than the first preset difference.
  • the degree of similarity of the primary hue is calculated according to the following formula:
  • a server apparatus for providing an image is provided.
  • the server device for providing an image includes: a receiving module, configured to receive color principal component analysis data of the image to be queried sent by the terminal device, where the color principal component analysis data includes a preset number of principal component colors for the image to be queried And a ratio of the color of each of the main component colors; a sending module, configured to compare color principal component analysis data of the image to be queried with color principal component analysis data of the plurality of images in the image library, to Transmitting, by the terminal device, an identifier of an image in a plurality of image libraries having the greatest degree of similarity with a primary color of the image to be queried for the terminal device to acquire according to the identifier An image; the color principal component analysis data of the image in the image library includes an identifier of the preset number of color principal components for the image and a proportion of each of the color principal components, and is for an image in the image library The color principal component is divided into the same manner as the color principal component of the image to be queried.
  • the method further includes: a background filtering module, configured to filter the plurality of images of the image library according to a preset RGB threshold, and filter the white color
  • An image scaling module configured to perform scaling processing on a plurality of images of the image library to make the image width and height a specified value
  • a foreground extraction module configured to perform foreground extraction on the plurality of images of the image library
  • color principal component analysis a module for performing color principal component analysis on multiple images of the image library; It is used to de-weight the images with similar color principal components for a plurality of images of the image library.
  • the foreground extraction module is further configured to: find, from each pixel of a set of opposite boundaries of the image, the closest to the middle of the image in a direction perpendicular to the set of boundaries and the RGB value is greater than the preset a first set of pixels of values; and from a center line parallel to the boundary, finding a second set of pixels that are closest to each other and having an RGB value greater than the predetermined value in a direction perpendicular to the centerline; The area between the first set of pixels and the second set of pixels is taken as the foreground of the image.
  • the color principal component analysis module is further configured to: divide the HSV color space into a plurality of groups; and allocate the foreground pixels to each of the groups according to analyzing the HSV color components of the foreground pixels of the image. Calculating a proportion of the number of pixels of each group in the total number of pixels of the foreground image; using the identifier of the preset number of groups having the largest ratio as the identifier of the color of the main component.
  • the de-duplication module is further configured to: remove, according to a result of the color principal component analysis, a group that is smaller than a preset percentage threshold in a predetermined number of groups with the largest proportion; Comparing the two images in the same image, if the following conditions are met, it is determined that the two images are similar and deduplicated: a. After sorting by the proportion, the group of the two images has the same identity and group proportion. b, after sorting by the proportion, the identifiers of the groups of the two images are the same, the number of groups is less than half of the predetermined number, and the absolute value of the difference of the proportions of the groups of the same identifier of the two images is not greater than the first Preset difference; c.
  • FIG. 1 is a schematic diagram of a method of providing an image according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of foreground extraction according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram showing the basic configuration of a server device according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram showing a basic configuration of a terminal device providing an image according to an embodiment of the present invention.
  • the software in the smart phone starts the camera to acquire an image in the video frame, and The image is used as the image to be queried, and the color principal component analysis is performed on the image to obtain the ratio of the main component color of the image to be queried and the number of pixels belonging to each main component color to the total number of image pixels, that is, the proportion of each main component color.
  • the smartphone sends the analysis result to the server, and the server searches for the product whose color is as close as possible to the color in the image according to the image, and sends the identifier of the image to the smart phone used by the user.
  • the software then downloads an image from the network element that holds the image library according to the identifier.
  • Step S11 For the image in the image library, the image of the white background is filtered according to the preset RGB threshold.
  • the image in the image library has a certain degree of formality, mainly reflected in the product in the center of the image, the background is white. Color analysis of such images can obtain more accurate product color characteristics.
  • the images in the product image library may come from various channels, such as sellers of goods, so that some product images may not be standardized. This step is to deal with this situation, and discard the image library.
  • An image of a non-white background In the specific processing, it may be to examine a circle of pixels at the outermost side of the image. If there is more than a certain proportion of the pixels, for example, 80% of the pixels, the G, and B values are greater than the preset RGB threshold, the background is considered to be white. of.
  • the RGB threshold here is a larger value but less than 255, for example 220, which means that pixels close to white are also considered white, mainly considering that it is difficult to completely white the background when shooting.
  • Step S12 scaling the image in the image library to make the image width and height refer to Value. Because multiple images in the image library are finally displayed on the terminal device, in order to have a better display effect, the image can be scaled to make the size uniform.
  • Step S13 Perform foreground extraction on the image in the image library. For some products, the shape contains a ring shape, and the inside of the ring is still the background. The color of the background (that is, the white color considered in step S1 1) cannot be used as the color of the product itself, so it needs to be removed.
  • the following processing may be adopted: first, from each pixel of a set of opposite boundaries of the image, the closest to the middle of the image is found along a direction perpendicular to the boundary of the group, and the RGB value is less than the pre- Setting a first set of pixels; and, from an image center line parallel to the boundary, finding a second set of pixels that are closest to each other and having an RGB value smaller than the preset value in a direction perpendicular to the center line; The area between the first group of pixels and the second group of pixels is taken as the foreground of the image.
  • FIG. 2 is a schematic diagram of foreground extraction in accordance with an embodiment of the present invention. As shown in FIG.
  • Step S14 Perform color principal component analysis on the image in the image library.
  • the analysis is performed in the HSV color space, specifically, the HSV color space is first divided into a plurality of groups; then, the HSV color component is analyzed according to the foreground pixels of the image; the foreground pixels are allocated to each group; Calculating the proportion of the number of pixels in each group in the total number of pixels in the foreground image; using the identifier of the preset number of groups having the largest proportion as the identifier of the color of the main component, that is, taking The component color of the previous number is used as the main component color of the image.
  • the principal component color is expressed in the form of (M, N), where M represents the identity of the principal component color, that is, the identifier of the group obtained by dividing the HSV color space, and N represents the above-mentioned proportion of the principal component color M.
  • M represents the identity of the principal component color, that is, the identifier of the group obtained by dividing the HSV color space
  • N represents the above-mentioned proportion of the principal component color M.
  • the HSV color space is divided into 65 groups, and the color principal component analysis of an image results in the following (only some of them are listed here):
  • Step S15 Perform deduplication processing on the image with similar color principal components in the image in the image library according to the analysis result of step S14.
  • the group smaller than the preset ratio threshold is removed; and then the two groups are compared in the same number of remaining images. If any of the following conditions are met, then the two images are determined to be similar and deduplicated:
  • the group of the two images has the same identity and group proportion; b. After sorting by the proportion, the groups of the two images have the same identifier, and the number of groups is less than half of the predetermined number. The absolute value of the difference of the proportions of the groups of the same identifiers of the two images is not greater than the first preset difference value;
  • the identifiers of the groups of the two images are the same, the number of groups is not less than half of the predetermined number, and the absolute value of the difference of the proportions of the groups of the same identifier of the two images is not greater than the second pre- Set the difference;
  • the second preset difference is greater than the first preset difference.
  • take 4 colors as the main component of the color of the image that is, take the group of the top four, for example, five images of A, B, C, D, and E.
  • the groups in the top four are as follows:
  • Image A (64, 0.38), (7, 0.21), (26, 0.15), (33, 0.06); Image B: (64, 0.35), (7, 0.23), (26, 0.15), (45 , 0.08) ; Image C: (64, 0.39), (7, 0.19), (26, 0.03), (54, 0.02); Image D: (22, 0.43), (32, 0.32), (45, 0.02), (49, 0.016); Image E: (22, 0.43), (32, 0.31), (47, 0.02), (44 , 0.016).
  • the preset threshold value for example, the ratio threshold is 0.1, and the result is as follows:
  • Image A (64, 0.38) , (7, 0.21) , (26, 0.15)
  • Image B (64, 0.35) , (7, 0.23) , (26, 0.15)
  • Image D (22, 0.43), (32, 0.32);
  • Image E (22, 0.43), (32, 0.31).
  • the ratio of 64 is 0.38 and 0.35, respectively, and the difference is 0.3, which is less than 0.4.
  • the difference between the proportions corresponding to group 7 and group 26 is 0.02 and 0, respectively, which are less than 0.4. At this time, it is considered that the color principal components of the image A and the image B are similar, and one of the images should be removed.
  • Step S16 Receive an image principal component analysis result sent by the terminal device.
  • Step S17 Calculate the primary color similarity between the image in the image library and the image to be queried according to the formula (1) and the formula (2).
  • Step S18 Take the gallery images of the first few similarities, and send the identifiers of the images to the terminal device.
  • the identification here, such as the image number, may be the item number of the item in the image in the e-commerce.
  • the terminal device can download the corresponding image from the network according to the identifier and display it to the user.
  • the terminal device may be a smart phone, and the software of the smartphone is activated by the software therein to acquire a video frame, and an image block is acquired from a central position of the video frame.
  • the size of the image block can be 16x 16 pixels.
  • the color principal component analysis is performed on the image block in a manner similar to that in the above step S14, except that the image block as a whole is used as a foreground target. Since the user's accurate object has a plurality of colors strictly due to light or the object itself, in order to allow the user to confirm the color of his or her own color, the main color of the image block can be analyzed and presented to the user.
  • the color is the main color of the image block; if the ratio of the first ranked group is smaller than the 7 but larger than the other preset value T 2 , the color of the pixel closest to the center position of the image block is the main color Color is the primary color of the image block. For other cases, the color of that pixel at the center of the image block is taken as the primary color of the image block.
  • the above analysis method is as shown in formula (3):
  • S (0 represents the R, G, B value of the main color of the image block
  • M ⁇ represents the mean value of R, G, B of all pixels in the _th principal component color of the image block
  • 1 the proportion of the main component color
  • represents the Euclidean distance between the vectors; 7; and 2 represents the preset ratio threshold.
  • the image in the image library is preferably a subset of all images of the image library, and the subset is a photo or a picture of a type of product specified by the user in advance.
  • the server device and the terminal device in the embodiment of the present invention is a schematic diagram of a basic structure of a server device according to an embodiment of the present invention.
  • the server device can be provided in the above server.
  • the server device 30 that provides an image mainly includes a receiving module 31 and a transmitting module 32.
  • the receiving module 31 is configured to receive color principal component analysis data of the image to be queried sent by the terminal device, where the color principal component analysis data includes an identifier of a preset number of principal component colors of the image to be queried and each of the main a ratio of the color of the component;
  • the sending module 32 is configured to compare the color principal component analysis data of the image to be queried with the color principal component analysis data of the plurality of images in the image library, and send the color principal component analysis data to the terminal device Querying an identifier of the image in the plurality of image libraries having the greatest degree of similarity of the main color of the image for the terminal device to acquire an image according to the identifier;
  • the color principal component analysis data of the image in the image library includes the image for the image
  • the identifier of the preset number of color principal components and the proportion of each of the color principal components, and the color principal component division manner for the image in the image library is the same as the color principal component division manner for the image to be queried.
  • the server device 30 for providing an image may further include a module (not shown): a background filtering module, configured to filter an image of a white background according to a preset RGB threshold for a plurality of images of the image library; Performing scaling processing on multiple images of the image library to make the image width and height a specified value; foreground extraction module for foreground extraction for multiple images of the image library; color principal component analysis module, for multi-image library The image is subjected to color principal component analysis; the de-duplication module is configured to perform de-duplication processing on images with similar color principal components for a plurality of images of the image library.
  • a background filtering module configured to filter an image of a white background according to a preset RGB threshold for a plurality of images of the image library
  • foreground extraction module for foreground extraction for multiple images of the image library
  • color principal component analysis module for multi-image library
  • the image is subjected to
  • the foreground extraction module can also be used to: find, from each pixel of a set of relative boundaries of the image, the closest to the middle of the image in a direction perpendicular to the boundary of the set and the RGB value is small a first set of pixels of a preset value; and starting from an image center line parallel to the boundary, finding the closest to the two sides in a direction perpendicular to the center line and the second having an RGB value smaller than the preset value Group pixels; a region between the first group of pixels and the second group of pixels as a foreground of an image.
  • the color principal component analysis module is further configured to: divide the HSV color space into a plurality of groups; assign the foreground pixels to each of the groups according to analysis of the foreground color pixels of the image; and calculate pixels of each group a ratio of the number of pixels in the foreground image; an identifier of the preset number of groups having the largest ratio as an identifier of the color of the principal component.
  • the de-duplication module is further configured to: remove, according to a result of the color principal component analysis, a group that is smaller than a preset ratio threshold in a predetermined number of groups with the largest proportion; and two or two in the same number of remaining groups For comparison, if any of the following conditions are met, it is determined that the two images are similar and deduplicated:
  • the identifiers of the groups of the two images and the proportions of the groups are the same;
  • the identifiers of the groups of the two images are the same, and the number of the groups is smaller than the predetermined number. Half of the difference between the ratios of the groups of the same identifiers of the two images is not greater than the first preset difference;
  • the identifiers of the groups of the two images are the same, the number of the groups is not less than half of the predetermined number, and the absolute value of the difference of the proportions of the groups of the same identifier of the two images is not greater than Two preset differences;
  • the second preset difference is greater than the first preset difference.
  • the sending module can also be used to calculate the degree of similarity of the primary hue according to formula (1) and formula (2).
  • 4 is a schematic diagram of a basic structure of a terminal device providing an image according to an embodiment of the present invention.
  • the terminal device providing the image may be provided in the above-described smartphone.
  • the terminal device 40 for providing an image mainly includes an image block acquiring module 41, and color analysis.
  • the image block obtaining module 41 is configured to obtain an image block from the video frame; the color analysis module 42 is configured to perform color principal component analysis on the image block to obtain a preset number of color principal component identifiers and each of the color principal components.
  • the sending module 43 is configured to send the analysis result of the color analysis module to the server; the receiving module 44 is configured to receive an identifier of the image sent by the server, where the image is the server and the analysis result and the image library
  • the color principal component analysis data of the plurality of images is compared to obtain a gallery image whose primary color is most similar to the primary color tone of the image block; the image acquisition module 45 is configured to acquire an image according to the identifier of the image sent by the server .
  • the color analysis module is further configured to: divide the HSV color space into a plurality of groups; assign pixels in the image block to each of the groups according to analyzing the HSV color component of the image block; a ratio of the number of pixels in the total number of pixels of the image block; the identifier of the preset number of groups having the largest ratio as the identifier of the main component color.
  • the terminal device 40 for providing an image may further include a main color analysis module and an output module (not shown), wherein the main color analysis module is configured to derive the main color of the image block according to the formula (3), and the output module is used by the output module. A color block of the main color is output to allow the user to confirm the color to be queried.
  • the color principal component analysis is performed on the image in the image library, and the color principal component analysis is performed on the image provided by the terminal device, thereby finding the main color from the image library as close as possible to the user specified.
  • An image of the color of the item This method realizes image search based on color, which helps users to obtain images of the color they want. When applied in the field of electronic commerce, it can help buyers obtain the products of the color they want more accurately.
  • the object of the present invention can also be achieved by merely providing a program product comprising program code for implementing the method or apparatus. That is to say, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention.
  • the storage medium may be any well-known storage medium or any storage medium developed in the future.
  • various components or steps may be decomposed and/or recombined. These decompositions and/or recombinations should be considered as equivalents to the invention. Also, the steps of performing the above-described series of processing may naturally be performed in chronological order in the order illustrated, but need not necessarily be performed in chronological order.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Image Analysis (AREA)
  • Processing Or Creating Images (AREA)
  • Image Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

提供一种提供图像的方法和服务器装置以及终端装置,能够实现根据色彩的图像搜索,有助于使用户获得自己想要的颜色的图像,应用在电子商务领域时,能够帮助买家较为准确地获得自己想要的颜色的商品。该方法包括:服务器接收终端设备发送的待査询图像的颜色主成分分析数据,然后将所述待査询图像的颜色主成分分析数据与图像库中的多个图像的颜色主成分分析数据作对比,向所述终端设备发送与所述待査询图像的主色调的相似程度最大的多个图像库中的图像的标识以供所述终端设备根据该标识获取图像。

Description

一种提供图像的方法和服务器装置以及终端装置 技术领域
本发明涉及一种提供图像的方法和服务器装置以及终端装置。 背景技术
在电子商务中, 买家可以通过商品名称、 品牌、 型号、 价格等进 行商品搜索。 对于某些类型的商品, 买家对于商品颜色更为关心, 例 如服装、 化妆品等。 在这种情况下, 通过商品名称、 品牌、 型号、 价 格的搜索方式难以使买家获得自己想要的颜色的商品。 发明内容
有鉴于此, 本发明提供一种提供图像的方法和服务器装置以及终 端装置, 能够实现根据色彩的图像搜索, 有助于使用户获得自己想要 的颜色的图像, 应用在电子商务领域时, 能够帮助买家较为准确地获 得自己想要的颜色的商品。 为实现上述目的, 根据本发明的一个方面, 给出了一种提供图像 的方法。 本发明的提供图像的方法包括: 服务器接收终端设备发送的待查 询图像的颜色主成分分析数据, 所述颜色主成分分析数据中包含针对 所述待查询图像的预设数目个主成分颜色的标识和各个所述主成分颜 色的占比; 服务器将所述待查询图像的颜色主成分分析数据与图像库 中的多个图像的颜色主成分分析数据作对比, 向所述终端设备发送与 所述待查询图像的主色调的相似程度最大的多个图像库中的图像的标 识以供所述终端设备根据该标识获取图像; 所述图像库中的图像的颜 色主成分分析数据中包含针对该图像的所述预设数目个颜色主成分的 标识和各个所述颜色主成分的占比, 并且针对图像库中的图像的颜色 主成分划分方式与针对所述待查询图像的颜色主成分划分方式相同。 可选地, 所述服务器接收终端设备发送的待查询图像的颜色主成 分分析数据的步骤之前, 该方法还包括针对图像库的多个图像执行以 下步骤: 按照预设的 RGB阈值滤除非白色背景的图像; 进行缩放处理 使图像宽度和高度为指定值; 进行前景提取; 进行颜色主成分分析; 对颜色主成分相似的图像进行去重处理。 可选地, 所述进行前景提取的步骤包括: 从图像的一组相对的边 界的每个像素起, 沿垂直于该组边界的方向向图像的中间查找出最接 近的并且 RGB值小于预设值的第一组像素; 并且从平行于所述边界的 图像中心线起, 沿垂直于该中心线的方向向两边查找出最接近的并且 RGB值小于所述预设值的第二组像素; 将所述第一组像素和第二组像 素之间的区域作为图像的前景。 可选地, 所述进行颜色主成分分析的步骤包括: 将 HSV颜色空间 划分为多个组; 根据对图像的前景像素进行 HSV颜色分量的分析, 将 所述前景像素分配到各个所述组中; 计算各组的像素数量在所述前景 图像像素总数中的占比; 将所述占比最大的所述预设数目个组的标识 作为所述主成分颜色的标识。 可选地, 所述对颜色主成分相似的图像进行去重处理的步骤包括: 根据所述颜色主成分分析的结果, 在所述占比最大的预定数目个组中, 去除小于预设占比阈值的组; 在剩余组数相同的图像中两两进行比较, 若满足以下任一条件, 则判定两个图像相似并进行去重: a、 按占比大 小排序之后, 两个图像的组的标识和各组占比都相同; b、 按占比大小 排序之后, 两个图像的组的标识相同, 数目小于所述预定数目的一半, 两个图像的相同标识的组的占比的差的绝对值不大于第一预设差值; c、 按占比大小排序之后, 两个图像的组的标识相同, 数目都不小于所述 预定数目的一半, 两个图像的相同标识的组的占比的差的绝对值不大 于第二预设差值; 其中所述第二预设差值大于所述第一预设差值。 可选地, 所述主色调的相似程度根据如下公式计算:
. = I (Database(Rk))
Figure imgf000005_0001
其中, (0表示待查询图像与图像库中第 个图像之间主色调的 相似程度; N表示所述预设数目; 表示待查询图像的第 _ 个颜 色主成分的占比; ^to ^ ( )表示图像库中第 个图像的第 个颜色 主成分的占比; 表示预设的小于 1的正数。 根据本发明的另一方面, 给出了一种提供图像的服务器装置。 本发明的提供图像的服务器装置包括: 接收模块, 用于接收终端 设备发送的待查询图像的颜色主成分分析数据, 所述颜色主成分分析 数据中包含针对所述待查询图像的预设数目个主成分颜色的标识和各 个所述主成分颜色的占比; 发送模块, 用于将所述待查询图像的颜色 主成分分析数据与图像库中的多个图像的颜色主成分分析数据作对 比, 向所述终端设备发送与所述待查询图像的主色调的相似程度最大 的多个图像库中的图像的标识以供所述终端设备根据该标识获取图 像; 所述图像库中的图像的颜色主成分分析数据中包含针对该图像的 所述预设数目个颜色主成分的标识和各个所述颜色主成分的占比, 并 且针对图像库中的图像的颜色主成分划分方式与针对所述待查询图像 的颜色主成分划分方式相同。 可选地, 还包括: 背景过滤模块, 用于针对图像库的多个图像按 照预设的 RGB阈值滤除非白色背景的图像; 图像缩放模块, 用于针对 图像库的多个图像进行缩放处理使图像宽度和高度为指定值; 前景提 取模块, 用于针对图像库的多个图像进行前景提取; 颜色主成分分析 模块, 用于针对图像库的多个图像进行颜色主成分分析; 去重模块, 用于针对图像库的多个图像对颜色主成分相似的图像进行去重处理。 可选地, 所述前景提取模块还用于: 从图像的一组相对的边界的 每个像素起, 沿垂直于该组边界的方向向图像的中间查找出最接近的 并且 RGB值大于预设值的第一组像素; 并且从平行于所述边界的图像 中心线起, 沿垂直于该中心线的方向向两边查找出最接近的并且 RGB 值大于所述预设值的第二组像素; 将所述第一组像素和第二组像素之 间的区域作为图像的前景。 可选地, 所述颜色主成分分析模块还用于: 将 HSV颜色空间划分 为多个组; 根据对图像的前景像素进行 HSV颜色分量的分析, 将所述 前景像素分配到各个所述组中; 计算各组的像素数量在所述前景图像 像素总数中的占比; 将所述占比最大的所述预设数目个组的标识作为 所述主成分颜色的标识。 可选地, 所述去重模块还用于: 根据所述颜色主成分分析的结果, 在所述占比最大的预定数目个组中, 去除小于预设占比阈值的组; 在 剩余组数相同的图像中两两进行比较, 若满足以下任一条件, 则判定 两个图像相似并进行去重: a、 按占比大小排序之后, 两个图像的组的 标识和各组占比都相同; b、 按占比大小排序之后, 两个图像的组的标 识相同, 组的数目小于所述预定数目的一半, 两个图像的相同标识的 组的占比的差的绝对值不大于第一预设差值; c、按占比大小排序之后, 两个图像的组的标识相同, 组的数目都不小于所述预定数目的一半, 两个图像的相同标识的组的占比的差的绝对值不大于第二预设差值; 其中所述第二预设差值大于所述第一预设差值。 可选地, 所述发送模块还用于根据如下公式计算主色调的相似程 s nimm(( i) = f{j, k)
Query(Rj ) x Databaset {Rk ) x W^k 当/ (Query(Rj)) = I (Database{Rk)) f(j, k)
0,其他情况
其中, (0表示待查询图像与图像库中第 个图像之间主色调的 相似程度; N表示所述预设数目; 表示待查询图像的第 _ 个颜 色主成分的占比; ^to ^ ( )表示图像库中第 个图像的第 个颜色 主成分的占比; 表示预设的小于 1的正数。 根据本发明的技术方案, 对图像库中的图像进行颜色主成分分析, 并对终端设备提供的图像进行颜色主成分分析, 据此从图像库中查找 出主色调尽可能接近用户指定的颜色的商品的图像。 这种方式实现了 根据色彩的图像搜索, 有助于使用户获得自己想要的颜色的图像, 应 用在电子商务领域时, 能够帮助买家较为准确地获得自己想要的颜色 的商品。 附图说明
附图用于更好地理解本发明, 不构成对本发明的不当限定。 其中: 图 1是根据本发明实施例的提供图像的方法的示意图;
图 2是根据本发明实施例的前景提取的示意图;
图 3是根据本发明实施例的服务器装置的基本结构的示意图; 图 4 是根据本发明实施例的提供图像的终端装置的基本结构的示 意图。 具体实施方式
以下结合附图对本发明的示范性实施例做出说明, 其中包括本发 明实施例的各种细节以助于理解, 应当将它们认为仅仅是示范性的。 因此, 本领域普通技术人员应当认识到, 可以对这里描述的实施例做 出各种改变和修改, 而不会背离本发明的范围和精神。 同样, 为了清 楚和简明, 以下的描述中省略了对公知功能和结构的描述。 本发明实施例的技术方案主要应用于智能手机中, 用户使用手机 摄像头对准自己想要搜索的颜色并进行色彩捕捉的操作之后, 智能手 机中的软件启动摄像头获取视频帧中的图像, 将该图像作为待查询图 像, 对该图像进行颜色主成分分析, 得到待查询图像的主成分颜色以 及属于各个主成分颜色的像素数量分别占图像像素总数量的比例, 即 各个主成分颜色的占比。 智能手机将该分析结果发送给服务器, 由服 务器根据该图像, 从商品的图像库中查找颜色与该图像中的颜色尽可 能相近的商品, 将这些图像的标识发送给用户使用的智能手机, 上述 软件再根据该标识, 从保存上述图像库的网元中下载图像。 对于上述的服务器来说, 事先对图像库中的图像作同样的颜色主 成分分析得到各个图像的主成分颜色以及各个主成分颜色的占比。 以 下结合图 1 对本发明实施例中的提供图像的方法作详细说明。 图 1 是 根据本发明实施例的提供图像的方法的示意图。 该方法由上述的服务 器执行。 步骤 S11 : 对图像库中的图像, 按照预设的 RGB阈值滤除非白色 背景的图像。 图像库中的图像在形式上具有一定的规范性, 主要体现 在商品位于图像中央, 背景为白色。 对这样的图像进行颜色分析方可 获得较为准确的商品颜色特点。 在实际的电子商务领域, 商品图像库 中的图像可能来自多种渠道, 例如商品的卖家, 这样有些商品图像可 能不太规范, 本步骤即是针对这种情况做出处理, 舍弃图像库中的非 白色背景的图像。 具体处理时, 可以是考察图像最外边的一圈像素, 如果这些像素中有超过一定比例, 例如 80%的像素的1、 G、 B值都是 大于预设的 RGB阈值, 就认为背景是白色的。 这里的 RGB阈值是一 个较大的值但小于 255, 例如 220, 也就是说将接近白色的像素也认为 是白色的, 主要是考虑到拍摄时背景难以做到完全白色。 步骤 S12:对图像库中的图像进行缩放处理使图像宽度和高度为指 定值。 因为图像库中的多张图像最终要在终端设备上显示, 因此为了 有较好的显示效果, 可以对图像进行缩放处理使其尺寸统一。 步骤 S13 : 对图像库中的图像进行前景提取。 对于有些商品, 其形 状包含环形, 环形内仍为背景, 该背景的颜色 (即步骤 S1 1 中认为的 白色) 不能作为商品本身的颜色, 因此需将其除去。 对此, 本实施例 中可采用如下方式处理: 先从图像的一组相对的边界的每个像素起, 沿垂直于该组边界的方向向图像的中间查找出最接近的并且 RGB值小 于预设值的第一组像素; 并且从平行于上述边界的图像中心线起, 沿 垂直于该中心线的方向向两边查找出最接近的并且 RGB值小于上述预 设值的第二组像素; 再将上述第一组像素和第二组像素之间的区域作 为图像的前景。 以下结合图 2举例说明。 图 2是根据本发明实施例的 前景提取的示意图。 如图 2所示, 从图像 20的一个边界 21上的各个像素起, 向中心 线 23 的方向查找, 例如沿箭头 251 的方向查找到 RGB值大于阈值的 一个像素 241 ; 同理, 沿边界 22上的各个像素起, 向中心线 23的方向 查找,例如沿箭头 252的方向查找到 RGB值大于阈值的一个像素 242 ; 从边界 21、 22起查找到的像素例如像素 241、 242等作为第一组像素。 从中心线 23上的各个像素向边界 21、 22的方向查找, 例如从像素 231 起, 沿箭头 253的方向查找到 RGB值大于阈值的一个像素 243 ; 同理, 从像素 232起沿箭头 254 的方向查找到 RGB值大于阈值的一个像素 244; 从中心线 23起查找到的像素例如像素 243、 244等作为第二组像 素。 上述的两组像素之间的区域即为前景。 步骤 S14: 对图像库中的图像进行颜色主成分分析。本实施例中在 HSV颜色空间中进行该分析,具体是先将 HSV颜色空间划分为多个组; 然后根据对图像的前景像素进行 HSV颜色分量的分析; 将前景像素分 配到各个组中; 再计算各组的像素数量在前景图像像素总数中的占比; 将占比最大的预设数目个组的标识作为主成分颜色的标识, 也就是取 占比前若干名的成分颜色作为图像的主成分颜色。 本实施例中采用 (M, N) 的形式表示主成分颜色, 其中 M 表示 主成分颜色的标识, 即划分 HSV颜色空间得到的组的标识, N表示主 成分颜色 M的上述占比。 例如将 HSV颜色空间划分为 65个组, 对某 个图像进行颜色主成分分析后得到结果如下 (这里只列出其中一部 分) :
(0, 0.008) ; (1, 0.002) ; (2, 0.01) ; (3, 0.035) ; (4, 0.001) ; …… (63, 0.006) ; (64, 0.38) 。 步骤 S15: 根据步骤 S14的分析结果, 对图像库中的图像中颜色主 成分相似的图像进行去重处理。 在本实施例中, 首先根据颜色主成分 分析的结果, 在占比最大的预定数目个组中, 去除小于预设占比阈值 的组; 然后在剩余组数相同的图像中两两进行比较, 若满足以下任一 条件, 则判定两个图像相似并进行去重:
a、按占比大小排序之后, 两个图像的组的标识和各组占比都相同; b、 按占比大小排序之后, 两个图像的组的标识相同, 组的数目小 于预定数目的一半, 两个图像的相同标识的组的占比的差的绝对值不 大于第一预设差值;
c、 按占比大小排序之后, 两个图像的组的标识相同, 组的数目都 不小于预定数目的一半, 两个图像的相同标识的组的占比的差的绝对 值不大于第二预设差值;
其中第二预设差值大于第一预设差值。 以下结合例子加以说明。 例如取 4种颜色作为图像的颜色主成分, 即取占比在前四名的组, 例如对于 A, B, C, D, E五个图像, 占比在 前四名的组分别如下:
图像 A: (64, 0.38) , (7, 0.21) , (26, 0.15) , (33, 0.06) ; 图像 B: (64, 0.35) , (7, 0.23) , (26, 0.15) , (45, 0.08) ; 图像 C: (64, 0.39) , (7, 0.19) , (26, 0.03) , (54, 0.02) ; 图像 D: (22, 0.43), (32, 0.32), (45, 0.02), (49, 0.016); 图像 E: (22, 0.43), (32, 0.31), (47, 0.02), (44, 0.016)。 首先去除其中小于预先设置的占比阈值的组,例如占比阈值为 0.1, 结果如下:
图像 A: (64, 0.38) , (7, 0.21) , (26, 0.15)
图像 B: (64, 0.35) , (7, 0.23) , (26, 0.15)
图像 C: (64, 0.39) , (7, 0.19) ;
图像 D: (22, 0.43) , (32, 0.32) ;
图像 E: (22, 0.43) , (32, 0.31) 。 图像 A和图像 B都剩了 3组, 二者相比较, 因为 3组大于 4组的 一半 (2组) , 说明商品颜色较为丰富, 此时采用较为宽松的阈值 0.4, 这样, 因为对应于组 64的占比分别是 0.38和 0.35,差值 0.3,小于 0.4; 同理对应于组 7和组 26的占比的差值分别是 0.02和 0, 都小于 0.4。 此时认为图像 A和图像 B的颜色主成分相似,应当去除其中一个图像。 又如, 图像 C、 D、 D都剩了 2组, 不大于 4组的一半, 说明商品 颜色较为单一, 此时应采用较为严格的阈值例如 0.2。 这样, 因为图像 C 和图像 D、 E 的组不同, 所以颜色主成分显然不同; 而对于图像 D 和图像 E, 组相同并且相同组中的占比差异小于 0.2, 所以认为图像 D 和图像 E的颜色主成分相似, 应当去除其中一个图像。 以上各步骤是服务器在接收待查询图像之前, 预先执行的步骤。 在步骤 S15之后, 就可以接受终端设备的查询, 即进入步骤 S16。 步骤 S16: 接收终端设备发送的图像主成分分析结果。该结果的形 式也是上述的 (M, N) 的形式, 并且与图像库中的分析结果一样取占 比在前四名的组。 步骤 S17: 根据公式 (1) 和公式 (2) 计算图像库中的图像与待查 询图像之间的主色调相似度。 公式 (1) : sim(i) = ^f(j,k) 公式 (2) :
x W^ k 当 I (Query(Rj)) = I (Database(Rk))
Figure imgf000012_0001
0,其他情况
其中, (0表示待查询图像与图像库中第 个图像之间主色调的 相似程度; N表示所述预设数目; 表示待查询图像的第 _ 个颜 色主成分的占比; ^to ^ ( )表示图像库中第 个图像的第 个颜色 主成分的占比; 表示预设的小于 1的正数。 这里设定 W是考虑到颜 色主成分的占比的次序对于两个图像的颜色差异的影响。 例如终端设备发来的待查询图像的主成分分析结果为: (7, 0.29), (64, 0.31) , (36, 0.14) , (58, 0.01) ; 则此时公式 (1) 中的 Ν 为 4。 根据公式(2) , 在与上述的图像 A: (64, 0.38) , (7, 0.21) ,
(26, 0.15) , (33, 0.06) 相比时, 例如取 ^=0.5, 则公式 ( 1) 展开 如下: ( )=0.29x0.21 xO^^+OJl xOJSxO^nO-iMAe S。 待查询图 像和图像 A中都包含组 7、 64的颜色, 因此这两个组的占比参与了计 算, 而它们包含的其他组因为不相同, 所以属于公式 (2) 中的其他情 况, 取 0。 根据计算结果得出: 待查询图像与上述的图像 A之间的 主色调相似程度为 0.044675。 对于图像库中的每个图像, 都进行上述计算得到各图像与待查询 图像之间的主色调相似程度。 然后进入步骤 S18。 步骤 S18: 取相似程度在前若干名的图库图像, 将这些图像的标识 发送给终端设备。 这里的标识例如图像编号, 在电子商务中可以是图 像中的商品的货号。 这样, 终端设备就可以根据该标识从网络下载相 应的图像并显示给用户。 以下对终端设备的工作原理做出说明。 终端设备可以是智能手机, 由其中的软件启动智能手机的摄像头从而获取视频帧, 从该视频帧的 中心位置获取图像块。 此时用户需喵准具有自己需要查询的颜色的物 体。 图像块的大小可以是 16x 16 像素。 然后对该图像块作颜色主成分 分析, 方式与上述的步骤 S14 中的方式类似, 只是此时颜该图像块整 体都作为前景目标。 因为用户喵准的物体由于光线或物体本身等原因, 严格来说具有 多种颜色, 为了使用户确认自己喵准的颜色的情况, 可以对图像块的 主色彩加以分析然后呈现给用户。 在分析时, 首先考虑图像块在颜色 分析之后排名第一的组的占比是否大于一个较大的预设值 7 , 若是, 则说明在图像块中有一个明显占优的颜色, 则可以将该颜色作为图像 块的主色彩; 如果上述排名第一的组的占比小于该 7 但大于另一个预 设值 T2, 则将颜色最接近该图像块的中心位置的那个像素的颜色的主 色彩作为该图像块的主色彩。 对于其他情况, 则将图像块的中心位置 的那个像素的颜色作为该图像块的主色彩。 上述分析方式如公式 (3 ) 所示:
)
S(i) = (^2≤ R0≤ Τγ)
Figure imgf000013_0001
其中, S(0表示所述图像块的主色彩的 R, G, B值; M画 φ 示所述图像块的第 _ 主成分颜色中的所有像素的 R, G, B的均值; 表 示第 1主成分颜色的占比; 表示向量间的欧式距离; 7;和 2表示 预设的占比阈值。 在得到图像块的主色彩之后, 终端设备可以输出一个色彩块, 其 颜色即为得到的主色彩, 这样用户可以确认自己搜索时所依据的颜色。 根据图 1 的步骤, 可以得到图库图像中颜色主成分与该色彩块尽可能 接近的一些图像, 这些图像都是商品的照片或图片。 考虑到在实际中 用户主要是搜索某一类的商品, 所以在步骤 S17 中, 图像库中的图像 最好是图像库全部图像的一个子集, 该子集是用户事先指定的一类商 品的照片或图片。 以下对于本发明实施例中的服务器装置和终端装置做出说明。图 3 是根据本发明实施例的服务器装置的基本结构的示意图。 该服务器装 置可以设置在上述的服务器中。 如图 3 所示, 提供图像的服务器装置 30主要包括接收模块 31和发送模块 32。 接收模块 31用于接收终端设备发送的待查询图像的颜色主成分分 析数据, 所述颜色主成分分析数据中包含针对所述待查询图像的预设 数目个主成分颜色的标识和各个所述主成分颜色的占比; 发送模块 32 用于将所述待查询图像的颜色主成分分析数据与图像库中的多个图像 的颜色主成分分析数据作对比, 向所述终端设备发送与所述待查询图 像的主色调的相似程度最大的多个图像库中的图像的标识以供所述终 端设备根据该标识获取图像; 所述图像库中的图像的颜色主成分分析 数据中包含针对该图像的所述预设数目个颜色主成分的标识和各个所 述颜色主成分的占比, 并且针对图像库中的图像的颜色主成分划分方 式与针对所述待查询图像的颜色主成分划分方式相同。 提供图像的服务器装置 30还可以包括如下模块 (图中未示出) : 背景过滤模块, 用于针对图像库的多个图像按照预设的 RGB阈值滤除 非白色背景的图像; 图像缩放模块, 用于针对图像库的多个图像进行 缩放处理使图像宽度和高度为指定值; 前景提取模块, 用于针对图像 库的多个图像进行前景提取; 颜色主成分分析模块, 用于针对图像库 的多个图像进行颜色主成分分析; 去重模块, 用于针对图像库的多个 图像对颜色主成分相似的图像进行去重处理。 前景提取模块还可用于: 从图像的一组相对的边界的每个像素起, 沿垂直于该组边界的方向向图像的中间查找出最接近的并且 RGB值小 于预设值的第一组像素; 并且从平行于所述边界的图像中心线起, 沿 垂直于该中心线的方向向两边查找出最接近的并且 RGB值小于所述预 设值的第二组像素; 将所述第一组像素和第二组像素之间的区域作为 图像的前景。 颜色主成分分析模块还可用于: 将 HSV颜色空间划分为多个组; 根据对图像的前景像素进行 HSV颜色分量的分析, 将所述前景像素分 配到各个所述组中; 计算各组的像素数量在所述前景图像像素总数中 的占比; 将所述占比最大的所述预设数目个组的标识作为所述主成分 颜色的标识。 去重模块还可用于: 根据所述颜色主成分分析的结果, 在所述占 比最大的预定数目个组中, 去除小于预设占比阈值的组; 在剩余组数 相同的图像中两两进行比较, 若满足以下任一条件, 则判定两个图像 相似并进行去重:
a、按占比大小排序之后, 两个图像的组的标识和各组占比都相同; b、 按占比大小排序之后, 两个图像的组的标识相同, 组的数目小 于所述预定数目的一半, 两个图像的相同标识的组的占比的差的绝对 值不大于第一预设差值;
c、 按占比大小排序之后, 两个图像的组的标识相同, 组的数目都 不小于所述预定数目的一半, 两个图像的相同标识的组的占比的差的 绝对值不大于第二预设差值;
其中所述第二预设差值大于所述第一预设差值。 发送模块还可用于根据公式 (1 ) 和公式 (2 ) 计算主色调的相似 程度。 图 4 是根据本发明实施例的提供图像的终端装置的基本结构的示 意图。 该提供图像的终端装置可以设置在上述的智能手机中。 如图 4 所示, 提供图像的终端装置 40主要包括图像块获取模块 41、 颜色分析 模块 42、 发送模块 43、 接收模块 44、 以及图像获取模块 45。 图像块获取模块 41用于从视频帧中获取图像块;颜色分析模块 42 用于对所述图像块进行颜色主成分分析从而得到预设数目个颜色主成 分的标识和各个所述颜色主成分的占比; 发送模块 43用于将所述颜色 分析模块的分析结果发送给服务器; 接收模块 44用于接收所述服务器 发送的图像的标识, 该图像是所述服务器将所述分析结果与图像库中 的多个图像的颜色主成分分析数据作对比而得到的主色调与所述图像 块的主色调相似程度最大的图库图像; 图像获取模块 45用于根据所述 服务器发送的图像的标识获取图像。 颜色分析模块还可用于: 将 HSV颜色空间划分为多个组; 根据对 所述图像块进行 HSV颜色分量的分析, 将所述图像块中的像素分配到 各个所述组中; 计算各组的像素数量在所述图像块的像素总数中的占 比; 将所述占比最大的所述预设数目个组的标识作为主成分颜色的标 识。 提供图像的终端装置 40还可包括主色彩分析模块和输出模块 (图 中未示出) , 其中, 主色彩分析模块用于根据公式 (3 ) 得出所述图像 块的主色彩, 输出模块用于输出一个该主色彩的色彩块, 以使用户确 认自己要查询的色彩。 根据本发明实施例的技术方案, 对图像库中的图像进行颜色主成 分分析, 并对终端设备提供的图像进行颜色主成分分析, 据此从图像 库中查找出主色调尽可能接近用户指定的颜色的商品的图像。 这种方 式实现了根据色彩的图像搜索, 有助于使用户获得自己想要的颜色的 图像, 应用在电子商务领域时, 能够帮助买家较为准确地获得自己想 要的颜色的商品。 以上结合具体实施例描述了本发明的基本原理, 但是, 需要指出 的是, 对本领域的普通技术人员而言, 能够理解本发明的方法和设备 的全部或者任何步骤或者部件, 可以在任何计算装置 (包括处理器、 存储介质等) 或者计算装置的网络中, 以硬件、 固件、 软件或者它们 的组合加以实现, 这是本领域普通技术人员在阅读了本发明的说明的 情况下运用他们的基本编程技能就能实现的。 因此, 本发明的目的还可以通过在任何计算装置上运行一个程序 或者一组程序来实现。 所述计算装置可以是公知的通用装置。 因此, 本发明的目的也可以仅仅通过提供包含实现所述方法或者装置的程序 代码的程序产品来实现。 也就是说, 这样的程序产品也构成本发明, 并且存储有这样的程序产品的存储介质也构成本发明。 显然, 所述存 储介质可以是任何公知的存储介质或者将来开发出的任何存储介质。 还需要指出的是, 在本发明的装置和方法中, 显然, 各部件或各 步骤是可以分解和 /或重新组合的。 这些分解和 /或重新组合应视为本发 明的等效方案。 并且, 执行上述系列处理的步骤可以自然地按照说明 的顺序按时间顺序执行, 但是并不需要一定按照时间顺序执行。 某些 步骤可以并行或彼此独立地执行。 上述具体实施方式, 并不构成对本发明保护范围的限制。 本领域 技术人员应该明白的是, 取决于设计要求和其他因素, 可以发生各种 各样的修改、 组合、 子组合和替代。 任何在本发明的精神和原则之内 所作的修改、 等同替换和改进等, 均应包含在本发明保护范围之内。

Claims

禾'應
1. 一种提供图像的方法, 其特征在于, 包括:
服务器接收终端设备发送的待查询图像的颜色主成分分析数据, 所述颜色主成分分析数据中包含针对所述待查询图像的预设数目个主 成分颜色的标识和各个所述主成分颜色的占比;
服务器将所述待查询图像的颜色主成分分析数据与图像库中的多 个图像的颜色主成分分析数据作对比, 向所述终端设备发送与所述待 查询图像的主色调的相似程度最大的多个图像库中的图像的标识以供 所述终端设备根据该标识获取图像; 所述图像库中的图像的颜色主成 分分析数据中包含针对该图像的所述预设数目个颜色主成分的标识和 各个所述颜色主成分的占比, 并且针对图像库中的图像的颜色主成分 划分方式与针对所述待查询图像的颜色主成分划分方式相同。
2. 根据权利要求 1所述的方法, 其特征在于, 所述服务器接收终 端设备发送的待查询图像的颜色主成分分析数据的步骤之前, 该方法 还包括针对图像库的多个图像执行以下步骤:
按照预设的 RGB阈值滤除非白色背景的图像;
进行缩放处理使图像宽度和高度为指定值;
进行前景提取;
进行颜色主成分分析;
对颜色主成分相似的图像进行去重处理。
3. 根据权利要求 2所述的方法, 其特征在于, 所述进行前景提取 的步骤包括:
从图像的一组相对的边界的每个像素起, 沿垂直于该组边界的方 向向图像的中间查找出最接近的并且 RGB 值小于预设值的第一组像 素; 并且从平行于所述边界的图像中心线起, 沿垂直于该中心线的方 向向两边查找出最接近的并且 RGB值小于所述预设值的第二组像素; 将所述第一组像素和第二组像素之间的区域作为图像的前景。
4. 根据权利要求 2所述的方法, 其特征在于, 所述进行颜色主成 分分析的步骤包括:
将 HSV颜色空间划分为多个组;
根据对图像的前景像素进行 HSV颜色分量的分析, 将所述前景像 素分配到各个所述组中;
计算各组的像素数量在所述前景图像像素总数中的占比; 将所述占比最大的所述预设数目个组的标识作为所述主成分颜色 的标识。
5. 根据权利要求 4所述的方法, 其特征在于, 所述对颜色主成分 相似的图像进行去重处理的步骤包括:
根据所述颜色主成分分析的结果, 在所述占比最大的预定数目个 组中, 去除小于预设占比阈值的组;
在剩余组数相同的图像中两两进行比较, 若满足以下任一条件, 则判定两个图像相似并进行去重:
a、按占比大小排序之后, 两个图像的组的标识和各组占比都相同; b、 按占比大小排序之后, 两个图像的组的标识相同, 数目小于所 述预定数目的一半, 两个图像的相同标识的组的占比的差的绝对值不 大于第一预设差值;
c、 按占比大小排序之后, 两个图像的组的标识相同, 数目都不小 于所述预定数目的一半, 两个图像的相同标识的组的占比的差的绝对 值不大于第二预设差值;
其中所述第二预设差值大于所述第一预设差值。
6. 根据权利要求 1至 5中任一项所述的方法, 其特征在于, 所述 主色调的相似程度根据如下公式计算: s nimm((i) = f{j,k)
Query(Rj ) x Databaset {Rk ) x W^k 当/ (Query(Rj)) = I (Database{Rk)) f(j,k)
0,其他情况
其中, (0表示待查询图像与图像库中第 个图像之间主色调的 相似程度; N表示所述预设数目; 表示待查询图像的第 _ 个颜 色主成分的占比; ^to ^ ( )表示图像库中第 个图像的第 个颜色 主成分的占比; 表示预设的小于 1的正数。
7. 一种提供图像的服务器装置, 其特征在于, 包括:
接收模块, 用于接收终端设备发送的待查询图像的颜色主成分分 析数据, 所述颜色主成分分析数据中包含针对所述待查询图像的预设 数目个主成分颜色的标识和各个所述主成分颜色的占比;
发送模块, 用于将所述待查询图像的颜色主成分分析数据与图像 库中的多个图像的颜色主成分分析数据作对比, 向所述终端设备发送 与所述待查询图像的主色调的相似程度最大的多个图像库中的图像的 标识以供所述终端设备根据该标识获取图像; 所述图像库中的图像的 颜色主成分分析数据中包含针对该图像的所述预设数目个颜色主成分 的标识和各个所述颜色主成分的占比, 并且针对图像库中的图像的颜 色主成分划分方式与针对所述待查询图像的颜色主成分划分方式相 同。
8. 根据权利要求 7所述的服务器装置, 其特征在于, 还包括: 背景过滤模块, 用于针对图像库的多个图像按照预设的 RGB阈值 滤除非白色背景的图像;
图像缩放模块, 用于针对图像库的多个图像进行缩放处理使图像 宽度和高度为指定值;
前景提取模块, 用于针对图像库的多个图像进行前景提取; 颜色主成分分析模块, 用于针对图像库的多个图像进行颜色主成 分分析; 去重模块, 用于针对图像库的多个图像对颜色主成分相似的图像 进行去重处理。
9. 根据权利要求 8所述的服务器装置, 其特征在于, 所述前景提 取模块还用于:
从图像的一组相对的边界的每个像素起, 沿垂直于该组边界的方 向向图像的中间查找出最接近的并且 RGB 值小于预设值的第一组像 素; 并且从平行于所述边界的图像中心线起, 沿垂直于该中心线的方 向向两边查找出最接近的并且 RGB值小于所述预设值的第二组像素; 将所述第一组像素和第二组像素之间的区域作为图像的前景。
10. 根据权利要求 8所述的服务器装置, 其特征在于, 所述颜色主 成分分析模块还用于:
将 HSV颜色空间划分为多个组;
根据对图像的前景像素进行 HSV颜色分量的分析, 将所述前景像 素分配到各个所述组中;
计算各组的像素数量在所述前景图像像素总数中的占比; 将所述占比最大的所述预设数目个组的标识作为所述主成分颜色 的标识。
1 1. 根据权利要求 10所述的服务器装置, 其特征在于, 所述去重 模块还用于:
根据所述颜色主成分分析的结果, 在所述占比最大的预定数目个 组中, 去除小于预设占比阈值的组;
在剩余组数相同的图像中两两进行比较, 若满足以下任一条件, 则判定两个图像相似并进行去重:
a、按占比大小排序之后, 两个图像的组的标识和各组占比都相同; b、 按占比大小排序之后, 两个图像的组的标识相同, 组的数目小 于所述预定数目的一半, 两个图像的相同标识的组的占比的差的绝对 值不大于第一预设差值; C、 按占比大小排序之后, 两个图像的组的标识相同, 组的数目都 不小于所述预定数目的一半, 两个图像的相同标识的组的占比的差的 绝对值不大于第二预设差值;
其中所述第二预设差值大于所述第一预设差值。
12. 根据权利要求 7至 1 1 中任一项所述的服务器装置, 其特征在 于, 所述发送模块还用于根据如下公式计算主色调的相似程度:
si {i) = J Jf(j, k) ) x W^ k 当 I (Query(Rj)) = I (Database(Rk))
Figure imgf000022_0001
0,其他情况
其中, (0表示待查询图像与图像库中第 个图像之间主色调的 相似程度; N表示所述预设数目; 表示待查询图像的第 _ 个颜 色主成分的占比; ^to ^ ( )表示图像库中第 个图像的第 个颜色 主成分的占比; 表示预设的小于 1的正数。
13. 一种提供图像的终端装置, 其特征在于, 包括:
图像块获取模块, 用于从视频帧中获取图像块;
颜色分析模块, 用于对所述图像块进行颜色主成分分析从而得到 预设数目个颜色主成分的标识和各个所述颜色主成分的占比;
发送模块, 用于将所述颜色分析模块的分析结果发送给服务器; 接收模块, 用于接收所述服务器发送的图像的标识, 该图像是所 述服务器将所述分析结果与图像库中的多个图像的颜色主成分分析数 据作对比而得到的主色调与所述图像块的主色调相似程度最大的图库 图像;
图像获取模块, 用于根据所述服务器发送的图像的标识获取图像。
14. 根据权利要求 13所述的终端装置, 其特征在于, 所述颜色分 析模块还用于:
将 HSV颜色空间划分为多个组;
根据对所述图像块进行 HSV颜色分量的分析, 将所述图像块中的 像素分配到各个所述组中;
计算各组的像素数量在所述图像块的像素总数中的占比; 将所述占比最大的所述预设数目个组的标识作为主成分颜色的标
15. 根据权利要求 13或 14所述的终端装置, 其特征在于, 还包括 主色彩分析模块和输出模块, 其中,
所述主色彩分析模块用于根据如下公式得出所述图像块的主色 彩:
M續 (t/0),当 (R0≥7 )
S(i) = (ife(Me""(t/ , a^re。)),当 (: Γ2≤ R。≤ 7;)
Figure imgf000023_0001
Ce^re。其他情况
其中, S(0表示所述图像块的主色彩的 R, G, B值; M画 φ 示所述图像块的第 _ 主成分颜色中的所有像素的 R, G, B的均值; 表 示第 1主成分颜色的占比; 表示向量间的欧式距离; 7;和 2表示 预设的占比阈值;
所述输出模块用于输出一个所述主色彩的色彩块。
PCT/CN2014/077186 2013-05-16 2014-05-09 一种提供图像的方法和服务器装置以及终端装置 Ceased WO2014183591A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
RU2015153562A RU2637876C2 (ru) 2013-05-16 2014-05-09 Способ, устройство сервера и устройство терминала для предоставления изображения
AU2014267925A AU2014267925B2 (en) 2013-05-16 2014-05-09 Image provision method, server device, and terminal device
US14/891,547 US9734164B2 (en) 2013-05-16 2014-05-09 Method, server, device, and terminal device for providing an image search

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310181762.1A CN103268338B (zh) 2013-05-16 2013-05-16 一种提供图像的方法和服务器装置以及终端装置
CN201310181762.1 2013-05-16

Publications (1)

Publication Number Publication Date
WO2014183591A1 true WO2014183591A1 (zh) 2014-11-20

Family

ID=49011967

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/077186 Ceased WO2014183591A1 (zh) 2013-05-16 2014-05-09 一种提供图像的方法和服务器装置以及终端装置

Country Status (5)

Country Link
US (1) US9734164B2 (zh)
CN (1) CN103268338B (zh)
AU (1) AU2014267925B2 (zh)
RU (1) RU2637876C2 (zh)
WO (1) WO2014183591A1 (zh)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268338B (zh) 2013-05-16 2016-03-30 北京京东尚科信息技术有限公司 一种提供图像的方法和服务器装置以及终端装置
CN105224680A (zh) * 2015-10-19 2016-01-06 深圳市金立通信设备有限公司 一种搜索应用程序的方法以及终端
CN105354275A (zh) * 2015-10-29 2016-02-24 努比亚技术有限公司 一种信息处理方法及装置、终端
CN108073934A (zh) * 2016-11-17 2018-05-25 北京京东尚科信息技术有限公司 近重复图像检测方法与装置
CN106846244A (zh) * 2017-01-04 2017-06-13 宇龙计算机通信科技(深圳)有限公司 一种图像数据处理方法、设备及终端
WO2019183347A1 (en) 2018-03-21 2019-09-26 Walmart Apollo, Llc Product image evaluation system and method
CN110941731A (zh) * 2018-09-21 2020-03-31 阿里巴巴集团控股有限公司 颜色确定方法、面料定制方法及装置
KR102347442B1 (ko) * 2019-11-08 2022-01-05 한국광기술원 중적외선을 이용한 암종 컬러검출장치 및 방법
KR102114223B1 (ko) * 2019-12-10 2020-05-22 셀렉트스타 주식회사 딥러닝 기반 유사 이미지를 필터링하는 방법 및 그를 이용한 장치
CN111986089B (zh) * 2020-08-28 2025-02-11 计易数据科技(上海)有限公司 特征值整数化的图像存储与比对方法、装置、设备和介质
CN114897579A (zh) * 2022-05-20 2022-08-12 杭州福柜科技有限公司 一种基于物品主颜色识别分析的补货方法
CN117453939A (zh) * 2023-11-20 2024-01-26 四川封面传媒科技有限责任公司 基于es的多维度图片检索方法、系统、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216841A (zh) * 2008-01-14 2008-07-09 南京搜拍信息技术有限公司 交互式图像搜索系统和方法
CN102122389A (zh) * 2010-01-12 2011-07-13 阿里巴巴集团控股有限公司 一种图像相似性判断的方法及装置
CN102722880A (zh) * 2011-03-29 2012-10-10 阿里巴巴集团控股有限公司 图像主颜色的识别方法、装置及图像匹配方法和服务器
CN103268338A (zh) * 2013-05-16 2013-08-28 北京京东尚科信息技术有限公司 一种提供图像的方法和服务器装置以及终端装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3234064B2 (ja) * 1993-09-02 2001-12-04 キヤノン株式会社 画像検索方法並びにその装置
CN101088100B (zh) * 2004-11-05 2014-03-12 卡勒兹普麦迪亚公司 对混合码进行解码的方法和装置
US7551771B2 (en) * 2005-09-20 2009-06-23 Deltasphere, Inc. Methods, systems, and computer program products for acquiring three-dimensional range information
US20080046424A1 (en) * 2006-06-23 2008-02-21 Horton Richard B System and method of selecting images according to color content
ES2304225B1 (es) * 2007-03-15 2009-10-01 Vicente Atares Martinez Procedimiento para la confeccion de mosaicos.
CN100568283C (zh) * 2007-12-07 2009-12-09 北京搜狗科技发展有限公司 一种图片主色调分析方法及其装置
US8775424B2 (en) * 2010-01-26 2014-07-08 Xerox Corporation System for creative image navigation and exploration
RU2510935C2 (ru) * 2011-09-23 2014-04-10 Артем Константинович Игнатов Способ индексации и поиска цифровых изображений

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216841A (zh) * 2008-01-14 2008-07-09 南京搜拍信息技术有限公司 交互式图像搜索系统和方法
CN102122389A (zh) * 2010-01-12 2011-07-13 阿里巴巴集团控股有限公司 一种图像相似性判断的方法及装置
CN102722880A (zh) * 2011-03-29 2012-10-10 阿里巴巴集团控股有限公司 图像主颜色的识别方法、装置及图像匹配方法和服务器
CN103268338A (zh) * 2013-05-16 2013-08-28 北京京东尚科信息技术有限公司 一种提供图像的方法和服务器装置以及终端装置

Also Published As

Publication number Publication date
US20160092445A1 (en) 2016-03-31
CN103268338B (zh) 2016-03-30
AU2014267925B2 (en) 2017-08-24
RU2637876C2 (ru) 2017-12-07
CN103268338A (zh) 2013-08-28
US9734164B2 (en) 2017-08-15
AU2014267925A1 (en) 2015-12-03
RU2015153562A (ru) 2017-06-23

Similar Documents

Publication Publication Date Title
WO2014183591A1 (zh) 一种提供图像的方法和服务器装置以及终端装置
CN108304435B (zh) 信息推荐方法、装置、计算机设备及存储介质
US8775401B2 (en) Shape based picture search
TWI740537B (zh) 一種資訊處理方法及裝置、儲存介質
TWI743835B (zh) 一種資訊處理方法及裝置、儲存介質
US9367756B2 (en) Selection of representative images
US20170060867A1 (en) Video and image match searching
CN106575280B (zh) 用于分析用户关联图像以产生非用户生成标签以及利用该生成标签的系统和方法
US11275780B2 (en) Image search device, image search method, electronic device and control method therefor
Gupta et al. Combination of global and local features using DWT with SVM for CBIR
EP3028184A1 (en) Method and system for searching images
WO2019127299A1 (zh) 数据查询方法、电子设备及存储介质
US9665773B2 (en) Searching for events by attendants
CN112069341A (zh) 背景图片生成及搜索结果展示方法、装置、设备和介质
CN106575353B (zh) 基于哈希的媒体搜索
WO2017143852A1 (zh) 一种图片处理方法、装置及电子设备
CN108021654A (zh) 一种相册图像处理方法及装置
CN106407383A (zh) 一种图片排列方法及装置
CN103327153A (zh) 一种联系人分组方法及装置
US8885952B1 (en) Method and system for presenting similar photos based on homographies
US10318843B2 (en) Method and apparatus for image processing and comparison based on spatial relationships between image features
WO2019127300A1 (zh) 数据存储方法、电子设备及存储介质
CN104867026B (zh) 提供商品图像的方法和系统以及输出商品图像的终端装置
US20240070760A1 (en) Information processing apparatus, non-transitory computer readable medium, and information processing method
Lin et al. Smartphone landmark image retrieval based on Lucene and GPS

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14797762

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: IDP00201507266

Country of ref document: ID

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 14891547

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2014267925

Country of ref document: AU

Date of ref document: 20140509

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2015153562

Country of ref document: RU

Kind code of ref document: A

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 22/01/2016)

122 Ep: pct application non-entry in european phase

Ref document number: 14797762

Country of ref document: EP

Kind code of ref document: A1