WO2020199776A1 - 货架空置率计算方法及装置、存储介质 - Google Patents

货架空置率计算方法及装置、存储介质 Download PDF

Info

Publication number
WO2020199776A1
WO2020199776A1 PCT/CN2020/075832 CN2020075832W WO2020199776A1 WO 2020199776 A1 WO2020199776 A1 WO 2020199776A1 CN 2020075832 W CN2020075832 W CN 2020075832W WO 2020199776 A1 WO2020199776 A1 WO 2020199776A1
Authority
WO
WIPO (PCT)
Prior art keywords
shelf
point
image
area
price tag
Prior art date
Application number
PCT/CN2020/075832
Other languages
English (en)
French (fr)
Inventor
刘童
张欢欢
张治国
Original Assignee
京东方科技集团股份有限公司
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 京东方科技集团股份有限公司 filed Critical 京东方科技集团股份有限公司
Publication of WO2020199776A1 publication Critical patent/WO2020199776A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/40Analysis of texture
    • G06T7/41Analysis of texture based on statistical description of texture
    • G06T7/45Analysis of texture based on statistical description of texture using co-occurrence matrix computation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • G06V10/462Salient features, e.g. scale invariant feature transforms [SIFT]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/20Scenes; Scene-specific elements in augmented reality scenes

Definitions

  • the present disclosure relates to the technical field of image processing, in particular to a method and device for calculating shelf vacancy rate, and a storage medium.
  • one of the objectives of the embodiments of the present disclosure is to provide a method and device for calculating shelf vacancy rate, and a storage medium, which can optimize the method for calculating shelf vacancy rate to a certain extent.
  • the first aspect of the embodiments of the present disclosure provides a method for calculating shelf vacancy rate, including:
  • the product positioning area in the shelf image is calculated; the product positioning area is the product The area occupied by the placement area on the shelf in the shelf image;
  • the method for calculating shelf vacancy rate further includes:
  • the commodity zone marker information includes price tag backboard information and price tag information.
  • detecting the price tag backboard information in the shelf image includes:
  • the false price tag backplane edge straight line that is misdetected in the straight line detection result is removed, and the broken edge line of the price tag backplane is connected to obtain the label backplane of the shelf. Board information.
  • detecting the price tag information in the shelf image includes:
  • the suspected price tag area whose second correlation coefficient is greater than the preset coefficient threshold is a price tag.
  • the product placement area includes four vertices, which are the first and second points near the outside of the shelf and the corresponding third and second points near the inside of the shelf in the shelf image. Four points; the lower edge of the shelf image coincides with the lower edge of the shelf, and the center point of the shelf image coincides with the center point of the shelf;
  • Calculating the product placement area in the shelf image according to the information of the commodity zone markers, combined with the positional relationship between the camera and the shelf and the shooting angle of the camera, includes:
  • the horizontal coordinates of the first point and the second point of the commodity seating area in the shelf image are combined to calculate the first The abscissa of the three points and the fourth point;
  • the vertical coordinates of the first point and the second point of the commodity seating area in the shelf image are calculated to calculate Describe the ordinates of the third and fourth points.
  • the method for calculating shelf vacancy rate further includes:
  • the ordinates of the third point and the fourth point of the commodity seating area are greater than the ordinates of the first and second points of the commodity seating area of the previous shelf layer where it is located, then the upper The ordinates of the first point and the second point of the commodity seating area of a shelf layer are replaced with the ordinates of the third point and the fourth point of the commodity seating area;
  • the shelf image is acquired by a camera.
  • the first point and the second point of the product seating area are combined in the shelf image
  • Calculating the ordinates of the third point and the fourth point includes calculating the ordinates of the third point and the fourth point according to the following formula:
  • Y M represents the ordinate of the third point or the fourth point
  • H represents the height of the shelf image
  • ⁇ v represents the viewing angle range of the camera in the vertical direction
  • tan represents the tangent function
  • arctan represents anyway Tangent function
  • d represents the depth of the shelf
  • m represents the distance from the vertical projection point of the camera on the ground to the projection of the edge of the shelf close to the camera on the ground
  • Y N represents the first point or the second
  • the ordinate of the point h 0 represents the height of the camera above the shelf
  • h represents the height of the shelf
  • represents the angle formed in the following way: the angle is the apex of the angle of the camera and the vertical of the camera on the ground The angle formed by the point where the projection point and the edge of the shelf close to the side of the imaging device on the ground projection is the point closest to the vertical projection point is the side of the angle.
  • the horizontal position of the first point and the second point of the commodity seating area in the shelf image is combined. Coordinate, calculating the abscissa of the third point and the fourth point, including calculating the abscissa of the third point and the fourth point according to the following formula:
  • X M represents the abscissa of the third point or the fourth point
  • W represents the width of the shelf image
  • ⁇ h represents the viewing angle range of the camera in the horizontal direction
  • tan represents the tangent function
  • arctan represents the arctangent.
  • Function, d represents the depth of the shelf
  • m represents the distance from the vertical projection point of the camera on the ground to the projection of the edge of the shelf near the camera on the ground
  • X N represents the distance from the third point or the The abscissa of the first point or the second point corresponding to the fourth point.
  • a second aspect of the embodiments of the present disclosure provides a shelf vacancy rate calculation device, including:
  • the memory stores instructions that can be executed by the processor, and when the instructions are executed by the processor, the processor:
  • the product positioning area in the shelf image is calculated; the product positioning area is the product The area occupied by the placement area on the shelf in the shelf image;
  • the product location area is divided into a product area and a background area; and the shelf vacancy rate is calculated according to the ratio of the product area to the background area.
  • the processor when the instruction is executed by the processor, the processor further causes the processor to send prompt information to a designated user if the shelf vacancy rate is greater than a preset vacancy rate threshold.
  • the commodity zone marker information includes price tag backboard information and price tag information.
  • the instructions when executed by the processor, also cause the processor to:
  • the false price tag backplane edge straight line that is misdetected in the straight line detection result is removed, and the broken edge line of the price tag backplane is connected to obtain the label backplane of the shelf. Board information.
  • the instructions when executed by the processor, also cause the processor to:
  • the suspected price tag area whose second correlation coefficient is greater than the preset coefficient threshold is a price tag.
  • the product placement area includes four vertices, which are the first and second points near the outside of the shelf and the corresponding third and second points near the inside of the shelf in the shelf image. Four points; the lower edge of the shelf image coincides with the lower edge of the shelf, and the center point of the shelf image coincides with the center point of the shelf;
  • Calculating the product placement area in the shelf image according to the information of the commodity zone markers, combined with the positional relationship between the camera and the shelf and the shooting angle of the camera, includes:
  • the horizontal coordinates of the first point and the second point of the commodity seating area in the shelf image are combined to calculate the first The abscissa of the three points and the fourth point;
  • the vertical coordinates of the first point and the second point of the commodity seating area in the shelf image are calculated to calculate Describe the ordinates of the third and fourth points.
  • the instructions when executed by the processor, also cause the processor to:
  • the ordinates of the third point and the fourth point of the commodity seating area are greater than the ordinates of the first and second points of the commodity seating area of the previous shelf layer where it is located, then the upper The ordinates of the first point and the second point of the commodity seating area of a shelf layer are replaced with the ordinates of the first point and the second point of the commodity seating area;
  • the processor when the instruction is executed by the processor, the processor also causes the processor to calculate the ordinates of the third point and the fourth point according to the following formula:
  • Y M represents the ordinate of the third point or the fourth point
  • H represents the height of the shelf image
  • ⁇ v represents the viewing angle range of the camera in the vertical direction
  • tan represents the tangent function
  • arctan represents anyway Tangent function
  • d represents the depth of the shelf
  • m represents the distance from the vertical projection point of the camera on the ground to the projection of the edge of the shelf close to the camera on the ground
  • Y N represents the first point or the second
  • the ordinate of the point h 0 represents the height of the camera above the shelf
  • h represents the height of the shelf
  • represents the angle formed in the following way: the angle is the apex of the angle of the camera and the vertical of the camera on the ground The angle formed by the point where the projection point and the edge of the shelf close to the side of the imaging device on the ground projection is the point closest to the vertical projection point is the side of the angle.
  • the processor when the instruction is executed by the processor, the processor also causes the processor to calculate the abscissa of the third point and the fourth point according to the following formula:
  • X M represents the abscissa of the third point or the fourth point
  • W represents the width of the shelf image
  • ⁇ h represents the viewing angle range of the camera in the horizontal direction
  • tan represents the tangent function
  • arctan represents the arctangent.
  • Function, d represents the depth of the shelf
  • m represents the distance from the vertical projection point of the camera on the ground to the projection of the edge of the shelf near the camera on the ground
  • X N represents the distance from the third point or the The abscissa of the first point or the second point corresponding to the fourth point.
  • the third aspect of the embodiments of the present disclosure provides a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of the shelf vacancy rate calculation method when the computer program is executed by a processor.
  • FIG. 1 is a schematic flowchart of a method for calculating shelf vacancy rate in an embodiment of the disclosure
  • 2A is a schematic side view of the positional relationship between the shelf and the camera in an embodiment of the disclosure
  • 2B is a schematic diagram of shelf images in an embodiment of the disclosure.
  • FIG. 2C is an enlarged schematic diagram of an image of a single-layer shelf in an embodiment of the disclosure.
  • 2D is a schematic top view of the positional relationship between the shelf and the camera in an embodiment of the disclosure
  • 2E is a schematic diagram of detecting a straight edge of a label backplane in an embodiment of the disclosure
  • FIG. 3A is a schematic diagram of a process of detecting a price tag in an embodiment of the disclosure
  • 3B is a schematic flowchart of the first correlation coefficient calculation process in an embodiment of the disclosure.
  • FIG. 3C is a schematic diagram of a specific flow of the step of determining a price tag in an embodiment of the present disclosure
  • FIG. 3D is a schematic flowchart of an embodiment of calculating a commodity seating area in an embodiment of the disclosure
  • 3E is a schematic flowchart of another embodiment of calculating a commodity seating area in an embodiment of the disclosure.
  • FIG. 4 is a schematic diagram of functional modules of the device for calculating shelf vacancy rate in an embodiment of the disclosure
  • FIG. 5 is a schematic diagram of the hardware structure of the device for executing the method for calculating the shelf vacancy rate in an embodiment of the disclosure.
  • a method for calculating shelf vacancy rate is proposed, which can optimize the method for calculating shelf vacancy rate to a certain extent.
  • the method for calculating shelf vacancy rate includes the following steps:
  • Step 11 Use the camera to collect shelf images.
  • the shelf image may be obtained from other devices.
  • the shelf image may be obtained from a remote server, generated in real time in a virtual reality (VR) environment, copied through, for example, a portable storage, or the like.
  • VR virtual reality
  • the photographing device may use a device that can collect images such as a camera, and the shelf image is an image of a shelf whose shelf vacancy is to be analyzed.
  • the rectangle BHJC represents the side of the shelf
  • point O is the location of the camera
  • K is the vertical projection of point O on the ground
  • the height of the shelf is h
  • the depth of the shelf is d
  • the point K to J (for example, point J is the shelf
  • the distance between the edge on the vertical projection of the ground near the edge of the camera and the point K) is m
  • the height difference between the camera and the top of the shelf is h 0 .
  • the aforementioned parameters can be obtained through pre-measurement.
  • the installation requirements of the photographing device may be:
  • the lower edge of the shelf image coincides with the lower edge of the shelf, that is, the shelf is parallel to the horizontal direction of the shelf image, and the lower edge of the shelf is the viewing angle of the photographing device
  • the upper edge of the shelf is in the shelf image, that is, the upper limit of the viewing angle of the camera is higher than the upper edge of the shelf;
  • the camera In the horizontal direction, the camera is directly facing the middle point of the shelf, that is, the center point of the shelf image coincides with the center point of the shelf.
  • Step 12 Detect the product partition marker information in the shelf image.
  • the commodity zone marker is mainly the price tag of the commodity. Because for most shelves, each displayed commodity corresponds to a price tag, so the position of the commodity can be determined based on the position of the price tag in the shelf image. distribution area.
  • the method used in price tag detection can be combined with edge detection, template matching and other methods.
  • the commodity zone marker information includes price tag backboard information and price tag information. In this way, based on the price tag backboard information and the price tag information, the product zoning information can be obtained, which can better realize the product zoning.
  • the price tag backboard is a rectangular area where the price tag is placed between the two shelves.
  • the price tag backboard area is distinguished from other areas of the shelf.
  • the input of the price tag backplane detection is the shelf image, and the output is the 4 edge line segment information of the price tag backplane.
  • detecting the price tag backboard information in the shelf image includes:
  • the straight line detection method here can be implemented by using Canny algorithm, Sobel operator, Laplacian operator, Hough transform algorithm and other algorithms;
  • the false price tag backplane edge straight line that is misdetected in the straight line detection result is removed, and the broken edge line of the price tag backplane is connected to obtain the label backplane of the shelf. Board information.
  • a line diagram of the label backplane 220 as shown in FIG. 2E may be obtained.
  • the line graph may include, for example, the detected actual edge line 260 of the label backplane 220, the broken portion 270 of the missed edge line, and/or the misdetected non-edge line 280.
  • the false detection and/or missed detection of the edge line including (but not limited to): light changes, obstructions, excessive image preprocessing, and so on.
  • the method of removing the line edge of the false label backplane detected by mistake may include (but is not limited to), for example, judging the line length, and comparing it or its ratio with respect to the width (or height) of the shelf image
  • the predetermined threshold value is compared, and when it is less than the predetermined threshold value, it can be regarded as a falsely detected false label backplane edge straight line. This is because, usually, the label backplane traverses the entire shelf image, so the length of the edge line of the label backplane or its ratio relative to the shelf image should be large enough.
  • the label backplane is usually rectangular (or trapezoidal due to image distortion)
  • a certain edge line cannot form a rectangular (or trapezoidal) shape with other edge lines, then It can be regarded as a line of false label backplane edge detected by mistake.
  • the method of judging whether it is the edge of the pseudo-label backplane is not limited to the above-mentioned embodiment.
  • the two edge straight lines are judged to have a disconnection less than the threshold length on substantially one straight line, they can be regarded as the edge straight line missed detection, and they are automatically connected into one line. straight line.
  • the shelf image By detecting the information on the backboard of the price tag, the shelf image can be separated by layers accordingly, so that the ordinate of the price tag in the shelf image can be obtained.
  • detecting the price tag information in the shelf image includes:
  • Step 121 Obtain the price tag template image.
  • the price tag template image may be collected in advance according to the pattern of the commodity price tag actually used.
  • the price tag template image can be obtained by replacing specific words with symbols.
  • the price tag template images of different layers on the shelf can be extracted from top to bottom.
  • Step 122 Extract the first image features of the price tag template image and the shelf image.
  • the first image feature is an image feature including at least one of a brightness feature, a color feature, a direction feature, and a gradient feature.
  • the method for extracting the brightness feature includes:
  • the price tag template image and the shelf image are color images, calculate the gray average of the three color channels of red, green and blue (RGB) and generate a gray image, and normalize the gray image, That is, divide the image pixel value by the maximum value of the image pixel to obtain the brightness characteristic image;
  • RGB red, green and blue
  • the price tag template image and the shelf image are grayscale images, then the grayscale images are normalized to obtain brightness characteristics.
  • the method for extracting the color feature includes:
  • the red channel of the marked image is at the pixel point (x, y)
  • the pixel value is r
  • the pixel value of the green channel at the pixel point (x, y) is g
  • the pixel value of the blue channel at the pixel point (x, y) is b
  • the 4 dimensions below the pixel point (x, y) are extracted Color characteristics:
  • the above operations are performed on all the pixels in the image to generate the corresponding four color feature images, and the above four color feature images are respectively normalized to obtain the color features.
  • the method for extracting the direction feature includes:
  • the Gabor wavelet transform is used to extract the features of the price tag template image and the shelf image in four directions of 0 degree, 35 degrees, 90 degrees, and 135 degrees, and normalize them to obtain the directional characteristics.
  • the method for extracting the gradient feature includes:
  • the price tag template image and the shelf image are color images, grayscale the image into a grayscale image; extract the gradient amplitude feature of the grayscale image, and normalize it to obtain the gradient feature;
  • the gradient feature of the grayscale image is directly extracted and normalized to obtain the gradient feature.
  • the gradient of the image function f(x, y) at the point (x, y) is a vector with magnitude and direction.
  • the vector be Gx and Gy, Gx and Gy denote the gradient in the x direction and the y direction, respectively.
  • the vector of this gradient can be expressed as:
  • the direction angle is:
  • the direction of the gradient is the fastest changing direction of the function f(x, y).
  • f(x, y) When there are edges in the image, there must be a larger gradient value. On the contrary, when there are relatively smooth parts in the image, the gray value changes less , The corresponding gradient is also small.
  • the mode of the gradient is referred to as gradient, and the image composed of image gradient is called gradient image.
  • first image feature including the features of brightness, color, direction, and gradient is not the only embodiment of the present disclosure.
  • the features included in the first image feature can be adjusted as needed, such as adding Other features or deletion of features, etc.
  • Step 123 According to the first image feature of the price tag template image and the shelf image, calculate a first correlation coefficient, and generate a price tag saliency map.
  • calculating the first correlation coefficient according to the first image feature of the price tag template image and the shelf image includes:
  • Step 1231 Move the price tag template image in pixels on the shelf image to traverse the shelf image
  • Step 1232 Calculate the first correlation coefficient between the price tag template image and the shelf image covered by it after each movement, that is, calculate the price tag template image and its covered shelf image once for each movement. The first correlation coefficient between the shelf images.
  • the first correlation coefficient between the price tag template image and the shelf image covered by it is calculated once, so that at each position A first correlation coefficient is calculated separately, all the first correlation coefficients are combined, and the position on the shelf image moved by the center point of the price tag template image corresponding to the first correlation coefficient is combined to generate a price tag saliency map.
  • Step 124 Perform adaptive threshold segmentation on the price tag saliency map to obtain a set of center points of the suspected price tag area.
  • Step 125 Determine the suspected price tag area in the shelf image according to the central point set of the suspected price tag area.
  • the price tag saliency map is generated according to the first correlation coefficient and the position on the shelf image of the center point of the price tag template image corresponding to the first correlation coefficient, that is, the plane coordinates of the points of the price tag saliency map Is the position where the center point of the price tag template image corresponding to the first correlation coefficient is moved to the shelf image.
  • the points on the price tag saliency map obtained by adaptive threshold segmentation and screening are a collection of discrete points , And the area with these points as the center point and the size of the price tag template image as the size is the suspect price tag area.
  • the adaptive threshold segmentation is performed on the price tag saliency map to obtain the center point set of the suspected price tag area, including:
  • Binary segmentation is performed on the price tag saliency map using an adaptive threshold segmentation algorithm (such as OTSU, also known as the Otsu method or the maximum between-class variance method), where the foreground area is the set of center points of the suspected price tag area.
  • OTSU adaptive threshold segmentation algorithm
  • the foreground area is the set of center points of the suspected price tag area.
  • Step 126 Extract the second image feature of the suspected price tag area and the price tag template image.
  • the step of extracting the second image feature of the suspected price tag area can also be obtained by processing the entire shelf image (which contains the suspected price tag area) in advance, and can be processed in advance (that is, one The second image feature is extracted from the shelf image at the beginning, instead of extracting after the suspected price tag area is obtained), and it is not limited to only extracting the second image feature from the suspected price tag area.
  • these two second image feature extraction methods can be applied to the present disclosure, and are not specifically limited here.
  • the second image feature is a texture feature including at least one of angular second moment feature, contrast feature, inverse moment feature, correlation feature, and entropy feature.
  • the method of extracting the texture feature includes:
  • the Gray Level Co-occurrence Matrix refers to a common method for describing texture by studying the spatial correlation characteristics of gray levels. Since the texture is formed by the repeated occurrence of grayscale distribution in space, there will be a certain grayscale relationship between two pixels separated by a certain distance in the image space, that is, the spatial correlation characteristics of the grayscale in the image.
  • the gray-level histogram is the statistical result of a single pixel on the image with a certain gray-level, while the gray-level co-occurrence matrix is obtained by statistically calculating the status of two pixels that maintain a certain distance on the image with a certain gray-level.
  • the gray level co-occurrence matrix generation is briefly introduced as follows:
  • the distance difference value (a, b) takes different numerical combinations to obtain the joint probability matrix in different situations.
  • the value of (a, b) should be selected according to the characteristics of the texture period distribution. For finer textures, small difference values such as (1, 0), (1, 1), (2, 0) are selected.
  • the probability of two pixel gray levels occurring at the same time transforms the spatial coordinates of (x, y) into the description of "gray pair" (g1, g2), forming a gray level co-occurrence matrix.
  • the diagonal elements of the gray-level co-occurrence matrix will have relatively large values; if the gray values of the image pixels change locally, they will deviate from the diagonal The elements of the line will have larger values.
  • some scalars can be used to characterize the characteristics of the gray-level co-occurrence matrix.
  • G denote the gray-level co-occurrence matrix.
  • the ASM has a larger Value
  • the value distribution in G is more uniform (such as an image with severe noise)
  • the angular second-order moment is the sum of the squares of the element values of the gray-level co-occurrence matrix, so it is also called energy, which reflects the uniformity of the image grayscale distribution and the thickness of the texture.
  • energy which reflects the uniformity of the image grayscale distribution and the thickness of the texture.
  • the ASM value is small; on the contrary, if some of the values are large and other values are small, the ASM value is large.
  • the elements in the co-occurrence matrix are concentratedly distributed, the ASM value is large at this time.
  • a large ASM value indicates a more uniform and regular texture pattern.
  • Contrast reflects the sharpness of the image and the depth of texture grooves. The deeper the texture groove, the greater the contrast, and the clearer the visual effect; on the contrary, the lower the contrast, the shallower the groove and the blurry effect.
  • the inverse error moment reflects the homogeneity of the image texture and measures how much the image texture changes locally.
  • the inverse moment reflects the clarity and regularity of the texture. The texture is clear, regular, easy to describe, and the value is large; the value is small for the messy and difficult to describe. A large value indicates that the image texture lacks changes between different regions, and the local is very uniform.
  • Correlation reflects the consistency of image texture and is used to measure the degree of similarity of image gray levels in the row or column direction. Therefore, the value of the value reflects the local gray correlation. The larger the value, the greater the correlation. If there are horizontal textures in the image, the COR of the horizontal matrix is greater than the COR values of the remaining matrices. It measures the degree of similarity of spatial gray-level co-occurrence matrix elements in the row or column direction. Therefore, the correlation value reflects the local gray-level correlation in the image. When the matrix element values are uniformly equal, the correlation value is large; on the contrary, if the matrix pixel values differ greatly, the correlation value is small.
  • the entropy will have a larger value.
  • Entropy is a measure of the amount of information the image has. Texture information also belongs to the information of the image. It is a measure of randomness. When all elements in the co-occurrence matrix have the greatest randomness and all values in the spatial co-occurrence matrix are almost equal, the co-occurrence matrix When the middle elements are dispersed, the entropy is larger. It represents the degree of non-uniformity or complexity of the texture in the image.
  • a feature vector can be used to integrate the above features.
  • the integrated feature vector can be regarded as a description of the image texture, which can be further used for classification, identification, retrieval, etc.
  • Step 127 Calculate a second correlation coefficient according to the second image feature of the suspected price tag area and the price tag template image.
  • Step 128 Determine that the suspected price tag area with the second correlation coefficient greater than the preset coefficient threshold is the price tag.
  • the determining that the suspected price tag area where the second correlation coefficient is greater than the preset coefficient threshold is a price tag, including:
  • Step 1281 Sort the suspected price tag regions according to their first correlation coefficient from large to small;
  • Step 1282 Calculate the second correlation coefficient between each suspected price tag area and the second image feature of the price tag template image in sequence according to the arrangement order;
  • Step 1283 Determine the suspected price tag area with the second correlation coefficient greater than the preset coefficient threshold as the price tag, and stop the calculation of the second correlation coefficient when the second correlation coefficient is less than the preset coefficient threshold. In this way, calculation time can be saved and calculation efficiency improved.
  • the preset coefficient threshold can be set as required, such as 0.8, but it is not specifically limited here.
  • the first correlation coefficient is calculated, and the price tag saliency map is generated, and then the suspected price tag area is obtained according to the price tag saliency map, and then the suspected price tag area and the
  • the second image feature of the price tag template is calculated and the second correlation coefficient of the two is calculated, and finally the suspected price tag area with the second correlation coefficient greater than the preset coefficient threshold is determined as the price tag.
  • the calculation method of the commodity zone marker information is not limited to the method provided in the foregoing embodiment, as long as it is other methods that can obtain the commodity zone marker information, it can also be applied to the present disclosure. Do restrictions.
  • Step 13 Calculate the product location area in the shelf image according to the product zone marker information, combining the positional relationship between the camera capturing the shelf image and the shelf and the shooting angle of the camera;
  • the area also referred to as the SKU (Stock Keeping Unit) location area
  • SKU Stock Keeping Unit
  • the product placement area includes four vertices, which are the first and second points near the outside of the shelf and the corresponding third and second points near the inside of the shelf in the shelf image.
  • the positional relationship between the camera and the shelf and the shooting angle of the camera are combined to calculate the product seating area in the shelf image, including :
  • Step 131 Obtain the coordinates of the first point and the second point of the commodity seating area in the shelf image according to the information of the commodity zone markers;
  • Step 132 According to the horizontal position relationship between the photographing device and the shelf and the horizontal photographing angle of view of the photographing device, the horizontal coordinates of the first point and the second point of the commodity seating area in the shelf image are calculated to calculate The abscissa of the third point and the fourth point;
  • Step 133 Combine the vertical coordinates of the first point and the second point of the product seating area in the shelf image according to the vertical position relationship between the camera and the shelf and the vertical shooting angle of the camera , Calculate the ordinates of the third point and the fourth point.
  • Figure 2B is an overall example of the shelf image
  • Figure 2C is an enlarged view of the single-layer shelf image.
  • the quadrangular area EFSR is the surface of the shelf that may be placed in contact with the goods. We call it the "layer positioning area”. "Compared with the image area UFSV of the entire floor, it reflects the actual area occupied by the goods on the shelf, so it is more accurate to judge the shelf vacancy rate based on this.
  • the SKU placement area which is the placement area of each commodity, that is, the commodity placement area, as shown in Figure 2C, EFNM and MNQP And PQSR.
  • the The relationship and imaging principles calculate their corresponding points E, M, P, R at the rear end of the shelf (that is, the points near the inner side of the shelf in the shelf image).
  • the aforementioned commodity zone marker information has been detected. Therefore, the coordinates of the points close to the outside of the shelf in the shelf image, that is, the coordinates of point N (X N , Y N ) can be known. Specifically, the position of the upper left corner of the price tag may be used as the coordinates of the corresponding point in the shelf image close to the outside of the shelf, but the present disclosure is not limited to this.
  • Figure 2A is a side view of the positional relationship between the shelf and the camera, where the rectangle BHJC represents the side of the shelf, point O is the position of the camera, K is the vertical projection of point O on the ground, the height of the shelf h, the depth of the shelf d, K
  • the distance m to J (for example, point J is the point on the vertical projection of the vertical projection of the edge of the shelf close to the camera on the ground that is closest to point K), and the height h 0 of the camera above the shelf can be obtained by measurement.
  • ⁇ AOJ is the viewing angle range of the camera in the vertical direction and is a known parameter of the system, denoted as ⁇ v .
  • ⁇ EOF is denoted as ⁇
  • ⁇ FOJ is denoted as ⁇
  • ⁇ JOK is denoted as ⁇ .
  • the ordinate of the M point in the shelf image can be calculated.
  • Figure 2D is a top view of the positional relationship between the shelf and the camera, where the rectangular EFSR represents the upper surface of the shelf, point O is the location of the camera, the depth of the shelf is d, and the distance from the camera to the shelf is m.
  • ⁇ AOJ is the viewing angle range of the camera in the horizontal direction and is a known parameter of the system, denoted as ⁇ h .
  • T is the midpoint of FS
  • OT is perpendicular to FS
  • ⁇ NOM is denoted as ⁇
  • ⁇ MOT is denoted as ⁇ .
  • the known quantity and the width and height of the shelf image are W and H respectively, and the coordinate values (X N , Y N ) of point N in the shelf image.
  • the quantity we require is the abscissa value X M of the M point in the image.
  • the method for calculating shelf vacancy rate further includes:
  • Step 134 If the ordinates of the third point and the fourth point of the commodity seating area are greater than the ordinates of the first and second points of the commodity seating area of the previous shelf layer where they are located, that is, The third and fourth points on a certain layer of the shelf image are blocked by the image of the upper shelf, so that the third and fourth points cannot be seen in the shelf image, then the The ordinates of the first point and the second point of the commodity seating area are replaced with the ordinates of the third and fourth points of the commodity seating area; the previous shelf layer here refers to the currently calculated shelf layer The shelf layer of the upper layer;
  • Step 135 Construct a first linear function according to the coordinates of the first point in the commodity seating area and the coordinates of the corresponding third point, and according to the coordinates of the second point in the commodity seating area and the corresponding fourth point Point coordinates to construct the second linear function;
  • Step 136 Substitute the ordinate of the first point of the product placement area of the previous shelf into the first linear function, and replace the obtained abscissa with the abscissa of the third point of the commodity placement area ;
  • Step 137 Substitute the ordinate of the second point of the commodity seating area of the previous shelf layer into the second linear function, and replace the obtained abscissa with the abscissa of the fourth point of the commodity seating area.
  • the seating area reflected in the image will be incomplete, making it necessary to correct the calculated seating area, that is, The ordinate is replaced, and the abscissa is calculated according to the replaced ordinate, so as to obtain the corrected product placement area, so that the shelf vacancy rate obtained in the subsequent calculation is more accurate.
  • Step 14 Using an image segmentation method, segment the product location area into a product area and a background area.
  • the image segmentation method may be an image segmentation method based on features such as texture, color, and edge, and the specific method is not limited.
  • Step 15 Calculate the shelf vacancy rate according to the ratio of the commodity area to the background area.
  • the shelf vacancy rate may be the vacancy rate of a certain commodity seating area, or the average of the vacancy rates of all commodities in the entire shelf, etc.
  • the specific calculation standard may be set as required. This is not specifically limited.
  • the method for calculating shelf vacancy rate further includes step 16: If the shelf vacancy rate is greater than a preset vacancy rate threshold, sending prompt information to a designated user. In this way, when the shelf vacancy rate exceeds the threshold, users are reminded to prompt them to replenish goods in time.
  • the preset vacancy rate threshold can be set as required, such as 50%, which is not specifically limited here.
  • the method for calculating shelf vacancy rate is calculated based on the product partition marker information in the shelf image, combined with the positional relationship between the camera and the shelf, and the shooting angle of the camera Commodity placement area, combining the commodity change area and the commodity placement area, calculates the shelf vacancy rate.
  • the shelf vacancy rate is calculated based on this. Avoid counting the non-commodity placement area in the shelf image to get a more accurate shelf vacancy rate.
  • shelf vacancy rate calculation method calculates the seating area based on imaging principles and geometric relationships, and does not require training models for each product, which greatly reduces the workload, and the obtained shelf vacancy rate can better reflect the degree of shortage Accurate information.
  • a shelf vacancy rate calculation device which can optimize the calculation method of the shelf vacancy rate to a certain extent.
  • the shelf vacancy rate calculation device is shown in the form of a functional module in the embodiment of FIG. 4, the actual hardware structure is not limited to this. In fact, it can also adopt the hardware architecture of processor plus memory as shown in FIG. 5. In other words, the processor shown in FIG. 5 can execute the instructions stored in the memory to enable the processor to perform the functions of the modules shown in FIG. 4.
  • the shelf vacancy rate calculation device includes:
  • the acquisition module 21 is used to acquire shelf images using a photographing device or, more generally, to acquire shelf images in any way;
  • the marker detection module 22 is used to detect the product partition marker information in the shelf image
  • the seating area calculation module 23 is used to calculate the product seating area in the shelf image based on the information of the commodity zone markers, combining the positional relationship between the photographing device capturing the shelf image and the shelf and the photographing angle of the photographing device ;
  • the product placement area is the area occupied by the product placement area on the shelf in the shelf image;
  • the vacancy rate calculation module 24 is configured to divide the product location area into a product area and a background area by using an image segmentation method; and calculate the shelf vacancy rate according to the ratio of the product area to the background area.
  • the shelf vacancy rate calculation device further includes a prompt module 25, which is used to send prompt information to designated users if the shelf vacancy rate is greater than a preset vacancy rate threshold. In this way, when the shelf vacancy rate exceeds the threshold, users are reminded to prompt them to replenish goods in time.
  • the commodity zone marker information includes price tag backboard information and price tag information.
  • the marker detection module 22 is used to:
  • the false price tag backplane edge straight line that is misdetected in the straight line detection result is removed, and the broken edge line of the price tag backplane is connected to obtain the label backplane of the shelf. Board information.
  • the marker detection module 22 is used to:
  • the suspected price tag area whose second correlation coefficient is greater than the preset coefficient threshold is a price tag.
  • the product placement area includes four vertices, which are the first and second points near the outside of the shelf and the corresponding third and second points near the inside of the shelf in the shelf image. Four points; the lower edge of the shelf image coincides with the lower edge of the shelf, and the center point of the shelf image coincides with the center point of the shelf;
  • the seating area calculation module 23 is used for:
  • Calculating the product placement area in the shelf image according to the information of the commodity zone markers, combined with the positional relationship between the camera and the shelf and the shooting angle of the camera, includes:
  • the horizontal coordinates of the first point and the second point of the commodity seating area in the shelf image are combined to calculate the first The abscissa of the three points and the fourth point;
  • the vertical coordinates of the first point and the second point of the commodity seating area in the shelf image are calculated to calculate Describe the ordinates of the third and fourth points.
  • the seating area calculation module 23 is used to:
  • the ordinates of the third point and the fourth point of the commodity seating area are greater than the ordinates of the first and second points of the commodity seating area of the previous shelf layer where it is located, then the upper The ordinates of the first point and the second point of the commodity seating area of a shelf layer are replaced with the ordinates of the first point and the second point of the commodity seating area;
  • shelf vacancy rate calculation device has a certain degree of correspondence with the foregoing embodiments of the shelf vacancy rate calculation method, and their effects are basically the same, and will not be repeated here.
  • FIG. 5 it is a schematic diagram of the hardware structure of an embodiment of the apparatus for executing the method for calculating the shelf vacancy rate provided by the present disclosure.
  • the device includes:
  • One or more processors 31 and a memory 32 are taken as an example in FIG. 5.
  • the device for executing the method for calculating the shelf vacancy rate may further include: an input device 33 and an output device 34.
  • the processor 31, the memory 32, the input device 33, and the output device 34 may be connected by a bus or other methods.
  • the connection by a bus is taken as an example.
  • the memory 32 can be used to store non-volatile software programs, non-volatile computer-executable programs and modules, as described in the method for calculating shelf vacancy rate in the embodiment of the present application Corresponding program instructions/modules (for example, the acquisition module 21, the marker detection module 22, the seating area calculation module 23, and the vacancy rate calculation module 24 shown in FIG. 4).
  • the processor 31 executes various functional applications and data processing of the server by running non-volatile software programs, instructions, and modules stored in the memory 32, that is, realizing the shelf vacancy rate calculation method in the foregoing method embodiment.
  • the memory 32 may include a storage program area and a storage data area.
  • the storage program area may store an operating system and an application program required by at least one function; the storage data area may store data created according to the use of the shelf vacancy rate calculation device.
  • the memory 32 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 32 may optionally include a memory remotely provided with respect to the processor 31, and these remote memories may be connected to the member user behavior monitoring device via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
  • the input device 33 can receive inputted numeric or character information, and generate key signal inputs related to user settings and function control of the shelf vacancy rate calculation device.
  • the output device 34 may include a display device such as a display screen. In some embodiments, one or both of the input device 33 and the output device 34 may be optional. In some embodiments, the input device 33 and the output device 34 may be at least partially the same hardware.
  • the one or more modules are stored in the memory 32, and when executed by the one or more processors 31, the shelf vacancy rate calculation method in any of the foregoing method embodiments is executed.
  • the technical effect of the embodiment of the device for executing the method for calculating the shelf vacancy rate is the same as or similar to any of the foregoing method embodiments.
  • An embodiment of the present application provides a non-transitory computer storage medium that stores computer-executable instructions, and the computer-executable instructions can execute the processing method of the list item operation in any of the foregoing method embodiments.
  • the technical effect of the embodiment of the non-transitory computer storage medium is the same as or similar to any of the foregoing method embodiments.
  • the programs can be stored in a computer readable storage.
  • the medium when the program is executed, it may include the procedures of the above-mentioned method embodiments.
  • the storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.
  • the embodiment of the computer program has the same or similar technical effect as any of the foregoing method embodiments.
  • the devices, devices, etc. described in the present disclosure may be various electronic terminal devices, such as mobile phones, personal digital assistants (PDA), tablet computers (PAD), smart TVs, etc., or large-scale terminal devices, such as Servers, etc., therefore, the protection scope of the present disclosure should not be limited to a specific type of device or equipment.
  • the client described in the present disclosure may be applied to any of the above electronic terminal devices in the form of electronic hardware, computer software or a combination of both.
  • the method according to the present disclosure may also be implemented as a computer program executed by a CPU, and the computer program may be stored in a computer-readable storage medium.
  • the computer program executes the above-mentioned functions defined in the method of the present disclosure.
  • the above method steps and system units can also be implemented using a controller and a computer-readable storage medium for storing a computer program that enables the controller to implement the above steps or unit functions.
  • non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory Memory.
  • Volatile memory can include random access memory (RAM), which can act as external cache memory.
  • RAM can be obtained in various forms, such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchronous link DRAM (SLDRAM) and direct RambusRAM (DRRAM).
  • DRAM synchronous RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM Synchronous link DRAM
  • DRRAM direct Rambus RAM
  • the storage devices of the disclosed aspects are intended to include, but are not limited to, these and other suitable types of memory.
  • DSP digital signal processors
  • ASIC dedicated Integrated circuit
  • FPGA field programmable gate array
  • a general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine.
  • the processor may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.
  • the steps of the method or algorithm described in combination with the disclosure herein may be directly included in hardware, a software module executed by a processor, or a combination of the two.
  • the software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
  • An exemplary storage medium is coupled to the processor such that the processor can read information from or write information to the storage medium.
  • the storage medium may be integrated with the processor.
  • the processor and the storage medium may reside in the ASIC.
  • the ASIC can reside in the user terminal.
  • the processor and the storage medium may reside as discrete components in the user terminal.
  • the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted through the computer-readable medium.
  • Computer-readable media include computer storage media and communication media, including any media that facilitates the transfer of a computer program from one location to another.
  • a storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
  • the computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage devices, magnetic disk storage devices or other magnetic storage devices, or may be used for carrying or storing instructions in the form of Or any other medium that can be accessed by a general-purpose or special-purpose computer or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium.
  • coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave to send software from a website, server, or other remote source
  • coaxial cable Cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are all included in the definition of media.
  • magnetic disks and optical disks include compact disks (CDs), laser disks, optical disks, digital versatile disks (DVD), floppy disks, and Blu-ray disks. Disks generally reproduce data magnetically, while optical disks use lasers to optically reproduce data .
  • the combination of the above content should also be included in the scope of computer-readable media.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Image Analysis (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种货架空置率计算方法及装置,包括:获取货架图像(11);检测所述货架图像中的商品分区标志物信息(12);根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区为商品在货架上的放置区域在所述货架图像中所占据的区域(13);利用图像分割方法,将所述商品落位区分割为商品区域和背景区域(14);根据所述商品区域与所述背景区域的比例,计算所述货架空置率(15)。以及一种电子设备和存储介质。

Description

货架空置率计算方法及装置、存储介质
交叉引用
本申请要求于2019年3月29日提交的题为“货架空置率计算方法及装置、电子设备、存储介质”的中国专利申请(申请号:CN201910249974.6)的优先权,在此以全文引用的方式将其并入本文中。
技术领域
本公开涉及图像处理技术领域,特别是指一种货架空置率计算方法及装置、存储介质。
背景技术
常用的基于计算机视觉的方法,利用目标检测方法检测出货架图像中商品的类别和数量,从而判断货架上商品的数目。缺点是需要针对每种商品采集、标注训练样本,并进行模型训练,当商品种类繁多或者变化很快的时候,这种方案很难实现产品化。
超市需要根据货架上商品的情况来确定是否需要补货。现在超市最常用的方法是定期由工作人员巡视货架,当发现货架空置空间较多时进行补货,缺点是消耗人力,还不能及时发现缺货。如果安装摄像头拍摄货架,并采用商品检测实时检测货架上商品的类别和数量,虽然可以根据商品数量来判断缺货情况,但需要对每种商品采集、标注数据和训练模型,工作量太大。
发明内容
有鉴于此,本公开实施例的目的之一在于,提出一种货架空置率计算方法及装置、存储介质,能够在一定程度上优化货架空置率的计算方法。
基于上述目的,本公开实施例的第一个方面,提供了一种货架空置率计算方法,包括:
获取货架图像;
检测所述货架图像中的商品分区标志物信息;
根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区为商品在货架上的放置区域在所述货架图像中所占据的区域;
利用图像分割方法,将所述商品落位区分割为商品区域和背景区域;
根据所述商品区域与所述背景区域的比例,计算所述货架空置率。
在一些实施例中,所述货架空置率计算方法,还包括:
若所述货架空置率大于预设空置率阈值,则向指定用户发送提示信息。
在一些实施例中,所述商品分区标志物信息包括价签背板信息和价签信息。
在一些实施例中,检测所述货架图像中的价签背板信息,包括:
对所述货架图像进行直线检测,得到直线检测结果;
基于价签背板的边缘特性和形状特性,去除所述直线检测结果中误检测到的伪价签背板边缘直线,并连接断裂的价签背板边缘直线,以得到所述货架的标签背板信息。
在一些实施例中,检测所述货架图像中的价签信息,包括:
获取价签模板图像;
提取所述价签模板图像和所述货架图像的第一图像特征;
根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,并生成价签显著图;
对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合;
根据所述疑似价签区域的中心点集合,确定所述货架图像中的疑似价签区域;
提取所述疑似价签区域与所述价签模板图像的第二图像特征;
根据所述疑似价签区域与所述价签模板图像的第二图像特征,计算第二相关系数;
确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签。
在一些实施例中,所述商品落位区包括四个顶点,分别为在所述货架图像中的靠近货架外侧的第一点和第二点以及对应的靠近货架里侧的第三点和第四点;所述货架图像的下边缘与货架的下边缘重合,所述货架图像的中心点与货架的中心点重合;
根据所述商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区,包括:
根据所述商品分区标志物信息,得到所述商品落位区的第一点和第二点在所述货架图像中的坐标;
根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标;
根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标。
在一些实施例中,所述货架空置率计算方法,还包括:
若所述商品落位区的第三点和第四点的纵坐标大于其所在货架层的上一货架层的商品落位区的第一点和第二点的纵坐标,则将所述上一货架层的商品落位区的第一点和第二点的纵坐标替换为所述商品落位区的第三点和第四点的纵坐标;
根据所述商品落位区第一点的坐标以及对应的第三点的坐标,构建第一直线函数,并且,根据所述商品落位区第二点的坐标以及对应的第四点的坐标,构建第二直线函数;
将所述上一货架层的商品落位区的第一点的纵坐标代入所述第一直线函数,得到的横坐标替换为所述商品落位区的第三点的横坐标;
将所述上一货架层的商品落位区的第二点的纵坐标代入所述第二直线函数,得到的横坐标替换为所述商品落位区的第四点的横坐标。
在一些实施例中,所述货架图像是利用拍摄装置来获取的。
在一些实施例中,根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标,包括根据以下公式来计算所述第三点和所述第四点的纵坐标:
Figure PCTCN2020075832-appb-000001
其中,Y M表示所述第三点或所述第四点的纵坐标,H表示所述货架图像的高度,β v表示拍摄装置在竖直方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货 架靠近拍摄装置一侧的边缘在地面的投影之间的距离,Y N表示所述第一点或所述第二点的纵坐标,h 0表示拍摄装置高于货架的高度,h表示货架的高度,以及γ表示以下述方式形成的角:该角以拍摄装置为角的顶点,并以拍摄装置在地面的垂直投影点和货架靠近拍摄装置一侧的边缘在地面的投影上最接近所述垂直投影点的点为角的边的点,所形成的角。
在一些实施例中,根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标,包括根据以下公式来计算所述第三点和所述第四点的横坐标:
Figure PCTCN2020075832-appb-000002
其中,X M表示所述第三点或所述第四点的横坐标,W表示所述货架图像的宽度,β h表示拍摄装置在水平方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,以及X N表示分别与所述第三点或所述第四点相对应的所述第一点或所述第二点的横坐标。
本公开实施例的第二个方面,提供了一种货架空置率计算装置,包括:
处理器;以及,
存储器,存储能够由所述处理器执行的指令,所述指令在被所述处理器执行时使得所述处理器:
获取货架图像;
检测所述货架图像中的商品分区标志物信息;
根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区为商品在货架上的放置区域在所述货架图像中所占据的区域;
利用图像分割方法,将所述商品落位区分割为商品区域和背景区域;以及,根据所述商品区域与所述背景区域的比例,计算所述货架空置率。
在一些实施例中,所述指令在被所述处理器执行时还使得所述处理器:若所述货架空置率大于预设空置率阈值,用于向指定用户发送提示信息。
在一些实施例中,所述商品分区标志物信息包括价签背板信息和价签信息。
在一些实施例中,所述指令在被所述处理器执行时还使得所述处理器:
对所述货架图像进行直线检测,得到直线检测结果;
基于价签背板的边缘特性和形状特性,去除所述直线检测结果中误检测到的伪价签背板边缘直线,并连接断裂的价签背板边缘直线,以得到所述货架的标签背板信息。
在一些实施例中,所述指令在被所述处理器执行时还使得所述处理器:
获取价签模板图像;
提取所述价签模板图像和所述货架图像的第一图像特征;
根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,并生成价签显著图;
对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合;
根据所述疑似价签区域的中心点集合,确定所述货架图像中的疑似价签区域;
提取所述疑似价签区域与所述价签模板图像的第二图像特征;
根据所述疑似价签区域与所述价签模板图像的第二图像特征,计算第二相关系数;
确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签。
在一些实施例中,所述商品落位区包括四个顶点,分别为在所述货架图像中的靠近货架外侧的第一点和第二点以及对应的靠近货架里侧的第三点和第四点;所述货架图像的下边缘与货架的下边缘重合,所述货架图像的中心点与货架的中心点重合;
所述指令在被所述处理器执行时还使得所述处理器:
根据所述商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区,包括:
根据所述商品分区标志物信息,得到所述商品落位区的第一点和第二点在所述货架图像中的坐标;
根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标, 计算所述第三点和第四点的横坐标;
根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标。
在一些实施例中,所述指令在被所述处理器执行时还使得所述处理器:
若所述商品落位区的第三点和第四点的纵坐标大于其所在货架层的上一货架层的商品落位区的第一点和第二点的纵坐标,则将所述上一货架层的商品落位区的第一点和第二点的纵坐标替换为所述商品落位区的第一点和第二点的纵坐标;
根据所述商品落位区第一点的坐标以及对应的第三点的坐标,构建第一直线函数,并且,根据所述商品落位区第二点的坐标以及对应的第四点的坐标,构建第二直线函数;
将所述上一货架层的商品落位区的第一点的纵坐标代入所述第一直线函数,得到的横坐标替换为所述商品落位区的第三点的横坐标;
将所述上一货架层的商品落位区的第二点的纵坐标代入所述第二直线函数,得到的横坐标替换为所述商品落位区的第四点的横坐标。
在一些实施例中,所述指令在被所述处理器执行时还使得所述处理器根据以下公式来计算所述第三点和所述第四点的纵坐标:
Figure PCTCN2020075832-appb-000003
其中,Y M表示所述第三点或所述第四点的纵坐标,H表示所述货架图像的高度,β v表示拍摄装置在竖直方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,Y N表示所述第一点或所述第二点的纵坐标,h 0表示拍摄装置高于货架的高度,h表示货架的高度,以及γ表示以下述方式形成的角:该角以拍摄装置为角的顶点,并以拍摄装置在地面的垂直投影点和货架靠近拍摄装置一侧的边缘在地面的投影上最接近所述垂直投影点的点为角的边的点,所形成的角。
在一些实施例中,所述指令在被所述处理器执行时还使得所述处理器根据以下公式来计算所述第三点和所述第四点的横坐标:
Figure PCTCN2020075832-appb-000004
其中,X M表示所述第三点或所述第四点的横坐标,W表示所述货架图像的宽度,β h表示拍摄装置在水平方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,以及X N表示分别与所述第三点或所述第四点相对应的所述第一点或所述第二点的横坐标。
本公开实施例的第三个方面,提供了一种存储有计算机程序的计算机可读存储介质,其中,所述计算机程序在由处理器执行时实现所述货架空置率计算方法的步骤。
附图说明
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。
图1为本公开实施例中货架空置率计算方法的流程示意图;
图2A为本公开实施例中货架与拍摄装置的位置关系侧视示意图;
图2B为本公开实施例中货架图像的示意图;
图2C为本公开实施例中单层货架图像的放大示意图;
图2D为本公开实施例中货架与拍摄装置的位置关系俯视示意图;
图2E为本公开实施例中检测标签背板的边缘直线时的示意图;
图3A为本公开实施例中检测价签的流程示意图;
图3B为本公开实施例中第一相关系数计算过程的流程示意图;
图3C为本公开实施例中确定价签的步骤的具体流程示意图;
图3D为本公开实施例中商品落位区计算的一个实施例的流程示意图;
图3E为本公开实施例中商品落位区计算的另一实施例的流程示意图;
图4为本公开实施例中所述货架空置率计算装置的功能模块示意图;
图5为本公开实施例中执行所述货架空置率计算方法的装置的硬件结构示意图。
具体实施方式
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。同样,“一个”、“一”或者“该”等类似词语也不表示数量限制,而是表示存在至少一个。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。
本公开实施例的第一个方面,提出了一种货架空置率计算方法,能够在一定程度上优化货架空置率的计算方法。
如图1所示,所述货架空置率计算方法,包括以下步骤:
步骤11:利用拍摄装置采集货架图像。然而本公开不限于此,事实上在另一些实施例中,货架图像可以是从其它设备获取的。例如,货架图像可以是从远程服务器获取的、虚拟现实(VR)环境中实时生成的、通过例如便携式存储器复制的等等。
在一些实施例中,所述拍摄装置可以选用摄像头等可以采集图像的设备,所述货架图像为待分析货架空置情况的货架的图像。
在一些实施例中,所述拍摄装置与货架存在一定的位置关系,参考图2A所示。其中,矩形BHJC代表了货架的侧面,O点为拍摄装置所在位置,K为O点在地面的垂直投影,货架的高度为h,货架的深度为d,K到J(例如,J点是货架靠近拍摄装置一侧的边缘在地面的垂直投影上最接近K点的点)的距离为m,拍摄装置与货架顶部的高度差为h 0。前述的参数均可通过预先 的测量得到。
在一些实施例中,结合参照图2A和图2B所示,拍摄装置的安装要求可为:
在竖直方向上,在拍摄装置所拍摄到的货架图像中,所述货架图像的下边缘与货架的下边缘重合,即货架与货架图像的水平方向平行,且货架下沿为拍摄装置的视角下限;
货架上沿在货架图像中,即拍摄装置的视角上限高于货架上沿;
在水平方向上,拍摄装置正对货架中点,即所述货架图像的中心点与货架的中心点重合。
通过这样的位置关系的预先设定,使得后续的计算过程能够简化,从而提高处理效率。
步骤12:检测所述货架图像中的商品分区标志物信息。
在一些实施例中,商品分区标志物主要是商品的价签,因为对于大多数货架,每种陈列的商品都对应一个价签,所以可以基于价签在货架图像中的位置,来确定商品的分布范围。价签检测采用的方法可以结合边缘检测、模板匹配等方法。
在一些实施例中,所述商品分区标志物信息包括价签背板信息和价签信息。这样,基于价签背板信息和价签信息,得到商品分区信息,能够更好地实现商品分区。
价签背板为两层货架间放置价签的长方形区域,价签背板区域与货架其它区域有一定的区分度。价签背板检测的输入为货架图像,输出为价签背板的4个边缘线段信息。
作为一个实施例,检测所述货架图像中的价签背板信息,包括:
对所述货架图像进行直线检测,得到直线检测结果;在一些实施例中,这里的直线检测方法可以采用Canny算法、Sobel算子,Laplacian算子、霍夫变换算法等算法来实现;
基于价签背板的边缘特性和形状特性,去除所述直线检测结果中误检测到的伪价签背板边缘直线,并连接断裂的价签背板边缘直线,以得到所述货架的标签背板信息。在一些实施例中,在进行直线检测之后,可能得到如图2E所示的标签背板220的线图。如图2E所示,线图中可包括例如检测到的标签背板220的实际边缘直线260、被漏检的边缘直线的断裂部分270、和/ 或被误检测到的非边缘直线280。导致边缘直线的误检和/或漏检的原因多种多样,包括(但不限于):光线变化、障碍物遮挡、图像过度预处理等等。
在一些实施例中,去除误检到的伪标签背板边缘直线的方法可以包括(但不限于)例如判断其线条长度,并将其或其相对于货架图像的宽度(或高度)的比例与预定阈值进行比较,当小于预定阈值时,可将其视为误检测到的伪标签背板边缘直线。这是因为,通常标签背板是例如横贯整个货架图像的,因此标签背板的边缘直线的长度或其相对于货架图像的比例应当足够大。此外,在另一些实施例中,由于标签背板通常是矩形形状的(或由于图像畸变而为梯形形状的),因此如果某条边缘直线无法与其他边缘直线构成矩形(或梯形)形状,则其可以被视为是误检测到的伪标签背板边缘直线。需要注意的是:判断是否是伪标签背板边缘直线的方法不限于上述实施例。此外,在另一些实施例中,如果将两条边缘直线判断为在大体上一条直线上出现少于阈值长度的断开,则可以将其视为边缘直线漏检,并将其自动连接为一条直线。
通过检测价签背板信息,能够相应地把货架图像按层进行分隔,从而能够得到价签在货架图像中的纵坐标。
作为一个实施例,如图3A所示,检测所述货架图像中的价签信息,包括:
步骤121:获取价签模板图像。
这里,所述价签模板图像可以根据实际使用的商品价签的图样进行事先采集。所述价签模板图像可以将其中的具体文字以符号替代而得到。对于同一种类型价签,可由上到下提取货架上不同层的价签模板图像。
步骤122:提取所述价签模板图像和所述货架图像的第一图像特征。
在一些实施例中,所述第一图像特征为包含亮度特征、颜色特征、方向特征和梯度特征中至少一项在内的图像特征。
在一些实施例中,对于图像亮度而言,如果是灰度图像,则亮度与图像的灰度值有关,灰度值越高则图像越亮,因此,提取所述亮度特征的方法,包括:
若所述价签模板图像和所述货架图像为彩色图像,则计算红绿蓝(RGB)3个颜色通道的灰度均值并生成灰度图像,并将所述灰度图像进行归一化,即将图像像素值都除以图像像素最大值,得到亮度特征图像;
若所述价签模板图像和所述货架图像为灰度图像,则将所述灰度图像进行归一化,即可得到亮度特征。
在一些实施例中,提取所述颜色特征的方法,包括:
若所述价签模板图像和所述货架图像为彩色图像,对于像素点(x,y),其中x为行值,y为列值,标记图像的红色通道在像素点(x,y)的像素值为r、绿色通道在像素点(x,y)的像素值为g、蓝色通道在像素点(x,y)的像素值为b,提取像素点(x,y)以下4个维度的颜色特征:
Figure PCTCN2020075832-appb-000005
Figure PCTCN2020075832-appb-000006
Figure PCTCN2020075832-appb-000007
Y=r+g-2(|r-g|+b)
对图像中所有像素点进行上述操作,生成对应的4个颜色特征图像,分别对上述4个颜色特征图像进行归一化,得到颜色特征。
若所述价签模板图像和所述货架图像为灰度图像,则不提取这些颜色特征。
在一些实施例中,提取所述方向特征的方法,包括:
采用伽柏(Gabor)小波变换分别提取所述价签模板图像和所述货架图像的0度、35度、90度、135度共4个方向的特征,并进行归一化,得到方向特征。
在一些实施例中,提取所述梯度特征的方法包括:
若所述价签模板图像和所述货架图像为彩色图像,则将图像灰度化为灰度图像;提取灰度图像的梯度幅值特征,并进行归一化,得到梯度特征;
若所述价签模板图像和所述货架图像为灰度图像,则直接提取灰度图像的梯度特征,并进行归一化,得到梯度特征。
具体地,图像函数f(x,y)在点(x,y)的梯度是一个具有大小和方向的矢量,设该矢量为Gx和Gy,Gx和Gy分别表示x方向和y方向的梯度,这个梯度的矢量可以表示为:
Figure PCTCN2020075832-appb-000008
这个矢量的幅度为:
Figure PCTCN2020075832-appb-000009
方向角为:
Figure PCTCN2020075832-appb-000010
对于数字图像而言,相当于对二维离散函数求梯度,如下:
G(x,y)=dx(i,j)+dy(i,j);
dx(i,j)=I(i+1,j)-I(i,j);
dy(i,j)=I(i,j+1)-I(i,j);
在数字图像中,更多的使用差分来近似导数,最简单的梯度近似表达式如下:
G x=f(x,y)-f(x-1,y)
G y=f(x,y)-f(x,y-1)
梯度的方向是函数f(x,y)变化最快的方向,当图像中存在边缘时,一定有较大的梯度值,相反,当图像中有比较平滑的部分时,灰度值变化较小,则相应的梯度也较小,图像处理中把梯度的模简称为梯度,由图像梯度构成的图像称为梯度图像。
至此,计算得到亮度、颜色、方向和梯度共10个特征,各归一化特征组成的一个特征向量,用于后续计算相关系数。
需要说明的是,前述的包含亮度、颜色、方向和梯度各特征的第一图像特征并不是本公开唯一的实施例,实际上,可以根据需要调整第一图像特征中所包含的特征,例如增加其他特征或对其中的特征进行删减等等。
步骤123:根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,并生成价签显著图。
在一些实施例中,如图3B所示,根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,包括:
步骤1231:在所述货架图像上,将所述价签模板图像以像素为单位移动,以遍历所述货架图像;
步骤1232:计算每次移动后所述价签模板图像与其所覆盖的所述货架图像之间的所述第一相关系数,即每移动一次,计算一次所述价签模板图像与其所覆盖的所述货架图像之间的第一相关系数。
根据前述的第一相关系数的计算方法,即价签模板图像每移动一次,计 算一次所述价签模板图像与其所覆盖的所述货架图像之间的第一相关系数,这样,在每个位置分别计算得到一个第一相关系数,将所有第一相关系数组合起来,结合第一相关系数对应的所述价签模板图像的中心点所移动到货架图像上的位置,即生成价签显著图。所述价签显著图的某一位置的第一相关系数值越大,表征以该位置为中心点的价签所占区域为真实价签的可能性越大。
步骤124:对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合。
步骤125:根据所述疑似价签区域的中心点集合,确定所述货架图像中的疑似价签区域。
这里,价签显著图是根据第一相关系数以及第一相关系数对应的所述价签模板图像的中心点所移动到货架图像上的位置而生成的,即价签显著图的点的平面坐标为第一相关系数对应的所述价签模板图像的中心点所移动到货架图像上的位置,这样,通过自适应阈值分割筛选得到的价签显著图上的点即为一些离散的点的集合,而以这些点为中心点且以价签模板图像的尺寸为大小的区域即为疑似价签区域。
在一些实施例中,对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合,包括:
对所述价签显著图利用自适应阈值分割算法(如OTSU,亦称大津法或最大类间方差法)进行二值分割,其中前景区域为所述疑似价签区域的中心点集合。
步骤126:提取所述疑似价签区域与所述价签模板图像的第二图像特征。
需要说明的是,这里提取所述疑似价签区域的第二图像特征的步骤,也可以是提前对整个货架图像(其中含有疑似价签区域)处理得到的,并且可以预先进行处理(即在一开始就对货架图像提取第二图像特征,而不是在得到疑似价签区域以后再提取),而不仅仅限于仅对疑似价签区域进行第二图像特征的提取。当然这两种第二图像特征提取方式均可应用于本公开,这里并不进行具体限定。
在一些实施例中,所述第二图像特征为包含角二阶矩特征、对比度特征、逆差矩特征、相关性特征、熵特征中至少一项在内的纹理特征。
在一些实施例中,提取所述纹理特征的方法包括:
根据图像生成灰度共生矩阵;
从所述灰度共生矩阵中提取角二阶矩特征、对比度特征、逆差矩特征、相关性特征、熵特征中至少一项,并进行归一化,得到所述纹理特征。
具体地,灰度共生矩阵(GLCM),指的是一种通过研究灰度的空间相关特性来描述纹理的常用方法。由于纹理是由灰度分布在空间位置上反复出现而形成的,因而在图像空间中相隔某距离的两像素之间会存在一定的灰度关系,即图像中灰度的空间相关特性。
灰度直方图是对图像上单个像素具有某个灰度进行统计的结果,而灰度共生矩阵是对图像上保持某距离的两像素分别具有某灰度的状况进行统计得到的。灰度共生矩阵生成简要介绍如下:
取图像(N×N)中任意一点(x,y)及偏离它的另一点(x+a,y+b),设该点对的灰度值为(g1,g2)。令点(x,y)在整个画面上移动,则会得到各种(g1,g2)值,设灰度值的级数为k,则(g1,g2)的组合共有k的平方种。对于整个画面,统计出每一种(g1,g2)值出现的次数,然后排列成一个方阵,再用(g1,g2)出现的总次数将它们归一化为出现的概率P(g1,g2),这样的方阵称为灰度共生矩阵。距离差分值(a,b)取不同的数值组合,可以得到不同情况下的联合概率矩阵。(a,b)取值要根据纹理周期分布的特性来选择,对于较细的纹理,选取(1,0)、(1,1)、(2,0)等小的差分值。
当a=1,b=0时,像素对是水平的,即0度扫描;当a=0,b=1时,像素对是垂直的,即90度扫描;当a=1,b=1时,像素对是右对角线的,即45度扫描;当a=-1,b=1时,像素对是左对角线,即135度扫描。
这样,两个象素灰度级同时发生的概率,就将(x,y)的空间坐标转化为“灰度对”(g1,g2)的描述,形成了灰度共生矩阵。
实验中对灰度共生矩阵进行了如下的归一化:
Figure PCTCN2020075832-appb-000011
直觉上来说,如果图像的是由具有相似灰度值的像素块构成,则灰度共生矩阵的对角元素会有比较大的值;如果图像像素灰度值在局部有变化,那么偏离对角线的元素会有比较大的值。
通常可以用一些标量来表征灰度共生矩阵的特征,令G表示灰度共生矩阵,常用的特征有:
角二阶矩(angular second moment,ASM):
Figure PCTCN2020075832-appb-000012
也即每个矩阵元素的平方和。
如果灰度共生矩阵中的值集中在某一块(比如对连续灰度值图像,值集中在对角线;对结构化的图像,值集中在偏离对角线的位置),则ASM有较大值,若G中的值分布较均匀(如噪声严重的图像),则ASM有较小的值。
角二阶矩是灰度共生矩阵元素值的平方和,所以也称能量,反映了图像灰度分布均匀程度和纹理粗细度,当图像纹理较细致、灰度分布均匀时,能量值较大,反之,较小。如果共生矩阵的所有值均相等,则ASM值小;相反,如果其中一些值大而其它值小,则ASM值大。当共生矩阵中元素集中分布时,此时ASM值大。ASM值大表明一种较均一和规则变化的纹理模式。
对比度(contrast):
Figure PCTCN2020075832-appb-000013
直接反映了某个像素值及其邻域像素值的亮度的对比情况。如果偏离对角线的元素有较大值,即图像亮度值变化很快,则CON会有较大取值,这也符合对比度的定义。对比度反映了图像的清晰度和纹理沟纹深浅的程度。纹理沟纹越深,其对比度越大,视觉效果越清晰;反之,对比度小,则沟纹浅,效果模糊。
逆差矩(inverse difference moment,IDM):
Figure PCTCN2020075832-appb-000014
如果灰度共生矩阵对角元素有较大值,IDM就会取较大的值。因此连续灰度的图像会有较大IDM值。逆差矩反映图像纹理的同质性,度量图像纹理局部变化的多少。逆差矩反映了纹理的清晰程度和规则程度,纹理清晰、规律性较强、易于描述的,值较大;杂乱无章的,难于描述的,值较小。其值大则说明图像纹理的不同区域间缺少变化,局部非常均匀。
相关性(correlation):
Figure PCTCN2020075832-appb-000015
其中,
Figure PCTCN2020075832-appb-000016
Figure PCTCN2020075832-appb-000017
Figure PCTCN2020075832-appb-000018
Figure PCTCN2020075832-appb-000019
相关性反应了图像纹理的一致性,用来度量图像的灰度级在行或列方向上的相似程度,因此值的大小反应了局部灰度相关性,值越大,相关性也越大。如果图像中有水平方向纹理,则水平方向矩阵的COR大于其余矩阵的COR值。它度量空间灰度共生矩阵元素在行或列方向上的相似程度,因此,相关值大小反映了图像中局部灰度相关性。当矩阵元素值均匀相等时,相关值就大;相反,如果矩阵像元值相差很大则相关值小。
熵(entropy):
Figure PCTCN2020075832-appb-000020
若灰度共生矩阵值分布均匀,也即图像近于随机或噪声很大,熵会有较大值。
熵是图像所具有的信息量的度量,纹理信息也属于图像的信息,是一个随机性的度量,当共生矩阵中所有元素有最大的随机性、空间共生矩阵中所有值几乎相等时,共生矩阵中元素分散分布时,熵较大。它表示了图像中纹理的非均匀程度或复杂程度。
最后,可以用一个特征向量将以上特征综合在一起,综合后的特征向量就可以看做是对图像纹理的一种描述,可以进一步用来分类、识别、检索等。
需要说明的是,前述纹理特征所选择的具体特征可以根据需要进行调整、增删,并不局限于前述实施例中所提供的方案。
步骤127:根据所述疑似价签区域与所述价签模板图像的第二图像特征,计算第二相关系数。
步骤128:确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签。
在一些实施例中,如图3C所示,所述确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签,包括:
步骤1281:对疑似价签区域按其第一相关系数由大到小进行排序;
步骤1282:按照排列顺序,依次计算每个疑似价签区域与所述价签模板图像的第二图像特征之间的第二相关系数;
步骤1283:将所述第二相关系数大于预设系数阈值的疑似价签区域确定为价签,当所述第二相关系数小于所述预设系数阈值,则停止第二相关系数的计算。这样,可以节省计算时间,提高计算效率。
这里,需要说明的是,所述预设系数阈值可以根据需要进行设定,例如0.8,但在此并不做具体限定。
这样,通过提取价签模板和货架图像的第一图像特征,以计算第一相关系数,并生成价签显著图,再根据价签显著图得到的疑似价签区域,然后提取疑似价签区域与所述价签模板的第二图像特征并计算二者的第二相关系数,最后将第二相关系数大于预设系数阈值的疑似价签区域确定为价签,采用这样的价签检测方法,能够得到较为准确的货架图像上的价签位置,从而能够根据价签位置实现货架图像的分割,有利于后续的图像比对,以期计算出更准确的货架空置率。
需要说的是,所述商品分区标志物信息的计算方法并不局限于前述实施例中提供的方法,只要是能够得到商品分区标志物信息的其他方法,也能适用于本公开,在此不做限制。
步骤13:根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区(也可称为SKU(Stock Keeping Unit,库存量单位)落位区)为商品在货架上的放置区域在所述货架图像中所占据的区域,参考图2B和图2C所示。
在一些实施例中,所述商品落位区包括四个顶点,分别为在所述货架图像中的靠近货架外侧的第一点和第二点以及对应的靠近货架里侧的第三点和第四点;以图2C中EMNF构成的商品落位区为例,第一点即F点,第二即N点,第三点即E点,第四点即M点。
作为一个实施例,如图3D所示,根据所述商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区,包括:
步骤131:根据所述商品分区标志物信息,得到所述商品落位区的第一 点和第二点在所述货架图像中的坐标;
步骤132:根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标;
步骤133:根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标。
具体地,图2B为货架图像的整体示例,图2C为单层货架图像的放大图,其中的四边形区域EFSR为该层货架与可能摆放的商品接触的表面,我们称为“层落位区”,相对于整个层的图像区域UFSV,它反应的是实际的商品在货架上占据的面积,因此以此为依据判断货架空置率更为准确。
由于一层货架可能被分割成多个商品的摆放区域,我们定义了SKU落位区,即每种商品的落位区域,亦即商品落位区,如图2C中所示的EFNM、MNQP和PQSR。
在本公开的一些实施例中,通过某种方式找到货架图像中货架前端不同商品的分界点F、N、O、S(即在所述货架图像中的靠近货架外侧的点)后,通过几何关系和成像原理计算出它们对应的在货架后端的点E、M、P、R(即在所述货架图像中的靠近货架里侧的点)。
以下,以通过N点坐标(X N,Y N)计算M点坐标(X M,Y M)为例。
前述的商品分区标志物信息已经检测得知,因此,据此可以知道在所述货架图像中的靠近货架外侧的点的坐标,即N点的坐标(X N,Y N)。具体地,可以以价签的左上角的所在位置作为对应的在所述货架图像中的靠近货架外侧的点的坐标,然而本公开不限于此。
图2A为货架与拍摄装置的位置关系侧视图,其中矩形BHJC代表了货架的侧面,O点为摄像头所在位置,K为O点在地面的垂直投影,货架的高度h,货架的深度d,K到J(例如,J点是货架靠近拍摄装置一侧的边缘在地面的垂直投影上最接近K点的点)的距离m,摄像头高于货架的高度h 0,都可以通过测量得到。∠AOJ为拍摄装置在垂直方向的视角范围且为系统已知参数,记为β v。另外图中∠EOF记为δ,∠FOJ记为θ,∠JOK记为γ。已知量还有图像的宽度和高度分别为W和H,F点在图像中的纵坐标值Y F=Y N。我们要求的量是M点在货架图像中的纵坐标值Y M=Y E
根据成像原理有:
Figure PCTCN2020075832-appb-000021
Figure PCTCN2020075832-appb-000022
根据几何关系有:
Figure PCTCN2020075832-appb-000023
Figure PCTCN2020075832-appb-000024
Figure PCTCN2020075832-appb-000025
经过推导,可以得到:
Figure PCTCN2020075832-appb-000026
至此,即可计算得到M点在货架图像中的纵坐标。
图2D为货架与拍摄装置的位置关系俯视图,其中矩形EFSR代表了货架的上表面,O点为拍摄装置所在位置,货架的深度为d,拍摄装置到货架的距离为m,这些参量都可以通过测量得到。∠AOJ为拍摄装置在水平方向的视角范围且为系统已知参数,记为β h。T为FS中点,且OT垂直于FS,另外图中∠AON记为
Figure PCTCN2020075832-appb-000027
∠NOM记为λ,∠MOT记为σ。已知量还有货架图像的宽度和高度分别为W和H,N点在货架图像中的坐标值(X N,Y N)。我们要求的量是M点在图像中的横坐标值X M
根据成像原理有:
Figure PCTCN2020075832-appb-000028
Figure PCTCN2020075832-appb-000029
设NT长度为q,根据几何原理有:
Figure PCTCN2020075832-appb-000030
Figure PCTCN2020075832-appb-000031
Figure PCTCN2020075832-appb-000032
经过推导,可以得到:
Figure PCTCN2020075832-appb-000033
至此,即可计算得到M点在货架图像中的横坐标。
其他商品落位区的靠近货架里侧的点均可采用前述方法计算,在此不再赘述。
进一步地,如图3E所示,所述货架空置率计算方法,还包括:
步骤134:若所述商品落位区的第三点和第四点的纵坐标大于其所在货架层的上一货架层的商品落位区的第一点和第二点的纵坐标,即在货架图像上某一层的第三点和第四点被上一层的货架的图像所遮挡,致使在货架图像中看不到第三点和第四点,则将所述上一货架层的商品落位区的第一点和第二点的纵坐标替换为所述商品落位区的第三点和第四点的纵坐标;这里的上一货架层指的是当前计算的货架层的往上一层的货架层;
步骤135:根据所述商品落位区第一点的坐标以及对应的第三点的坐标,构建第一直线函数,并且,根据所述商品落位区第二点的坐标以及对应的第四点的坐标,构建第二直线函数;
步骤136:将所述上一货架层的商品落位区的第一点的纵坐标代入所述第一直线函数,得到的横坐标替换为所述商品落位区的第三点的横坐标;
步骤137:将所述上一货架层的商品落位区的第二点的纵坐标代入所述第二直线函数,得到的横坐标替换为所述商品落位区的第四点的横坐标。
这样,若商品落位区的靠近货架里侧的点被上一层货架所遮挡,则体现在图像中的落位区将不完整,使得需要对计算出的落位区进行修正,即,将纵坐标进行替换,并根据该替换后的纵坐标计算横坐标,从而得到修正的商品落位区,使后续计算得到的货架空置率更为准确。
步骤14:利用图像分割方法,将所述商品落位区分割为商品区域和背景区域。在一些实施例中,所述图像分割方法可以选用基于纹理、颜色、边缘等特征的图像分割方法,具体方法不做限定。
步骤15:根据所述商品区域与所述背景区域的比例,计算所述货架空置率。在一些实施例中,所述货架空置率可以是某一个商品落位区的空置率,也可以是整个货架的所有商品的空置率的平均值等,具体计算标准可以根据需要进行设定,在此不做具体限定。
在一些实施例中,所述货架空置率计算方法,还包括步骤16:若所述货架空置率大于预设空置率阈值,则向指定用户发送提示信息。这样,当货架空置率超过阈值时提醒用户,促使其及时补货。在一些实施例中,所述预设空置率阈值可根据需要进行设定,如50%,在此不做具体限定。
从上述实施例可以看出,本公开提供的货架空置率计算方法,根据所述货架图像中的商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算得到商品落位区,结合商品变化区域和商品落位区,计算货架空置率,这样,通过确定商品落位区,确定货架图像中的实际放置商品的空间,再以此为基础计算货架空置率,避免将货架图像中非商品放置区计算在内,能够得到更为准确的货架空置率。此外,本公开提供的货架空置率计算方法,基于成像原理和几何关系计算落位区,无需针对每种商品训练模型,大大降低了工作量,而且得到的货架空置率更能反应缺货程度的准确信息。
本公开实施例的第二个方面,提出了一种货架空置率计算装置,能够在一定程度上优化货架空置率的计算方法。需要注意的是:尽管在图4的实施例中以功能模块的形式来示出了货架空置率计算装置,然而其实际硬件结构不限于此。事实上,其也可以采用例如图5所示的处理器加存储器的硬件架构。换言之,可以通过让图5所示的处理器执行存储器中存储的指令来使得处理器能够执行如图4所示的各个模块的功能。
如图4所示,所述货架空置率计算装置包括:
采集模块21,用于利用拍摄装置采集货架图像或更一般地以任何方式来获取货架图像;
标志物检测模块22,用于检测所述货架图像中的商品分区标志物信息;
落位区计算模块23,用于根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区为商品在货架上的放置区域在所述货架图像中所占据的区域;
空置率计算模块24,用于利用图像分割方法,将所述商品落位区分割为商品区域和背景区域;以及,根据所述商品区域与所述背景区域的比例,计算所述货架空置率。
在一些实施例中,所述货架空置率计算装置,还包括提示模块25,若所述货架空置率大于预设空置率阈值,用于向指定用户发送提示信息。这样,当货架空置率超过阈值时提醒用户,促使其及时补货。
在一些实施例中,所述商品分区标志物信息包括价签背板信息和价签信息。
在一些实施例中,所述标志物检测模块22,用于:
对所述货架图像进行直线检测,得到直线检测结果;
基于价签背板的边缘特性和形状特性,去除所述直线检测结果中误检测到的伪价签背板边缘直线,并连接断裂的价签背板边缘直线,以得到所述货架的标签背板信息。
在一些实施例中,所述标志物检测模块22,用于:
获取价签模板图像;
提取所述价签模板图像和所述货架图像的第一图像特征;
根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,并生成价签显著图;
对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合;
根据所述疑似价签区域的中心点集合,确定所述货架图像中的疑似价签区域;
提取所述疑似价签区域与所述价签模板图像的第二图像特征;
根据所述疑似价签区域与所述价签模板图像的第二图像特征,计算第二相关系数;
确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签。
在一些实施例中,所述商品落位区包括四个顶点,分别为在所述货架图像中的靠近货架外侧的第一点和第二点以及对应的靠近货架里侧的第三点和第四点;所述货架图像的下边缘与货架的下边缘重合,所述货架图像的中心点与货架的中心点重合;
所述落位区计算模块23,用于:
根据所述商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区,包括:
根据所述商品分区标志物信息,得到所述商品落位区的第一点和第二点 在所述货架图像中的坐标;
根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标;
根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标。
在一些实施例中,所述落位区计算模块23,用于:
若所述商品落位区的第三点和第四点的纵坐标大于其所在货架层的上一货架层的商品落位区的第一点和第二点的纵坐标,则将所述上一货架层的商品落位区的第一点和第二点的纵坐标替换为所述商品落位区的第一点和第二点的纵坐标;
根据所述商品落位区第一点的坐标以及对应的第三点的坐标,构建第一直线函数,并且,根据所述商品落位区第二点的坐标以及对应的第四点的坐标,构建第二直线函数;
将所述上一货架层的商品落位区的第一点的纵坐标代入所述第一直线函数,得到的横坐标替换为所述商品落位区的第三点的横坐标;
将所述上一货架层的商品落位区的第二点的纵坐标代入所述第二直线函数,得到的横坐标替换为所述商品落位区的第四点的横坐标。
需要说明的是,上述货架空置率计算装置的各实施例,与前述的货架空置率计算方法的实施例存在一定程度的对应关系,其效果也基本相同,在此不再赘述。
本公开实施例的第三个方面,提出了一种执行所述货架空置率计算方法的装置的一个实施例。如图5所示,为本公开提供的执行所述货架空置率计算方法的装置的一个实施例的硬件结构示意图。
如图5所示,所述装置包括:
一个或多个处理器31以及存储器32,图5中以一个处理器31为例。
所述执行所述货架空置率计算方法的装置还可以包括:输入装置33和输出装置34。
处理器31、存储器32、输入装置33和输出装置34可以通过总线或者其 他方式连接,图5中以通过总线连接为例。
存储器32作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中的所述货架空置率计算方法对应的程序指令/模块(例如,附图4所示的采集模块21、标志物检测模块22、落位区计算模块23和空置率计算模块24)。处理器31通过运行存储在存储器32中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例的货架空置率计算方法。
存储器32可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据货架空置率计算装置的使用所创建的数据等。此外,存储器32可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器32可选包括相对于处理器31远程设置的存储器,这些远程存储器可以通过网络连接至会员用户行为监控装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置33可接收输入的数字或字符信息,以及产生与货架空置率计算装置的用户设置以及功能控制有关的键信号输入。输出装置34可包括显示屏等显示设备。在一些实施例中,输入装置33和输出装置34中的一者或二者可以是可选的。在一些实施例中,输入装置33和输出装置34可以至少部分地是同一硬件。
所述一个或者多个模块存储在所述存储器32中,当被所述一个或者多个处理器31执行时,执行上述任意方法实施例中的货架空置率计算方法。所述执行所述货架空置率计算方法的装置的实施例,其技术效果与前述任意方法实施例相同或者类似。
本申请实施例提供了一种非暂态计算机存储介质,所述计算机存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述任意方法实施例中的列表项操作的处理方法。所述非暂态计算机存储介质的实施例,其技术效果与前述任意方法实施例相同或者类似。
最后需要说明的是,本领域普通技术人员可以理解实现上述实施例方法 中的全部或部分流程,是可以通过计算机程序来指令相关硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。所述计算机程序的实施例,其技术效果与前述任意方法实施例相同或者类似。
此外,典型地,本公开所述的装置、设备等可为各种电子终端设备,例如手机、个人数字助理(PDA)、平板电脑(PAD)、智能电视等,也可以是大型终端设备,如服务器等,因此本公开的保护范围不应限定为某种特定类型的装置、设备。本公开所述的客户端可以是以电子硬件、计算机软件或两者的组合形式应用于上述任意一种电子终端设备中。
此外,根据本公开的方法还可以被实现为由CPU执行的计算机程序,该计算机程序可以存储在计算机可读存储介质中。在该计算机程序被CPU执行时,执行本公开的方法中限定的上述功能。
此外,上述方法步骤以及系统单元也可以利用控制器以及用于存储使得控制器实现上述步骤或单元功能的计算机程序的计算机可读存储介质实现。
此外,应该明白的是,本文所述的计算机可读存储介质(例如,存储器)可以是易失性存储器或非易失性存储器,或者可以包括易失性存储器和非易失性存储器两者。作为例子而非限制性的,非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦写可编程ROM(EEPROM)或快闪存储器。易失性存储器可以包括随机存取存储器(RAM),该RAM可以充当外部高速缓存存储器。作为例子而非限制性的,RAM可以以多种形式获得,比如同步RAM(DRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据速率SDRAM(DDR SDRAM)、增强SDRAM(ESDRAM)、同步链路DRAM(SLDRAM)以及直接RambusRAM(DRRAM)。所公开的方面的存储设备意在包括但不限于这些和其它合适类型的存储器。
本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。为了清楚地说明硬件和软件的这种可互换性,已经就各种示意性组件、方块、模块、电路和步骤的功能对其进行了一般性的描述。这种功能是被实 现为软件还是被实现为硬件取决于具体应用以及施加给整个系统的设计约束。本领域技术人员可以针对每种具体应用以各种方式来实现所述的功能,但是这种实现决定不应被解释为导致脱离本公开的范围。
结合这里的公开所描述的各种示例性逻辑块、模块和电路可以利用被设计成用于执行这里所述功能的下列部件来实现或执行:通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或其它可编程逻辑器件、分立门或晶体管逻辑、分立的硬件组件或者这些部件的任何组合。通用处理器可以是微处理器,但是可替换地,处理器可以是任何传统处理器、控制器、微控制器或状态机。处理器也可以被实现为计算设备的组合,例如,DSP和微处理器的组合、多个微处理器、一个或多个微处理器结合DSP核、或任何其它这种配置。
结合这里的公开所描述的方法或算法的步骤可以直接包含在硬件中、由处理器执行的软件模块中或这两者的组合中。软件模块可以驻留在RAM存储器、快闪存储器、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、可移动盘、CD-ROM、或本领域已知的任何其它形式的存储介质中。示例性的存储介质被耦合到处理器,使得处理器能够从该存储介质中读取信息或向该存储介质写入信息。在一个替换方案中,所述存储介质可以与处理器集成在一起。处理器和存储介质可以驻留在ASIC中。ASIC可以驻留在用户终端中。在一个替换方案中,处理器和存储介质可以作为分立组件驻留在用户终端中。
在一个或多个示例性设计中,所述功能可以在硬件、软件、固件或其任意组合中实现。如果在软件中实现,则可以将所述功能作为一个或多个指令或代码存储在计算机可读介质上或通过计算机可读介质来传送。计算机可读介质包括计算机存储介质和通信介质,该通信介质包括有助于将计算机程序从一个位置传送到另一个位置的任何介质。存储介质可以是能够被通用或专用计算机访问的任何可用介质。作为例子而非限制性的,该计算机可读介质可以包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储设备、磁盘存储设备或其它磁性存储设备,或者是可以用于携带或存储形式为指令或数据结构的所需程序代码并且能够被通用或专用计算机或者通用或专用处理器访问的任何其它介质。此外,任何连接都可以适当地称为计算机可读介质。例如,如果使用同轴线缆、光纤线缆、双绞线、数字用户线路(DSL)或诸如 红外线、无线电和微波的无线技术来从网站、服务器或其它远程源发送软件,则上述同轴线缆、光纤线缆、双绞线、DSL或诸如红外先、无线电和微波的无线技术均包括在介质的定义。如这里所使用的,磁盘和光盘包括压缩盘(CD)、激光盘、光盘、数字多功能盘(DVD)、软盘、蓝光盘,其中磁盘通常磁性地再现数据,而光盘利用激光光学地再现数据。上述内容的组合也应当包括在计算机可读介质的范围内。
公开的示例性实施例,但是应当注公开的示例性实施例,但是应当注意,在不背离权利要求限定的本公开的范围的前提下,可以进行多种改变和修改。根据这里描述的公开实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。此外,尽管本公开的元素可以以个体形式描述或要求,但是也可以设想多个,除非明确限制为单数。
应当理解的是,在本文中使用的,除非上下文清楚地支持例外情况,单数形式“一个”(“a”、“an”、“the”)旨在也包括复数形式。还应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任意和所有可能组合。
上述本公开实施例序号仅仅为了描述,不代表实施例的优劣。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本公开的范围(包括权利要求)被限于这些例子;在本公开实施例的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,并存在如上所述的本公开实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。因此,凡在本公开实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本公开实施例的保护范围之内。

Claims (19)

  1. 一种货架空置率计算方法,包括:
    获取货架图像;
    检测所述货架图像中的商品分区标志物信息;
    根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区为商品在货架上的放置区域在所述货架图像中所占据的区域;
    利用图像分割方法,将所述商品落位区分割为商品区域和背景区域;
    根据所述商品区域与所述背景区域的比例,计算所述货架空置率。
  2. 根据权利要求1所述的方法,还包括:
    若所述货架空置率大于预设空置率阈值,则向指定用户发送提示信息。
  3. 根据权利要求1所述的方法,其中,所述商品分区标志物信息包括价签背板信息和价签信息。
  4. 根据权利要求3所述的方法,其中,检测所述货架图像中的价签背板信息,包括:
    对所述货架图像进行直线检测,得到直线检测结果;
    基于价签背板的边缘特性和形状特性,去除所述直线检测结果中误检测到的伪价签背板边缘直线,并连接断裂的价签背板边缘直线,以得到所述货架的标签背板信息。
  5. 根据权利要求3所述的方法,其中,检测所述货架图像中的价签信息,包括:
    获取价签模板图像;
    提取所述价签模板图像和所述货架图像的第一图像特征;
    根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,并生成价签显著图;
    对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合;
    根据所述疑似价签区域的中心点集合,确定所述货架图像中的疑似价签区域;
    提取所述疑似价签区域与所述价签模板图像的第二图像特征;
    根据所述疑似价签区域与所述价签模板图像的第二图像特征,计算第二相关系数;
    确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签。
  6. 根据权利要求1所述的方法,其中,所述商品落位区包括四个顶点,分别为在所述货架图像中的靠近货架外侧的第一点和第二点以及对应的靠近货架里侧的第三点和第四点;所述货架图像的下边缘与货架的下边缘重合,所述货架图像的中心点与货架的中心点重合;
    根据所述商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区,包括:
    根据所述商品分区标志物信息,得到所述商品落位区的第一点和第二点在所述货架图像中的坐标;
    根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标;
    根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标。
  7. 根据权利要求6所述的方法,还包括:
    若所述商品落位区的第三点和第四点的纵坐标大于其所在货架层的上一货架层的商品落位区的第一点和第二点的纵坐标,则将所述上一货架层的商品落位区的第一点和第二点的纵坐标替换为所述商品落位区的第三点和第四点的纵坐标;
    根据所述商品落位区第一点的坐标以及对应的第三点的坐标,构建第一直线函数,并且,根据所述商品落位区第二点的坐标以及对应的第四点的坐标,构建第二直线函数;
    将所述上一货架层的商品落位区的第一点的纵坐标代入所述第一直线函数,得到的横坐标替换为所述商品落位区的第三点的横坐标;
    将所述上一货架层的商品落位区的第二点的纵坐标代入所述第二直线函数,得到的横坐标替换为所述商品落位区的第四点的横坐标。
  8. 根据权利要求6所述的方法,其中,根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点 和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标,包括根据以下公式来计算所述第三点和所述第四点的纵坐标:
    Figure PCTCN2020075832-appb-100001
    其中,Y M表示所述第三点或所述第四点的纵坐标,H表示所述货架图像的高度,β v表示拍摄装置在竖直方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,Y N表示所述第一点或所述第二点的纵坐标,h 0表示拍摄装置高于货架的高度,h表示货架的高度,以及γ表示以下述方式形成的角:该角以拍摄装置为角的顶点,并以拍摄装置在地面的垂直投影点和货架靠近拍摄装置一侧的边缘在地面的投影上最接近所述垂直投影点的点为角的边的点,所形成的角。
  9. 根据权利要求6所述的方法,其中,根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标,包括根据以下公式来计算所述第三点和所述第四点的横坐标:
    Figure PCTCN2020075832-appb-100002
    其中,X M表示所述第三点或所述第四点的横坐标,W表示所述货架图像的宽度,β h表示拍摄装置在水平方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,以及X N表示分别与所述第三点或所述第四点相对应的所述第一点或所述第二点的横坐标。
  10. 一种货架空置率计算装置,包括:
    处理器;以及,
    存储器,存储能够由所述处理器执行的指令,所述指令在被所述处理器执行时使得所述处理器:
    获取货架图像;
    检测所述货架图像中的商品分区标志物信息;
    根据所述商品分区标志物信息,结合捕捉所述货架图像的拍摄装置与货 架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区;所述商品落位区为商品在货架上的放置区域在所述货架图像中所占据的区域;
    利用图像分割方法,将所述商品落位区分割为商品区域和背景区域;以及,根据所述商品区域与所述背景区域的比例,计算所述货架空置率。
  11. 根据权利要求10所述的装置,其中,所述指令在被所述处理器执行时还使得所述处理器:若所述货架空置率大于预设空置率阈值,用于向指定用户发送提示信息。
  12. 根据权利要求10所述的装置,其中,所述商品分区标志物信息包括价签背板信息和价签信息。
  13. 根据权利要求12所述的装置,其中,所述指令在被所述处理器执行时还使得所述处理器:
    对所述货架图像进行直线检测,得到直线检测结果;
    基于价签背板的边缘特性和形状特性,去除所述直线检测结果中误检测到的伪价签背板边缘直线,并连接断裂的价签背板边缘直线,以得到所述货架的标签背板信息。
  14. 根据权利要求12所述的装置,其中,所述指令在被所述处理器执行时还使得所述处理器:
    获取价签模板图像;
    提取所述价签模板图像和所述货架图像的第一图像特征;
    根据所述价签模板图像和所述货架图像的第一图像特征,计算第一相关系数,并生成价签显著图;
    对所述价签显著图进行自适应阈值分割,得到疑似价签区域的中心点集合;
    根据所述疑似价签区域的中心点集合,确定所述货架图像中的疑似价签区域;
    提取所述疑似价签区域与所述价签模板图像的第二图像特征;
    根据所述疑似价签区域与所述价签模板图像的第二图像特征,计算第二相关系数;
    确定所述第二相关系数大于预设系数阈值的疑似价签区域为价签。
  15. 根据权利要求10所述的装置,其中,所述商品落位区包括四个顶点,分别为在所述货架图像中的靠近货架外侧的第一点和第二点以及对应的靠近 货架里侧的第三点和第四点;所述货架图像的下边缘与货架的下边缘重合,所述货架图像的中心点与货架的中心点重合;
    其中,所述指令在被所述处理器执行时还使得所述处理器:
    根据所述商品分区标志物信息,结合所述拍摄装置与货架的位置关系以及拍摄装置的拍摄视角,计算所述货架图像中的商品落位区,包括:
    根据所述商品分区标志物信息,得到所述商品落位区的第一点和第二点在所述货架图像中的坐标;
    根据所述拍摄装置与货架的水平位置关系以及所述拍摄装置的水平拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的横坐标,计算所述第三点和第四点的横坐标;
    根据所述拍摄装置与货架的竖直位置关系以及所述拍摄装置的竖直拍摄视角,结合所述商品落位区的第一点和第二点在所述货架图像中的纵坐标,计算所述第三点和第四点的纵坐标。
  16. 根据权利要求15所述的装置,其中,所述指令在被所述处理器执行时还使得所述处理器:
    若所述商品落位区的第三点和第四点的纵坐标大于所述商品落位区所在货架层的上一货架层的商品落位区的第一点和第二点的纵坐标,则将所述上一货架层的商品落位区的第一点和第二点的纵坐标替换为所述商品落位区的第一点和第二点的纵坐标;
    根据所述商品落位区第一点的坐标以及对应的第三点的坐标,构建第一直线函数,并且,根据所述商品落位区第二点的坐标以及对应的第四点的坐标,构建第二直线函数;
    将所述上一货架层的商品落位区的第一点的纵坐标代入所述第一直线函数,得到的横坐标替换为所述商品落位区的第三点的横坐标;
    将所述上一货架层的商品落位区的第二点的纵坐标代入所述第二直线函数,得到的横坐标替换为所述商品落位区的第四点的横坐标。
  17. 根据权利要求15所述的装置,其中,所述指令在被所述处理器执行时还使得所述处理器根据以下公式来计算所述第三点和所述第四点的纵坐标:
    Figure PCTCN2020075832-appb-100003
    其中,Y M表示所述第三点或所述第四点的纵坐标,H表示所述货架图像的高度,β v表示拍摄装置在竖直方向的视角范围,tan表示正切函数,arctan表 示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,Y N表示所述第一点或所述第二点的纵坐标,h 0表示拍摄装置高于货架的高度,h表示货架的高度,以及γ表示以下述方式形成的角:该角以拍摄装置为角的顶点,并以拍摄装置在地面的垂直投影点和货架靠近拍摄装置一侧的边缘在地面的投影上最接近所述垂直投影点的点为角的边的点,所形成的角。
  18. 根据权利要求15所述的装置,其中,所述指令在被所述处理器执行时还使得所述处理器根据以下公式来计算所述第三点和所述第四点的横坐标:
    Figure PCTCN2020075832-appb-100004
    其中,X M表示所述第三点或所述第四点的横坐标,W表示所述货架图像的宽度,β h表示拍摄装置在水平方向的视角范围,tan表示正切函数,arctan表示反正切函数,d表示货架深度,m表示从拍摄装置在地面的垂直投影点到货架靠近拍摄装置一侧的边缘在地面的投影之间的距离,以及X N表示分别与所述第三点或所述第四点相对应的所述第一点或所述第二点的横坐标。
  19. 一种存储有计算机程序的计算机可读存储介质,其中,所述计算机程序在由处理器执行时实现权利要求1-9中任一项所述的方法的步骤。
PCT/CN2020/075832 2019-03-29 2020-02-19 货架空置率计算方法及装置、存储介质 WO2020199776A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910249974.6 2019-03-29
CN201910249974.6A CN109977886B (zh) 2019-03-29 2019-03-29 货架空置率计算方法及装置、电子设备、存储介质

Publications (1)

Publication Number Publication Date
WO2020199776A1 true WO2020199776A1 (zh) 2020-10-08

Family

ID=67081603

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/075832 WO2020199776A1 (zh) 2019-03-29 2020-02-19 货架空置率计算方法及装置、存储介质

Country Status (2)

Country Link
CN (1) CN109977886B (zh)
WO (1) WO2020199776A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434584A (zh) * 2020-11-16 2021-03-02 浙江大华技术股份有限公司 货架商品余量计算方法、装置、计算机设备和存储介质
CN117974989A (zh) * 2024-03-28 2024-05-03 济宁市市政园林养护中心 一种园林植物病虫害区域快速检测方法

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109977886B (zh) * 2019-03-29 2021-03-09 京东方科技集团股份有限公司 货架空置率计算方法及装置、电子设备、存储介质
CN110363703B (zh) * 2019-07-17 2023-06-16 帷幄匠心科技(杭州)有限公司 基于深度摄像头的货架监控方法
CN112308869A (zh) * 2019-07-30 2021-02-02 阿里巴巴集团控股有限公司 图像采集方法、装置、电子设备及计算机存储介质
CN110516628A (zh) * 2019-08-29 2019-11-29 上海扩博智能技术有限公司 货架空缺位置商品信息获取方法、系统、设备及存储介质
CN110781780B (zh) * 2019-10-11 2023-04-07 浙江大华技术股份有限公司 空置检测方法及相关装置
CN113128813A (zh) * 2019-12-31 2021-07-16 杭州海康机器人技术有限公司 调度货架的方法、装置、仓库系统及存储介质
CN113264313A (zh) * 2020-06-12 2021-08-17 深圳市海柔创新科技有限公司 取/放货的拍摄方法、拍摄模块以及搬运机器人
CN111539429B (zh) * 2020-06-19 2020-11-03 天津施格机器人科技有限公司 一种基于图像几何特征的周转箱自动定位方法
CN111783627B (zh) * 2020-06-29 2023-10-27 杭州海康威视数字技术股份有限公司 商品存量确定方法、装置及设备
CN112489240B (zh) * 2020-11-09 2021-08-13 上海汉时信息科技有限公司 一种商品陈列巡检方法、巡检机器人以及存储介质
CN112883955B (zh) * 2021-03-10 2024-02-02 洛伦兹(北京)科技有限公司 货架布局检测方法、装置及计算机可读存储介质
CN113935774A (zh) * 2021-10-15 2022-01-14 北京百度网讯科技有限公司 图像处理方法、装置、电子设备及计算机存储介质
CN116682209A (zh) * 2023-06-15 2023-09-01 南昌交通学院 一种基于机器视觉的自动售货机库存管理方法及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101149792A (zh) * 2006-09-21 2008-03-26 国际商业机器公司 使用移动盘存机器人来执行盘存的系统和方法
CN102523758A (zh) * 2010-08-31 2012-06-27 新日铁系统集成株式会社 增强现实提供系统、信息处理终端、信息处理装置、增强现实提供方法、信息处理方法以及程序
CN102982332A (zh) * 2012-09-29 2013-03-20 顾坚敏 基于云处理方式的零售终端货架影像智能分析系统
CN105701519A (zh) * 2014-12-10 2016-06-22 株式会社理光 基于超像素的图像的实际货架图景象分析
CN109190919A (zh) * 2018-08-10 2019-01-11 上海扩博智能技术有限公司 零售关键业绩指标生成方法、系统、设备及存储介质
CN109977886A (zh) * 2019-03-29 2019-07-05 京东方科技集团股份有限公司 货架空置率计算方法及装置、电子设备、存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8189855B2 (en) * 2007-08-31 2012-05-29 Accenture Global Services Limited Planogram extraction based on image processing
US20140195373A1 (en) * 2013-01-10 2014-07-10 International Business Machines Corporation Systems and methods for managing inventory in a shopping store
US20180181906A1 (en) * 2015-06-17 2018-06-28 Panasonic Intellectual Property Management Co., Ltd. Stock management apparatus, method and system
US20180218494A1 (en) * 2017-01-31 2018-08-02 Focal Systems, Inc. Out-of-stock detection based on images
CN108846401A (zh) * 2018-05-30 2018-11-20 京东方科技集团股份有限公司 商品检测终端、方法、系统以及计算机设备、可读介质
CN109241877B (zh) * 2018-08-20 2021-08-10 北京旷视科技有限公司 一种轨迹识别系统、方法、装置及其计算机存储介质
CN109330284B (zh) * 2018-09-21 2020-08-11 京东方科技集团股份有限公司 一种货架系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101149792A (zh) * 2006-09-21 2008-03-26 国际商业机器公司 使用移动盘存机器人来执行盘存的系统和方法
CN102523758A (zh) * 2010-08-31 2012-06-27 新日铁系统集成株式会社 增强现实提供系统、信息处理终端、信息处理装置、增强现实提供方法、信息处理方法以及程序
CN102982332A (zh) * 2012-09-29 2013-03-20 顾坚敏 基于云处理方式的零售终端货架影像智能分析系统
CN105701519A (zh) * 2014-12-10 2016-06-22 株式会社理光 基于超像素的图像的实际货架图景象分析
CN109190919A (zh) * 2018-08-10 2019-01-11 上海扩博智能技术有限公司 零售关键业绩指标生成方法、系统、设备及存储介质
CN109977886A (zh) * 2019-03-29 2019-07-05 京东方科技集团股份有限公司 货架空置率计算方法及装置、电子设备、存储介质

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434584A (zh) * 2020-11-16 2021-03-02 浙江大华技术股份有限公司 货架商品余量计算方法、装置、计算机设备和存储介质
CN112434584B (zh) * 2020-11-16 2024-04-30 浙江大华技术股份有限公司 货架商品余量计算方法、装置、计算机设备和存储介质
CN117974989A (zh) * 2024-03-28 2024-05-03 济宁市市政园林养护中心 一种园林植物病虫害区域快速检测方法

Also Published As

Publication number Publication date
CN109977886B (zh) 2021-03-09
CN109977886A (zh) 2019-07-05

Similar Documents

Publication Publication Date Title
WO2020199776A1 (zh) 货架空置率计算方法及装置、存储介质
WO2020199775A1 (zh) 货架状态确定方法及装置、存储介质
US11403839B2 (en) Commodity detection terminal, commodity detection method, system, computer device, and computer readable medium
US9275281B2 (en) Mobile image capture, processing, and electronic form generation
CN109360203B (zh) 图像配准方法、图像配准装置及存储介质
WO2020199777A1 (zh) 价签检测方法及装置、存储介质
CN109271937B (zh) 基于图像处理的运动场地标志物识别方法及系统
CN109086718A (zh) 活体检测方法、装置、计算机设备及存储介质
WO2019061658A1 (zh) 眼镜定位方法、装置及存储介质
WO2017215527A1 (zh) Hdr场景侦测方法、装置和计算机存储介质
US9401027B2 (en) Method and apparatus for scene segmentation from focal stack images
WO2020052270A1 (zh) 一种视频审核的方法、装置和设备
CN102667810A (zh) 数字图像中的面部识别
US9747486B2 (en) Decoding visual codes
CN116664559A (zh) 基于机器视觉的内存条损伤快速检测方法
CN114359412B (zh) 一种面向建筑数字孪生的相机外参自动标定方法及系统
WO2021195873A1 (zh) 识别sfr测试卡图像中感兴趣区域的方法及装置、介质
US11216905B2 (en) Automatic detection, counting, and measurement of lumber boards using a handheld device
CN114511820A (zh) 货架商品检测方法、装置、计算机设备及存储介质
CN113840135B (zh) 色偏检测方法、装置、设备及存储介质
CN114913463A (zh) 一种图像识别方法、装置、电子设备及存储介质
CN113469216B (zh) 零售终端海报识别与完整性判断方法、系统及存储介质
CN106056575B (zh) 一种基于似物性推荐算法的图像匹配方法
CN110348353B (zh) 一种图像处理方法及装置
CN109448010B (zh) 一种基于内容特征的四方连续纹样自动生成方法

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: 20784601

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20784601

Country of ref document: EP

Kind code of ref document: A1

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 1205A) DATED 04/02/2022).

122 Ep: pct application non-entry in european phase

Ref document number: 20784601

Country of ref document: EP

Kind code of ref document: A1