Method for generating shelf location map

The sliding detection window detects line segments and intersections in the shelf image, generates rectangular shelves and creates positioning maps, solving the high cost, long-term and error-prone problems of manually drawing shelf positioning maps, and achieving more efficient and accurate shelf positioning map generation.

CN114332298BActive Publication Date: 2025-03-21HANSHOW TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111666338.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-03-21
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In the prior art, there are problems such as high labor costs, long drawing time and error-prone problems by manually drawing shelf positioning maps.

Method used

Through the sliding detection window, the target shelf image is traversed horizontally and vertically, the position information of each line segment is detected, the coordinates of the intersection point of the line segment are calculated, the rectangular shelf is generated, and the shelf positioning map is generated based on the parameter information of the rectangular shelf.

Benefits of technology

Improves the efficiency and accuracy of shelf positioning map generation, reduces labor costs, and reduces errors in drawing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114332298B_ABST
    Figure CN114332298B_ABST
Patent Text Reader

Abstract

The present invention provides a method for generating a shelf location map, the method comprising: performing horizontal and vertical traversal of a target shelf image according to a sliding detection window to detect the position information of each line segment; calculating the line segment intersection coordinates according to the position information of each line segment; generating a rectangular shelf according to the coordinates of all line segment intersections; and obtaining a shelf location map of the target area according to the parameter information of the rectangular shelf. The present invention solves the problems of high labor cost, long drawing time and easy error in manually drawing shelf location maps, and improves the efficiency and accuracy of generating shelf location maps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method for generating a shelf positioning map. Background Art

[0002] With the development of smart warehousing and smart stores, positioning technology based on supermarkets and warehouse environments is increasingly used. In positioning services, scene maps are indispensable, and all result presentation and analysis require reference to maps. However, map production is very cumbersome and generally requires manual drawing. According to the CAD drawings provided by the customer, one shelf is drawn one by one, and the length, width, spacing, direction, etc. of the shelf are measured from the CAD drawings. This has the problems of high labor costs, long drawing time, and easy errors. Summary of the invention

[0003] In view of the deficiencies in the prior art, the method for generating a shelf location map provided by the present invention solves the problems of high labor cost, long drawing time and easy errors existing in manually drawing shelf location maps, thereby improving the efficiency and accuracy of shelf location map generation.

[0004] The present invention provides a method for generating a shelf positioning map, the method comprising: performing horizontal and vertical traversal of a target shelf image according to a sliding detection window to detect the position information of each line segment; calculating the coordinates of the line segment intersection according to the position information of each line segment; generating a rectangular shelf according to the coordinates of all line segment intersections; and obtaining a shelf positioning map of the target area according to the parameter information of the rectangular shelf.

[0005] Optionally, before traversing the target shelf image horizontally and vertically according to the sliding detection window to detect the position information of each line segment, the method further includes: obtaining a shelf layer according to the plane structure diagram of the target area; performing image conversion on the shelf layer to obtain an initial shelf image; performing grayscale processing and image inversion on the initial shelf image to obtain a preprocessed shelf image; and performing binarization processing on the preprocessed shelf image to obtain a target shelf image.

[0006] Optionally, the target shelf image is traversed horizontally and vertically according to the sliding detection window to detect the position information of each line segment, including: indexing the target shelf image to obtain an index number and an index value corresponding to each pixel point, wherein the index value is a pixel value of each pixel point; judging each index value in the sliding detection window to detect the starting position and the ending position of the line segment; and obtaining the position information of each line segment according to the starting position and the ending position of each line segment.

[0007] Optionally, the judgment of each index value in the sliding detection window to detect the starting position and the end position of the line segment includes: if it is judged that the index value of the first pixel point in the current sliding detection window is the first target value, and the index values ​​of the remaining pixel points except the first pixel point in the current sliding detection window are all the second target values, then the index number of the second pixel point in the current sliding detection window is used as the starting position of the current line segment; if it is detected that the index value of the last pixel point in the current sliding detection window is the first target value, and the index values ​​of the remaining pixel points except the last pixel point in the current sliding detection window are all the second target values, then the index number of the second to last pixel point in the current sliding detection window is used as the end position of the current line segment.

[0008] Optionally, before calculating the coordinates of the intersection of the line segments according to the position information of each line segment, the method further includes: establishing a rectangular coordinate system with the first target pixel point of the target shelf image as the origin; converting the index number of each pixel point into the rectangular coordinate system to obtain the coordinate information of each pixel point.

[0009] Optionally, the coordinates of the line segment intersection are calculated based on the position information of each line segment, including: obtaining the coordinate information of each pixel in each line segment based on the position information of each line segment; taking the second target pixel point with the same coordinate information as the line segment intersection, and taking the coordinate information of the second target pixel point as the coordinate information of the line segment intersection.

[0010] Optionally, a rectangular shelf is generated according to the coordinates of all line segment intersections, including: obtaining a shelf unit with each line segment intersection as the first vertex according to the coordinates of each line segment intersection; and generating the rectangular shelf according to parameter information of all shelf units, wherein the parameter information includes the vertex coordinates of the shelf unit, the length value of the shelf unit, and the width value of the shelf unit.

[0011] Optionally, based on the coordinates of each line segment intersection, a shelf unit with each line segment intersection as the first vertex is obtained, including: taking the current line segment intersection as the first vertex; based on the coordinate information of the first vertex, obtaining the second vertex that is closest to the first vertex; based on the coordinate information of the second vertex, obtaining the third vertex that is closest to the second vertex; based on the coordinate information of the first vertex and the coordinate information of the third vertex, calculating the coordinate information of the fourth vertex; when the coordinate information of the fourth vertex exists in the coordinates of all the line segment intersections, taking the rectangle formed by the first vertex, the second vertex, the third vertex and the fourth vertex as the shelf unit corresponding to the current line segment intersection.

[0012] Optionally, based on the parameter information of the rectangular shelf, a shelf location map of the target area is obtained, including: establishing a positioning coordinate system with the target position corresponding to the first target pixel point as the origin; obtaining a coordinate transformation relationship based on the rectangular coordinate system and the positioning coordinate system; and converting the parameter information of the rectangular shelf into the positioning coordinate system according to the coordinate transformation relationship to generate a shelf location map of the target area.

[0013] Optionally, before obtaining the shelf location map of the target area according to the parameter information of the rectangular shelf, the method further includes: obtaining the area of ​​the rectangular shelf according to the parameter information of the rectangular shelf; if the area of ​​the rectangular shelf is less than a preset threshold, deleting the rectangular shelf.

[0014] Compared with the prior art, the present invention has the following beneficial effects:

[0015] The present invention performs pixel traversal on the target shelf image through a sliding detection window, detects horizontal and vertical line segments, obtains the coordinates of all intersections according to the position information of the line segments, generates a rectangular shelf from the intersection coordinates, and finally generates a shelf location map according to the parameter information of the rectangular shelf. The present invention solves the problems of high labor cost, long drawing time and easy error in manually drawing shelf location maps, and improves the efficiency and accuracy of shelf location map generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 FIG. 1 is a flow chart of a method for generating a shelf location map provided by an embodiment of the present invention;

[0017] Figure 2 The embodiment of the present invention is shown Figure 1 Specific flow diagram of step S101;

[0018] Figure 3 Shown is a schematic diagram of a rectangular shelf provided by an embodiment of the present invention;

[0019] Figure 4 FIG. 1 is a flow chart of another method for generating a shelf location map provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0021] Figure 1 FIG. 1 is a flow chart of a method for generating a shelf location map provided by an embodiment of the present invention. Figure 1 As shown, the method for generating the shelf location map specifically includes the following steps:

[0022] Step S101, traverse the target shelf image horizontally and vertically according to the sliding detection window to detect the position information of each line segment.

[0023] In this embodiment, before the target shelf image is traversed horizontally and vertically according to the sliding detection window to detect the position information of each line segment, the method further includes: obtaining a shelf layer according to the plane structure diagram of the target area; performing image conversion on the shelf layer to obtain an initial shelf image; performing grayscale processing and image inversion on the initial shelf image to obtain a preprocessed shelf image; and performing binarization processing on the preprocessed shelf image to obtain a target shelf image.

[0024] It should be noted that the plane structure of the target area Figure 1 The target area includes but is not limited to a supermarket, wherein the plane structure diagram includes a shelf layer, a supermarket plane design layer, etc., and the plane structure diagram needs to be preprocessed to leave only the shelf layer; the preprocessed shelf layer is exported into an original image in PNG format to obtain an initial shelf image, and the exported PNG image will not be distorted, and there will be no pixel missing to affect the subsequent shelf recognition performance; the image is grayed, and then the image is inverted, and the inverted image is binarized according to a threshold method to obtain the target shelf image.

[0025] In an embodiment of the present invention, Figure 2 As shown, the target shelf image is traversed horizontally and vertically according to the sliding detection window, and the position information of each line segment is detected, which specifically includes the following steps:

[0026] Step S201, indexing the target shelf image to obtain an index number and an index value corresponding to each pixel, wherein the index value is a pixel value of each pixel;

[0027] Step S202, judging each index value in the sliding detection window, and detecting the starting position and the end position of the line segment;

[0028] Step S203, obtaining the position information of each line segment according to the starting position and the ending position of each line segment.

[0029] Further, the determination of each index value in the sliding detection window to detect the starting position and the ending position of the line segment includes: if it is determined that the index value of the first pixel point in the current sliding detection window is the first target value, and the index values ​​of the remaining pixel points except the first pixel point in the current sliding detection window are all the second target values, then the index number of the second pixel point in the current sliding detection window is used as the starting position of the current line segment;

[0030] If it is detected that the index value of the last pixel point in the current sliding detection window is the first target value, and the index values ​​of the remaining pixel points in the current sliding detection window except the last pixel point are all the second target values, then the index number of the second to last pixel point in the current sliding detection window is used as the end point position of the current line segment.

[0031] It should be noted that the pixel value of the bright part of the target shelf image obtained after the binarization process is 255, and the pixel value of the dark part is 0. The pixels of the target shelf image are traversed in the horizontal and vertical directions, and each horizontal line segment and vertical line segment is detected by a sliding detection window; wherein, the traversal direction of the sliding detection window is from left to right.

[0032] In this embodiment, since some line segments are too short, they may be interference information or local components on the shelf and are not expected to be detected. Therefore, a threshold line_th can be given to the line segment length, and line segments with a length less than the threshold line_th can be discarded; wherein, to detect line segments with a length of line_th, the size of the sliding detection window window_size must satisfy the following formula (1). In the sliding detection window, if the first pixel value is 0 and all subsequent pixel values ​​are 255, then the starting position of the line segment is the index number of the second pixel point in the sliding detection window, and the starting position index start_index is as shown in the following formula (2). If the last pixel value in the sliding detection window is 0 and all previous pixel values ​​are 255, then the line segment end index is found, and the line segment end index is end_index as shown in formula (3). Based on the same method and principle, the longitudinal line segment start position and end position can be obtained, and the position information of each line segment can be obtained according to the start position and end position of each line segment, wherein the position information of each line segment includes but is not limited to the start position, end position and line segment length.

[0033] window_size=line_th+1 (1)

[0034] start_index=index+1 (2)

[0035] end_index=index+line_th-1 (3)

[0036] Among them, index represents the index number of the first pixel in the current sliding detection window.

[0037] Step S102, calculating the coordinates of the intersection points of the line segments according to the position information of each line segment.

[0038] In this embodiment, before calculating the coordinates of the intersection of the line segments according to the position information of each line segment, the method further includes: establishing a rectangular coordinate system with the first target pixel point of the target shelf image as the origin; converting the index number of each pixel point into the rectangular coordinate system to obtain the coordinate information of each pixel point.

[0039] Furthermore, based on the position information of each line segment, the coordinates of the line segment intersection are calculated, including: based on the position information of each line segment, obtaining the coordinate information of each pixel in each line segment; taking the second target pixel point with the same coordinate information as the line segment intersection, and taking the coordinate information of the second target pixel point as the coordinate information of the line segment intersection.

[0040] like Figure 3 As shown, in this embodiment, the first target pixel point is the first pixel point in the upper left corner of the target shelf image, and the second target pixel point is a pixel point with the same coordinate information, wherein the number of the second target pixel points is several, for example, the first horizontal line segment includes the first middle pixel point (2,2), the second middle pixel point (4,2), and the third middle pixel point (6,2), the first vertical line segment includes the first middle pixel point (2,2), and the fourth middle pixel point (2,4), and the second vertical line segment includes the second middle pixel point (4,2), and the fifth middle pixel point (4,4). It can be seen that the coordinate information of the first middle pixel point in the first horizontal line segment is the same as the coordinate information of the first middle pixel point in the first vertical line segment, and the coordinate information of the second middle pixel point in the first horizontal line segment is the same as the coordinate information of the second middle pixel point in the second vertical line segment. Therefore, the first middle pixel point and the second middle pixel point are both used as the second target pixel points, that is, the intersection of the two line segments, and the coordinate information of the first middle pixel point and the coordinate information of the second middle pixel point are respectively the coordinate information of the intersection of the two line segments.

[0041] Step S103, generating a rectangular shelf according to the coordinates of all line segment intersections.

[0042] In this embodiment, a rectangular shelf is generated according to the coordinates of all line segment intersections, including: obtaining a shelf unit with each line segment intersection as the first vertex according to the coordinates of each line segment intersection; generating the rectangular shelf according to parameter information of all shelf units, wherein the parameter information includes the vertex coordinates of the shelf unit, the length value of the shelf unit, and the width value of the shelf unit.

[0043] Furthermore, if Figure 4 As shown, obtaining the shelf unit with each line segment intersection as the first vertex according to the coordinates of each line segment intersection specifically includes the following steps:

[0044] Step S301, taking the current line segment intersection as the first vertex;

[0045] Step S302, acquiring a second vertex closest to the first vertex according to the coordinate information of the first vertex;

[0046] Step S303, acquiring a third vertex closest to the second vertex according to the coordinate information of the second vertex;

[0047] Step S304: when the coordinate information of the fourth vertex exists in the coordinates of all the line segment intersections, a rectangle formed by the first vertex, the second vertex, the third vertex and the fourth vertex is used as a shelf unit corresponding to the current line segment intersection.

[0048] It should be noted that in the above embodiment, the position information of each line segment intersection is obtained, and the nearest intersection is searched to the right and downward for each intersection in turn, and then the coordinates of the fourth intersection are calculated based on the coordinates of the first intersection and the third intersection, and it is determined whether the fourth point is in the intersection set and whether it is connected to the first point and the third point. If it meets the requirements, the calculated fourth point is the fourth point of the rectangle. If the four points that can form the rectangle cannot be found in this way, the nearest intersection is searched downward and right for the intersection, and the fourth point is obtained in the same way. In this way, at most two different searches are performed for each intersection. If both searches are unsuccessful, the search for the intersection is abandoned. This algorithm can be used to obtain the four corner points that constitute the rectangle. In the stage of finding the nearest intersection, the intersection needs to meet two requirements to be adopted: 1. Find the nearest intersection, 2. The two intersections must be on a certain line segment, that is, the intersections must be reachable by the line segment. After finding the four intersections that satisfy the rectangle, the number of pixels and the pixel coordinate position of the width and length of the rectangle can be obtained, thereby obtaining the parameter information of the shelf unit corresponding to the current line segment intersection; and so on, taking each line segment intersection as the first vertex, finding all the shelf units in turn according to the above steps, and then splicing all the shelf units into a rectangular shelf, wherein the rectangular shelves can be independent shelves.

[0049] Step S104: obtaining a shelf location map of the target area according to the parameter information of the rectangular shelf.

[0050] In this embodiment, before obtaining the shelf location map of the target area according to the parameter information of the rectangular shelf, the method also includes: obtaining the area of ​​the rectangular shelf according to the parameter information of the rectangular shelf; if the area of ​​the rectangular shelf is less than a preset threshold, deleting the rectangular shelf.

[0051] In this embodiment, a shelf location map of the target area is obtained based on the parameter information of the rectangular shelf, including: establishing a location coordinate system with the target position corresponding to the first target pixel point as the origin; obtaining a coordinate transformation relationship based on the rectangular coordinate system and the location coordinate system; and converting the parameter information of the rectangular shelf into the location coordinate system based on the coordinate transformation relationship to generate a shelf location map of the target area.

[0052] It should be noted that in order to further eliminate interference information, rectangular shelves can be screened according to their area, filtering out rectangles whose area is less than a preset threshold. And based on the relationship between image pixels and actual physical length, the width and height of the shelf and the actual position of the coordinates can be calculated, and the shelf location map can be automatically generated; wherein, the relationship between image pixels and actual physical length is the coordinate conversion relationship between the rectangular coordinate system and the positioning coordinate system.

[0053] The present invention performs pixel traversal on the target shelf image through a sliding detection window, detects horizontal and vertical line segments, obtains the coordinates of all intersections according to the position information of the line segments, generates a rectangular shelf from the intersection coordinates, and finally generates a shelf location map according to the parameter information of the rectangular shelf. The present invention solves the problems of high labor cost, long drawing time and easy error in manually drawing shelf location maps, and improves the efficiency and accuracy of shelf location map generation.

[0054] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0055] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A method for generating a shelf location map, characterized in that: The method comprises: Traverse the target shelf image horizontally and vertically according to the sliding detection window to detect the position information of each line segment; Establishing a rectangular coordinate system with the first target pixel point of the target shelf image as the origin; According to the position information of each line segment, the coordinates of the intersection of the line segments are calculated; Generate rectangular shelves according to the coordinates of all line segment intersections; According to the parameter information of the rectangular shelf, a shelf positioning map of the target area is obtained; Generate a rectangular shelf based on the coordinates of all line segment intersections, including: According to the coordinates of each line segment intersection, obtain the shelf unit with each line segment intersection as the first vertex; Generate the rectangular shelf according to the parameter information of all shelf units, wherein the parameter information includes the vertex coordinates of the shelf unit, the length value of the shelf unit and the width value of the shelf unit; According to the parameter information of the rectangular shelf, a shelf positioning map of the target area is obtained, including: Establishing a positioning coordinate system with the target position corresponding to the first target pixel point as the origin; Obtaining a coordinate transformation relationship according to the rectangular coordinate system and the positioning coordinate system; The parameter information of the rectangular shelf is converted into the positioning coordinate system according to the coordinate conversion relationship to generate a shelf positioning map of the target area.

2. The method for generating a shelf location map according to claim 1, characterized in that: Before traversing the target shelf image horizontally and vertically according to the sliding detection window to detect the position information of each line segment, the method further includes: According to the plan structure diagram of the target area, a shelf layer is obtained; Performing image conversion on the shelf layer to obtain an initial shelf image; Performing grayscale processing and image inversion on the initial shelf image to obtain a preprocessed shelf image; The pre-processed shelf image is binarized to obtain a target shelf image.

3. The method for generating a shelf location map according to claim 1, characterized in that: The target shelf image is traversed horizontally and vertically according to the sliding detection window to detect the position information of each line segment, including: Establishing an index for the target shelf image to obtain an index number and an index value corresponding to each pixel point, wherein the index value is a pixel value of each pixel point; By judging each index value in the sliding detection window, the starting position and the end position of the line segment are detected; According to the starting position and the ending position of each line segment, the position information of each line segment is obtained.

4. The method for generating a shelf location map according to claim 3, characterized in that: The judgment of each index value in the sliding detection window detects the starting position and the end position of the line segment, including: If it is determined that the index value of the first pixel in the current sliding detection window is the first target value, and the index values ​​of the remaining pixel points except the first pixel in the current sliding detection window are all the second target values, the index number of the second pixel in the current sliding detection window is used as the starting position of the current line segment; If it is detected that the index value of the last pixel point in the current sliding detection window is the first target value, and the index values ​​of the remaining pixel points in the current sliding detection window except the last pixel point are all the second target values, then the index number of the second to last pixel point in the current sliding detection window is used as the end point position of the current line segment.

5. The method for generating a shelf location map according to claim 3, characterized in that: Before calculating the coordinates of the line segment intersection points according to the position information of each line segment, the method further includes: The index number of each pixel point is converted into the rectangular coordinate system to obtain the coordinate information of each pixel point.

6. The method for generating a shelf location map according to claim 5, characterized in that: According to the position information of each line segment, the coordinates of the line segment intersection are calculated, including: According to the position information of each line segment, the coordinate information of each pixel point in each line segment is obtained; The second target pixel point with the same coordinate information is used as the line segment intersection point, and the coordinate information of the second target pixel point is used as the coordinate information of the line segment intersection point.

7. The method for generating a shelf location map according to claim 1, characterized in that: According to the coordinates of each line segment intersection, the shelf unit with each line segment intersection as the first vertex is obtained, including: Take the current line segment intersection as the first vertex; According to the coordinate information of the first vertex, obtain a second vertex that is closest to the first vertex; According to the coordinate information of the second vertex, obtain a third vertex that is closest to the second vertex; Calculate the coordinate information of the fourth vertex according to the coordinate information of the first vertex and the coordinate information of the third vertex; When the coordinate information of the fourth vertex exists in the coordinates of all the line segment intersections, a rectangle formed by the first vertex, the second vertex, the third vertex and the fourth vertex is used as a shelf unit corresponding to the current line segment intersection.

8. The method for generating a shelf location map according to any one of claims 1 to 7, characterized in that: Before obtaining the shelf positioning map of the target area according to the parameter information of the rectangular shelf, the method further includes: According to the parameter information of the rectangular shelf, the area of ​​the rectangular shelf is obtained; If the area of ​​the rectangular shelf is smaller than a preset threshold, the rectangular shelf is deleted.

Citation Information

Patent Citations

  • Shopping guide map generating method and device

    CN106355427A

  • Conversion of object-related traffic sensor information at roadways and intersections for virtual dynamic digital representation of objects

    US11055894B1