A map data compression method, decompression method and device

By encoding and indexing adjacent pixels in map data, target map data is generated, solving the problem of insufficient effectiveness of map data compression in existing technologies and achieving more efficient data transmission and improved user experience.

CN115269755BActive Publication Date: 2026-01-02HANGZHOU EZVIZ SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210845800.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2026-01-02
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

Existing map data compression methods are not very effective, especially when the number of consecutive identical labels in the map data to be processed is small, resulting in the compressed target map data being larger than the uncompressed map data.

Method used

By encoding the identifiers of the first number of adjacent pixels in the map data to be processed, an index value is generated. Based on the index value and the preset correspondence, the target character is determined, and the target map data is generated according to the position of the pixel.

Benefits of technology

It improves the effectiveness of map data compression, reduces the traffic cost and time of transmitting map data, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115269755B_ABST
    Figure CN115269755B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a map data compression method, a decompression method and a device, obtain map data to be processed; the map data to be processed comprises the identities of each pixel point, and the identity of each pixel point is determined based on the map feature represented by the pixel point; encode the identities of each adjacent first number of pixel points in the map data to be processed to obtain corresponding index values; based on the determined index values and a preset corresponding relationship between index values and characters, determine the characters corresponding to the adjacent first number of pixel points as target characters; generate map data comprising each target character according to the positions of each pixel point in the map data to be processed to obtain target map data. Based on the above processing, for the first number of pixel points in the map data to be processed, the identities of the first number of pixel points can be compressed into one character, and the target map data obtained is smaller than the map data to be processed, which can improve the effectiveness of map data compression.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a map data compression method and decompression method and device. BACKGROUND

[0002] When sweeping a target scene, a sweeping robot can collect map data of the target scene and send the collected map data to a user end. The user end can display a map of the target scene based on the received map data for a user to browse.

[0003] In the related art, the collected map data (which can be referred to as original map data) can be compressed to obtain compressed map data (which can be referred to as target map data), and the target map data is sent to the user end, thereby saving the traffic cost and transmission time of transmitting the map data. Specifically, for each pixel point in the original map data, an identifier of the pixel point can be obtained based on a map feature represented by the pixel point. Then, map data containing the identifiers of the pixel points (which can be referred to as to-be-processed map data) is generated. Then, the number of consecutive pixel points with the same identifier in the to-be-processed map data is counted, a data block recording the identifier and the corresponding number of pixel points is generated, and the target map data containing a plurality of data blocks is generated.

[0004] However, if the number of consecutive pixel points with the same identifier in the to-be-processed map data is small, the compressed target map data will be larger than the to-be-processed map data before compression. It can be seen that the effectiveness of map data compression in the related art is low. SUMMARY

[0005] Embodiments of the present application aim to provide a map data compression method, a decompression method and device to improve the effectiveness of map data compression. The specific technical solutions are as follows:

[0006] In a first aspect, to achieve the above-mentioned purpose, the present application discloses a map data compression method, which comprises: obtaining to-be-processed map data; wherein the to-be-processed map data contains identifiers of each pixel point, and the identifier of each pixel point is determined based on a map feature represented by the pixel point; encoding the identifiers of each adjacent first number of pixel points in the to-be-processed map data to obtain corresponding index values; determining the characters corresponding to the adjacent first number of pixel points as target characters based on the determined index values and a preset correspondence between index values and characters; and generating map data containing each target character according to the positions of each pixel point in the to-be-processed map data to obtain target map data.

[0007] Optionally, the encoding of the identifier of each adjacent first number of pixel points in the to-be-processed map data to obtain a corresponding index value comprises: obtaining, for each pixel point in the adjacent first number of pixel points, a binary value representing the identifier of the pixel point; splicing the binary values corresponding to the adjacent first number of pixel points to obtain a splicing result according to the positions of the adjacent first number of pixel points in the to-be-processed map data; and determining the index value corresponding to the adjacent first number of pixel points based on the splicing result.

[0008] Optionally, the determining of the index value corresponding to the adjacent first number of pixel points based on the splicing result comprises: performing a base conversion on the splicing result to obtain a decimal value representing the splicing result as the index value corresponding to the adjacent first number of pixel points.

[0009] Optionally, the obtaining of the to-be-processed map data comprises: obtaining original map data of a target scene; obtaining, for each pixel point in the original map data, an identifier of the pixel point based on a map feature of a corresponding position of the pixel point in the target scene; and generating map data containing the identifiers of the pixel points as the to-be-processed map data.

[0010] Optionally, after the generating of the target map data containing the identifiers of the adjacent first number of pixel points corresponding to each target character according to the positions of the target characters in the target map data, the method further comprises: sending the target map data to a user end to enable the user end to display a corresponding map based on the target map data.

[0011] In a second aspect, to achieve the above object, an embodiment of the present application discloses a map data decompression method, which comprises: obtaining target map data; wherein the target map data is obtained based on the map data compression method of any one of the first aspect; determining, for each target character in the target map data, an index value corresponding to the target character according to a preset correspondence between index values and characters; decoding the index value corresponding to the target character to obtain identifiers of an adjacent first number of pixel points corresponding to the target character; and generating, according to the positions of the target characters in the target map data, to-be-processed map data containing the identifiers of the adjacent first number of pixel points corresponding to each target character.

[0012] Optionally, the decoding of the index value corresponding to the target character to obtain the identifiers of the adjacent first number of pixel points corresponding to the target character comprises: performing a splitting processing on the index value corresponding to the target character to obtain a first number of binary values; and obtaining the identifiers of the adjacent first number of pixel points corresponding to the target character based on the first number of binary values.

[0013] Optionally, the splitting the index value corresponding to the target character to obtain the first number of binary values comprises: performing base conversion on the index value corresponding to the target character to obtain a binary value representing the index value corresponding to the target character; and splitting the binary value representing the index value corresponding to the target character to obtain the first number of binary values.

[0014] Optionally, after the generating, according to positions of each target character in the target map data, the to-be-processed map data containing the identification of each target character corresponding to the first number of adjacent pixel points, the method further comprises: determining, for each pixel point in the to-be-processed map data, a color corresponding to the identification of the pixel point; and rendering, according to the colors corresponding to each pixel point in the to-be-processed map data, the to-be-processed map data to display a map corresponding to the to-be-processed map data.

[0015] In a third aspect, to achieve the above object, an embodiment of the present application discloses a map data compression device, the device comprising: a to-be-processed map data acquisition module configured to acquire to-be-processed map data; wherein the to-be-processed map data contains the identification of each pixel point, and the identification of each pixel point is determined based on a map feature represented by the pixel point; an index value determination module configured to encode the identification of each first number of adjacent pixel points in the to-be-processed map data to obtain a corresponding index value; a target character determination module configured to determine, based on the determined index value and a preset corresponding relationship between index values and characters, a character corresponding to the first number of adjacent pixel points as a target character; and a target map data generation module configured to generate, according to positions of each pixel point in the to-be-processed map data, map data containing each target character to obtain target map data.

[0016] Optionally, the index value determination module is specifically configured to: acquire, for each pixel point in the first number of adjacent pixel points, a binary value representing the identification of the pixel point; splice, according to positions of the first number of adjacent pixel points in the to-be-processed map data, the binary values corresponding to the first number of adjacent pixel points to obtain a splicing result; and determine, based on the splicing result, an index value corresponding to the first number of adjacent pixel points.

[0017] Optionally, the index value determination module is specifically configured to perform base conversion on the splicing result to obtain a decimal value representing the splicing result as the index value corresponding to the first number of adjacent pixel points.

[0018] Optionally, the to-be-processed map data obtaining module is specifically configured to obtain original map data of a target scene; for each pixel point in the original map data, an identifier of the pixel point is obtained based on a map feature of a corresponding position of the pixel point in the target scene; and map data containing the identifiers of the pixel points is generated as the to-be-processed map data.

[0019] Optionally, the apparatus further comprises a target map data sending module configured to send the target map data to a user side after the target map data generating module generates the target map data by generating map data containing each target character according to the positions of the pixel points in the to-be-processed map data, so that the user side displays a corresponding map based on the target map data.

[0020] In a fourth aspect, to achieve the above object, an embodiment of the present application discloses a map data decompression apparatus, the apparatus comprising: a target map data obtaining module configured to obtain target map data; wherein the target map data is obtained based on the map data compression method of any one of the first aspect; an index value determining module configured to determine an index value corresponding to each target character in the target map data according to a preset index value and character correspondence relationship; a pixel point identifier determining module configured to decode the index value corresponding to the target character to obtain identifiers of a first number of adjacent pixel points corresponding to the target character; and a to-be-processed map data generating module configured to generate to-be-processed map data containing the identifiers of the first number of adjacent pixel points corresponding to each target character in the target map data according to the positions of the target characters in the target map data.

[0021] Optionally, the pixel point identifier determining module is specifically configured to split the index value corresponding to the target character to obtain a first number of binary values; and obtain the identifiers of the first number of adjacent pixel points corresponding to the target character based on the first number of binary values.

[0022] Optionally, the pixel point identifier determining module is specifically configured to perform base conversion on the index value corresponding to the target character to obtain a binary value representing the index value corresponding to the target character; and split the binary value representing the index value corresponding to the target character to obtain a first number of binary values.

[0023] Optionally, the device further comprises: a color determining module, configured to, after the to-be-processed map data generating module generates the to-be-processed map data containing the identification of each target character corresponding to the first number of adjacent pixel points according to the position of each target character in the target map data, determine the color corresponding to the identification of each pixel point in the to-be-processed map data; and a map display module, configured to render according to the color corresponding to each pixel point in the to-be-processed map data, to display the map corresponding to the to-be-processed map data.

[0024] The embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus; the memory is used for storing a computer program; and the processor is used for executing the program stored in the memory, so that the map data compression method steps in any one of the first aspect or the map data decompression method steps in any one of the second aspect are realized.

[0025] The embodiment of the present application further provides a sweeping robot system, including an image acquisition module and a processor.

[0026] The image acquisition module is used for acquiring original map data of a target scene.

[0027] The processor is used for executing the map data compression method steps in any one of the first aspect.

[0028] The embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the map data compression method steps in any one of the first aspect or the map data decompression method steps in any one of the second aspect.

[0029] The embodiment of the present application further provides a computer program product containing instructions, which, when running on a computer, causes the computer to execute the map data compression method in any one of the first aspect or the map data decompression method in any one of the second aspect.

[0030] The embodiment of the present application has the following beneficial effects:

[0031] The embodiment of the present application provides a map data compression method, obtaining to-be-processed map data; the to-be-processed map data contains the identification of each pixel point, and the identification of each pixel point is determined based on the map feature represented by the pixel point; the identification of each adjacent first number of pixel points in the to-be-processed map data is encoded to obtain a corresponding index value; based on the determined index value and a preset corresponding relationship between the index value and the character, the character corresponding to the adjacent first number of pixel points is determined as a target character; according to the positions of the pixel points in the to-be-processed map data, map data containing each target character is generated to obtain target map data.

[0032] Based on the above processing, for the first number of pixel points in the to-be-processed map data, the identification of the first number of pixel points can be compressed into a character, and the obtained target map data is smaller than the to-be-processed map data, so that the effectiveness of map data compression can be improved.

[0033] Of course, implementing any product or method of the present application does not necessarily require all the advantages described above. BRIEF DESCRIPTION OF DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other embodiments can also be obtained by those skilled in the art based on these drawings.

[0035] Figure 1 A flowchart of a map data compression method provided by the embodiment of the present application;

[0036] Figure 2 A flowchart of another map data compression method provided by the embodiment of the present application;

[0037] Figure 3 A flowchart of another map data compression method provided by the embodiment of the present application;

[0038] Figure 4 A flowchart of a map data decompression method provided by the embodiment of the present application;

[0039] Figure 5 A flowchart of another map data decompression method provided by the embodiment of the present application;

[0040] Figure 6 A flowchart of another map data decompression method provided by the embodiment of the present application;

[0041] Figure 7 A flowchart of another map data decompression method provided by the embodiment of the present application;

[0042] Figure 8 FIG. 9(a) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0043] FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0044] FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0045] Figure 10 FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0046] Figure 11 FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0047] Figure 12 FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0048] Figure 13 FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0049] Figure 14 FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application;

[0050] Figure 15 FIG. 9(b) is a schematic diagram of a display interface of a map according to an embodiment of the present application. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art based on the present application belong to the scope of protection of the present application.

[0052] In the related art, based on the map features represented by each pixel point in the original map data of a target scene, the to-be-processed map data containing the identifiers of each pixel point is generated. In an implementation manner, the identifier of a pixel point representing an obstacle can be 0, the identifier of a pixel point representing a wall can be 1, the identifier of a pixel point representing an empty space can be 2, and the identifier of a pixel point representing a cleaning route of a sweeping robot can be 3. The to-be-processed map data shown in Table 1 can be obtained.

[0053] Table 1

[0054] 1 1 1 1 2 2 1 1 3 3 3 3 3 3 3 3 1 1 2 1

[0055] Then, the number of continuous pixel points with the same identifier in the to-be-processed map data is counted, a data block recording the identifier and the number of corresponding pixel points is generated, and target map data including a plurality of data blocks is generated. For example, according to the arrangement order of the identifiers of the pixel points in the to-be-processed map data shown in Table 1, the data block corresponding to the four continuous pixel points with the identifier 1 is (1, 4); the data block corresponding to the two continuous pixel points with the identifier 2 is (2, 2); the data block corresponding to the two continuous pixel points with the identifier 1 is (1, 2), and so on. The target map data shown in Table 2 can be obtained.

[0056] Table 2

[0057] 1 4 2 2 1 2 3 8 1 2 2 1

[0058] However, if the number of continuous same identifiers in the to-be-processed map data is small, the compressed target map data is larger than the to-be-processed map data before compression. For example, the number of continuous same identifiers in the to-be-processed map data shown in Table 3 is small. According to the related art, the to-be-processed map data shown in Table 3 is compressed to obtain the target map data shown in Table 4.

[0059] Table 3

[0060] 1 2 1 3 1 2 2 1 2

[0061] Table 4

[0062] 1 1 2 1 1 1 3 1 1 1 2 2 1 1 2 1

[0063] The to-be-processed map data shown in Table 3 includes 9 characters, and the target map data shown in Table 4 includes 16 characters. The compressed target map data is larger than the to-be-processed map data before compression. It can be seen that the effectiveness of map data compression in the related art is low.

[0064] To solve the above problems, an embodiment of the present application provides a map data compression method. The method can be applied to an electronic device, which can be a robot vacuum cleaner. The electronic device can obtain to-be-processed map data and compress the identifiers of a first number of pixel points in the to-be-processed map data into one character according to the method provided in the embodiment of the present application to obtain target map data. The target map data is smaller than the to-be-processed map data, which can improve the effectiveness of map data compression. Subsequently, the electronic device can send the target map data to a user terminal, which can save the traffic cost and transmission time of transmitting map data. The user terminal can display a corresponding map based on the received target map data for a user to browse, which can improve the user experience.

[0065] Referring to Figure 1 , Figure 1A flowchart of a map data compression method provided by an embodiment of the present application can include the following steps:

[0066] S101: Obtain to-be-processed map data.

[0067] The to-be-processed map data contains the identities of each pixel point, and the identity of each pixel point is determined based on a map feature represented by the pixel point.

[0068] S102: Encode the identities of each adjacent first number of pixel points in the to-be-processed map data to obtain corresponding index values.

[0069] S103: Determine the character corresponding to the adjacent first number of pixel points as a target character based on the determined index values and a preset correspondence between index values and characters.

[0070] S104: Generate map data containing each target character according to the positions of each pixel point in the to-be-processed map data to obtain target map data.

[0071] Based on the map data compression method provided by the embodiment of the present application, the identities of the first number of pixel points in the to-be-processed map data can be compressed into a character, and the target map data obtained is smaller than the to-be-processed map data, which can improve the effectiveness of map data compression.

[0072] For step S101, the to-be-processed map data can be map data of a target scene swept by a sweeping robot, for example, the target scene can be a residence, a factory, a shopping mall, etc. The to-be-processed map data contains the identities of each pixel point, and the identity of each pixel point is determined based on a map feature represented by the pixel point. The map feature represented by each pixel point is the map feature of the corresponding position of the pixel point in the target scene.

[0073] For example, the target scene is a residence, the identity of a pixel point representing an obstacle can be 0, the identity of a pixel point representing a wall can be 1, the identity of a pixel point representing the sweeping route of the sweeping robot can be 2, the identity of a pixel point representing the living room space can be 3, the identity of a pixel point representing the kitchen space can be 4, the identity of a pixel point representing the master bedroom space can be 5, the identity of a pixel point representing the secondary bedroom space can be 6, and the identity of a pixel point representing the bathroom space can be 7. The to-be-processed map data shown in Table 5 can be obtained.

[0074] Table 5

[0075] 1 1 2 2 2 0 0 0 4 4 3 3 3 3 3 2 2 2 3 3 2 2 5 5 5 5 2 2 5 5 6 6 6 2 2 7

[0076] In some embodiments, on the basis of Figure 1 see Figure 2In step S101, the electronic device can perform the following steps.

[0077] S1011: Obtain original map data of the target scene.

[0078] S1012: For each pixel point in the original map data, obtain an identifier of the pixel point based on a map feature of a corresponding position of the pixel point in the target scene.

[0079] S1013: Generate map data containing the identifiers of the pixel points as the to-be-processed map data.

[0080] The original map data of the target scene can be obtained by a sweeping robot. When the electronic device is a sweeping robot, the electronic device can obtain the original map data of the target scene. Alternatively, the electronic device can communicate with the sweeping robot, and the electronic device can obtain the original map data of the target scene collected by the sweeping robot.

[0081] In an implementation manner, the sweeping robot can include an image acquisition module, the image acquisition module can include a radar device, the sweeping robot can scan the target scene through the image acquisition module to obtain three-dimensional point cloud data of the target scene, and perform mapping processing on the three-dimensional point cloud data to obtain two-dimensional map data of the target scene as the original map data of the target scene.

[0082] In another implementation manner, the sweeping robot can include an image acquisition module, the image acquisition module can include a camera, and the sweeping robot can capture an image of the target scene through the image acquisition module to obtain the original map data of the target scene.

[0083] Then, the electronic device can obtain the original map data of the target scene, and for each pixel point in the original map data, the electronic device determines a map feature of a corresponding position of the pixel point in the target scene.

[0084] If the original map data is obtained by performing mapping processing on three-dimensional point cloud data of the target scene, for each pixel point in the original map data, the electronic device can determine the map feature of the corresponding position of the pixel point in the target scene according to an amplitude of a three-dimensional point corresponding to the pixel point in the three-dimensional point cloud data.

[0085] If the original map data is obtained by capturing an image of the target scene through the image acquisition module, the electronic device can perform image segmentation on the original map data to obtain the map feature of the corresponding position of each pixel point in the target scene.

[0086] Further, for each pixel point in the original map data, the electronic device obtains an identifier of a map feature representing a corresponding position of the pixel point in the target scene, obtains the identifier of the pixel point, and generates map data containing the identifiers of the pixel points, to obtain the to-be-processed map data.

[0087] For step S102, the first number is greater than 1, and the first number can be set by a technician according to actual needs. For example, when the number of categories of map features corresponding to the to-be-processed map data is not greater than 8, the first number can be 2; when the number of categories of map features corresponding to the to-be-processed map data is not greater than 4, the first number can be 3.

[0088] The electronic device can encode the identifiers of each adjacent first number of pixel points in the to-be-processed map data in the following manner, to obtain an index value corresponding to the adjacent first number of pixel points.

[0089] Method one: for each pixel point in the to-be-processed map data, the electronic device obtains the identifier of the pixel point. For each adjacent first number of pixel points in the to-be-processed map data, the electronic device splices the identifiers of the adjacent first number of pixel points, to obtain an index value corresponding to the first number of pixel points.

[0090] Method two: based on the method one, referring to the step S102, the step S102 can include the following steps. Figure 1 Figure 3

[0091] S1021: for each pixel point in the adjacent first number of pixel points, obtain a binary value representing the identifier of the pixel point.

[0092] S1022: splice the binary values corresponding to the adjacent first number of pixel points according to the positions of the adjacent first number of pixel points in the to-be-processed map data, to obtain a splicing result.

[0093] S1023: determine the index value corresponding to the adjacent first number of pixel points based on the splicing result.

[0094] For each pixel point in the adjacent first number of pixel points, if the identifier of the pixel point is a binary value, the electronic device directly obtains the identifier of the pixel point, to obtain the binary value representing the identifier of the pixel point. For example, if the identifier of the pixel point is a binary value 101, 101 is the binary value representing the identifier of the pixel point.

[0095] ​​If the identifier of the pixel point is a decimal number, the electronic device converts the identifier of the pixel point into a binary number of the first number of bits to obtain a binary number representing the identifier of the pixel point. The first number of bits corresponds to the first number. When the first number is 3, the first number of bits is 2. When the first number is 2, the first number of bits is 3. The first number of bits is also the second number of bits in the subsequent embodiments.

[0096] For example, the first number is 3, the first number of bits is 2, the identifier of the pixel point is a decimal number 2, and the binary number of two bits obtained by converting the decimal number 2 is 10. Therefore, the binary number representing the identifier of the pixel point is 10. Alternatively, the first number is 2, the first number of bits is 3, the identifier of the pixel point is a decimal number 5, and the binary number of three bits obtained by converting the decimal number 5 is 101. Therefore, the binary number representing the identifier of the pixel point is 101.

[0097] The electronic device concatenates the binary numbers corresponding to the adjacent first number of pixel points in the position of the adjacent first number of pixel points in the to-be-processed map data to obtain a concatenation result.

[0098] For example, for the to-be-processed map data shown in Table 5, the number of types of map features is 8, the first number is 2, and the first number of bits is 3. The identifiers of the first and second pixel points in the to-be-processed map data are 1 and 1. The electronic device converts the identifiers of the two pixel points into binary numbers of three bits to obtain 001 and 001, respectively. The concatenation result obtained by concatenating the binary numbers corresponding to the two pixel points is 001001. The identifiers of the third and fourth pixel points in the to-be-processed map data are 2 and 2. The electronic device converts the identifiers of the two pixel points into binary numbers of three bits to obtain 010 and 010, respectively. The concatenation result obtained by concatenating the binary numbers corresponding to the two pixel points is 010010. Similarly, the concatenation result corresponding to each adjacent first number of pixel points can be obtained.

[0099] In an implementation manner, the electronic device can directly use the obtained concatenation result as the index value corresponding to the adjacent first number of pixel points.

[0100] In another implementation manner, step S1023 can include the following step: performing a base conversion on the concatenation result to obtain a decimal number representing the concatenation result as the index value corresponding to the adjacent first number of pixel points.

[0101] For example, if the splicing result corresponding to the first number of adjacent pixels is 001001, the index value corresponding to the first number of adjacent pixels is 9 obtained by converting 001001 into a decimal value; if the splicing result corresponding to the first number of adjacent pixels is 010010, the index value corresponding to the first number of adjacent pixels is 18 obtained by converting 010010 into a decimal value.

[0102] For step S103, for each first number of adjacent pixels in the to-be-processed map data, the electronic device finds a character corresponding to an index value corresponding to the first number of adjacent pixels in a preset correspondence between index values and characters, to obtain a target character corresponding to the first number of adjacent pixels.

[0103] In an implementation manner, the index value can be a binary value. Referring to Table 6, Table 6 is a correspondence table between index values and characters provided by an embodiment of the present application.

[0104] Table 6

[0105] Index value Character Index value Character Index value Character Index value Character 000000 A 010000 Q 100000 g 110000 w 000001 B 010001 R 100001 h 110001 x 000010 C 010010 S 100010 i 110010 y 000011 D 010011 T 100011 j 110011 z 000100 E 010100 U 100100 k 110100 0 000101 F 010101 V 100101 l 110101 1 000110 G 010110 W 100110 m 110110 2 000111 H 010111 X 100111 n 110111 3 001000 I 011000 Y 101000 o 111000 4 001001 J 011001 Z 101001 p 111001 5 001010 K 011010 a 101010 q 111010 6 001011 L 011011 b 101011 r 111011 7 001100 M 011100 c 101100 s 111100 8 001101 N 011101 d 101101 t 111101 9 001110 O 011110 e 101110 u 111110 + 001111 P 011111 f 101111 v 111111 /

[0106] If the index value is 001001, the target character corresponding to the index value can be obtained as J by searching the correspondence table shown in Table 6. If the index value is 010010, the target character corresponding to the index value can be obtained as S by searching the correspondence table shown in Table 6.

[0107] In another implementation manner, in order to reduce the storage space occupied by the electronic device in storing the correspondence between index values and characters, the index value can be a decimal value. Referring to Table 7, Table 7 is another correspondence table between index values and characters provided by an embodiment of the present application.

[0108] Table 7

[0109] Index value Character Index value Character Index value Character Index value Character 0 A 16 Q 32 g 48 w 1 B 17 R 33 h 49 x 2 C 18 S 34 i 50 y 3 D 19 T 35 j 51 z 4 E 20 U 36 k 52 0 5 F 21 V 37 l 53 1 6 G 22 W 38 m 54 2 7 H 23 X 39 n 55 3 8 I 24 Y 40 o 56 4 9 J 25 Z 41 p 57 5 10 K 26 a 42 q 58 6 11 L 27 b 43 r 59 7 12 M 28 c 44 s 60 8 13 N 29 d 45 t 61 9 14 O 30 e 46 u 62 + 15 P 31 f 47 v 63 /

[0110] If the index value is 9, the target character corresponding to the index value can be obtained as J by searching the correspondence table shown in Table 7. If the index value is 18, the target character corresponding to the index value can be obtained as S by searching the correspondence table shown in Table 7.

[0111] For step S104, after obtaining the target character corresponding to each first number of adjacent pixels in the to-be-processed map data, the electronic device can generate target map data containing the target characters according to the positions of the pixels in the to-be-processed map data. For example, referring to Table 8, Table 8 is to-be-processed map data provided by an embodiment of the present application.

[0112] Table 8

[0113] 2 2 2 0 1 1

[0114] In generating the to-be-processed map data shown in Table 8, the number of categories of map features is 8, the first number is 2, and the first number of digits is 3. The identifiers of the first and second pixel points in the to-be-processed map data are 2 and 2. Let a = 2 and b = 2. The target character obtained by compressing the identifiers of the first two pixel points is tmp. The electronic device calculates the value of the target character tmp obtained by compressing the identifiers of the first two pixel points in the following manner.

[0115] int_8 tmp = 0; / / The initial value of tmp is 0.

[0116] tmp = tmp | (a << 3); / / The value of tmp is bitwise ORed with the value of (a << 3) as a new tmp value.

[0117] tmp = tmp | (b & 0x7). / / The value of tmp is bitwise ORed with the value of (b & 0x7) as a new tmp value.

[0118] a is converted into a three-digit binary value 010, (a << 3) indicates that a is left shifted by 3 bits to obtain 010000, and the initial value of tmp (i.e., 000000) is bitwise ORed with 010000 to obtain a new tmp value 010000. (b & 0x7) indicates that b is bitwise ANDed with 7 in hexadecimal, b is converted into a three-digit binary value 010, 0x7 represents a hexadecimal value 7, the hexadecimal value 7 is converted into a binary value 111, 010 is bitwise ANDed with 111 to obtain 010, and 010 is represented as a six-digit binary value 000010. The new tmp value 010000 is bitwise ORed with 000010 to obtain 010010. 010010 is converted into a decimal value to obtain an index value 18. The index value 18 corresponds to a target character S in the correspondence table shown in Table 7.

[0119] Similarly, the identifiers of the second and fourth pixel points in the to-be-processed map data are 2 and 0. The electronic device converts the identifiers of the two pixel points into three-digit binary values to obtain 010 and 000, respectively. The binary values corresponding to the two pixel points are spliced to obtain a splicing result 010000. The splicing result is converted into a decimal value to obtain an index value 16. The index value 16 corresponds to a target character Q in the correspondence table shown in Table 7.

[0120] The identification of the 5th and 6th pixel points in the to-be-processed map data is 1 and 1. The electronic device converts the identification of the two pixel points into a three-bit binary value respectively to obtain 001 and 001, splices the binary values corresponding to the two pixel points to obtain a splicing result 001001, converts the splicing result into a decimal value, and obtains a corresponding index value 9. The corresponding relationship table shown in Table 7 is looked up to obtain a target character corresponding to the index value 9, which is J.

[0121] Further, according to the positions of the pixel points in the to-be-processed map data shown in Table 8, target map data containing target characters is generated (as shown in Table 9).

[0122] Table 9

[0123] S Q J

[0124] It can be seen that, based on the map data compression method provided in the embodiments of the present application, when the number of types of map features is 8, the to-be-processed map data containing 6 characters (that is, 222011) can be compressed into target map data containing 3 characters (that is, SQJ), that is, the to-be-processed map data of 6 bits is compressed into target map data of 3 bits, the size of the target map data obtained by compression is 50% of the size of the to-be-processed map data, the compression rate of the map data can reach 50%, and the compression rate is stable and is not affected by the specific value of the identification of the pixel point, which can improve the effectiveness of map data compression.

[0125] Referring to Table 10, Table 10 is to-be-processed map data provided by an embodiment of the present application.

[0126] Table 10

[0127] 2 2 3 3 2 1

[0128] When generating the to-be-processed map data shown in Table 10, the number of types of map features is 4, the first number is 3, and the first bit number is 2. The identification of the 1st to 3rd pixel points in the to-be-processed map data is 2, 2, and 3. Let a=2, b=2, and c=3, the target character obtained by compressing the identification of the first three pixel points in the to-be-processed map data is tmp, and the electronic device calculates the value of the target character tmp obtained by compressing the identification of the first three pixel points in the to-be-processed map data in the following manner.

[0129] int_8 tmp = 0; / / The initial value of tmp is 0.

[0130] tmp = tmp | (a << 4); / / The value of tmp is bitwise or operated with the value of (a << 4) as a new tmp value.

[0131] tmp = tmp | (b << 2); / / the value of tmp is bitwise or operated with the value of (b << 2) as a new tmp value;

[0132] tmp = tmp | c; / / the value of tmp is bitwise or operated with c as a new tmp value.

[0133] a is converted into a binary value of two bits as 10, (a << 4) indicates that a is left shifted by 4 bits to obtain 100000, and the initial value of tmp (i.e. 000000) is bitwise or operated with 100000 to obtain a new value of tmp as 100000. b is converted into a binary value of two bits as 10, (b << 2) indicates that b is left shifted by 2 bits to obtain 001000, and the new value of tmp (i.e. 100000) is bitwise or operated with 001000 to obtain a new value of tmp as 101000. c is converted into a binary value of two bits as 11, 11 is converted into a binary value of six bits as 000011, and the new value of tmp (i.e. 101000) is bitwise or operated with 000011 to obtain a new value of tmp as 101011. 101011 is converted into a decimal value, and the corresponding index value is obtained as 43. The corresponding relationship table shown in Table 7 is searched, and the target character corresponding to the index value 43 is obtained as r.

[0134] Similarly, the identifiers of the 4th to 6th pixel points in the to-be-processed map data are 3, 2 and 1. The electronic device converts the identifiers of the three pixel points into binary values of two bits to obtain 11, 10 and 01, respectively, and splices the binary values corresponding to the three pixel points to obtain a splicing result as 111001. The splicing result is converted into a decimal value, and the corresponding index value is obtained as 57. The corresponding relationship table shown in Table 7 is searched, and the target character corresponding to the index value 57 is obtained as 5.

[0135] Further, according to the positions of the pixel points in the to-be-processed map data shown in Table 10, target map data (as shown in Table 11) containing the determined target characters is generated.

[0136] Table 11

[0137] r 5

[0138] It can be seen that, based on the map data compression method provided in the embodiments of the present application, the to-be-processed map data containing 6 characters (i223321) can be compressed into target map data containing 2 characters (i.e. r5), that is, the 6-bit to-be-processed map data is compressed into 2-bit target map data, the size of the compressed target map data is 33.3% of the size of the to-be-processed map data, the compression rate of the map data can reach 66.6%, and the compression rate is stable and is not affected by the specific values of the pixel point identifiers, which can improve the effectiveness of map data compression.

[0139] In addition, the map data compression method provided in the embodiments of the present application uses bit operation in the process of compressing the to-be-processed map data, and the performance of the bit operation is extremely high. The encoding of the to-be-processed map data and the decoding of the target map data can be completed in one cycle, for example, for target map data containing n target characters, for each target character, only one reading of the target character is needed, and the identifier of the first number of pixel points corresponding to the target character can be calculated. The time complexity of decoding the target map data is O(n). In addition, no additional memory space is required for encoding the to-be-processed map data and decoding the target map data, and the space complexity is 0, that is, the time complexity and space complexity of the map data compression method provided in the embodiments of the present application are relatively low.

[0140] In addition, the to-be-processed map data and the target map data in the embodiments of the application are composed of strings, and the subsequent user end will convert the string into picture data, which is suitable for devices such as floor cleaning robots that cannot process pure picture data. In addition, if the map data is stored in the server, it is suitable for interfaces in the server that can only process pure text format, and the compression rate of the map data is high, which can reduce the storage space of the server.

[0141] In some embodiments, after step S104, the method can further include the following steps: sending the target map data to the user end, so that the user end displays the corresponding map based on the target map data.

[0142] The user terminal can correspond to a sweeping robot that collects map data of a target scene. After obtaining the target map data, the electronic device can send the target map data to the user terminal, which can improve the transmission efficiency of the map data, save the traffic cost and transmission time of transmitting the map data. The electronic device can also send the user terminal the width-height information corresponding to the target map data, which represents the number of pixel points contained in the target map data in the horizontal direction and the number of pixel points contained in the vertical direction. Correspondingly, the user terminal can then decompress the received target map data and generate the target scene map data according to the received width-height information. Further, the user terminal can display the map of the target scene according to the target scene map data for the user to browse, which can improve the user experience.

[0143] With Figure 1 Corresponding to the map data compression method shown in the above embodiment, the present application also provides a map data decompression method. The method can be applied to an electronic device, which can be the user terminal in the above embodiment. The electronic device can obtain target map data obtained based on the map data compression method in the above embodiment, and decompress the target map data according to the map data decompression method provided in the present application to obtain target map data. Subsequently, the electronic device can display the corresponding map according to the target map data for the user to browse.

[0144] Referring to Figure 4 , Figure 4 A flowchart of a map data decompression method provided in the present application, which includes the following steps:

[0145] S401: Obtain target map data.

[0146] The target map data is obtained based on the map data compression method in the above embodiment.

[0147] S402: For each target character in the target map data, determine the index value corresponding to the target character according to the preset index value and character correspondence relationship.

[0148] S403: Decode the index value corresponding to the target character to obtain the identification of the first number of adjacent pixel points corresponding to the target character.

[0149] S404: Generate target map data containing the identification of the first number of adjacent pixel points corresponding to each target character according to the position of each target character in the target map data.

[0150] Based on the map data decompression method provided in the embodiments of the present application, the target map data is obtained by compressing the identifiers of the first number of pixel points in the to-be-processed map data into a character, which can improve the effectiveness of map data compression, and the compressed target map data can be decompressed to obtain the corresponding to-be-processed map data. Subsequently, the electronic device can display the corresponding map according to the to-be-processed map data for the user to browse, thereby improving the user experience.

[0151] For steps S401 and S402, the target map data is obtained based on the map data compression method in the foregoing embodiments. The target map data includes a plurality of target characters, and for each target character in the target map data, the electronic device can find the index value corresponding to the target character in the preset index value and character correspondence.

[0152] It can be understood that the index value and character correspondence used when decompressing the target map data is the same as the index value and character correspondence used when compressing the to-be-processed map data. For example, if the to-be-processed map data is compressed according to the index value and character correspondence shown in Table 6, the target map data is decompressed according to the index value and character correspondence shown in Table 6.

[0153] For step S403, for each target character in the target map data, the electronic device can decode the index value corresponding to the target character in the following manner to obtain the identifiers of the first number of adjacent pixel points corresponding to the target character.

[0154] Method 1. The decoding method introduced in method 1 corresponds to the encoding method of the first number of adjacent pixel point identifiers introduced in method one in the foregoing embodiments. That is, the decoding method introduced in method 1 is used to decode the index value obtained by the encoding method introduced in method one in the foregoing embodiments.

[0155] For each target character in the target map data, the electronic device can directly split the index value corresponding to the target character into the first number of values to obtain the identifiers of the first number of adjacent pixel points corresponding to the target character.

[0156] Method 2. The decoding method introduced in method 2 corresponds to the encoding method of the first number of adjacent pixel point identifiers introduced in method two in the foregoing embodiments. That is, the decoding method introduced in method 2 is used to decode the index value obtained by the encoding method introduced in method two in the foregoing embodiments.

[0157] On the basis of Figure 4 , referring to Figure 5 , step S403 can include the following steps:

[0158] S4031: split the index value corresponding to the target character to obtain a first number of binary values.

[0159] S4032: obtain the identifiers of the first number of adjacent pixel points corresponding to the target character based on the first number of binary values.

[0160] In an implementation, for each target character in the target map data, if it is determined that the index value corresponding to the target character is a binary value according to the correspondence between the index values and the characters shown in Table 6, the electronic device splits the index value corresponding to the target character according to a second number of characters as a binary value to obtain a first number of binary values. The second number is the first number of digits in the foregoing embodiments, and the second number corresponds to the first number. When the first number is 3, the second number is 2; and when the first number is 2, the second number is 3.

[0161] The splitting manner of the index value introduced in this implementation corresponds to the manner of directly taking the splicing result as the index value corresponding to the first number of adjacent pixel points introduced in the second manner of the foregoing embodiments.

[0162] For example, the target character is J, the index value corresponding to the target character is 001001 according to the correspondence between the index values and the characters shown in Table 6, if the first number is 3, the second number is 2, and then the index value 001001 corresponding to the target character can be split according to 2 characters as a binary value to obtain 3 binary values 00, 10, and 01.

[0163] In another implementation, on the basis of Figure 5 , referring to Figure 6 , step S4031 can include the following steps:

[0164] S40311: convert the index value corresponding to the target character into a binary value representing the index value corresponding to the target character.

[0165] S40312: split the binary value representing the index value corresponding to the target character to obtain a first number of binary values.

[0166] For each target character in the target map data, if it is determined according to the correspondence between the index value and the character shown in Table 7 that the index value corresponding to the target character is a decimal value, the electronic device converts the index value corresponding to the target character into a binary value of the second number of bits to obtain a binary value representing the index value corresponding to the target character. Then, the electronic device splits the binary value representing the index value corresponding to the target character according to the second number of characters as one binary value to obtain a first number of binary values. The second number of bits is the product of the first number and the second number. For example, when the first number is 3 and the second number is 2, the second number of bits is 6.

[0167] The manner of splitting the index value introduced in this implementation corresponds to the manner of converting the spliced result into a decimal value and taking the converted decimal value as the index value corresponding to the first number of adjacent pixel points in the second manner in the foregoing embodiment.

[0168] For example, the target character is J, according to the correspondence between the index value and the character shown in Table 7, the index value corresponding to the target character is 9, and the binary value of 6 bits converted from the index value 9 is 001001. If the first number is 3, and the second number is 2, the index value 001001 corresponding to the target character can be split according to 2 characters as one binary value to obtain 3 binary values 00, 10, and 01.

[0169] In an implementation, the electronic device can directly take the first number of binary values as the identification of the first number of adjacent pixel points corresponding to the target character.

[0170] The manner of determining the identification of the first number of adjacent pixel points corresponding to the target character introduced in this implementation corresponds to the manner of obtaining the binary value representing the identification of the pixel point when the identification of the pixel point is a binary value in the second manner in the foregoing embodiment.

[0171] In another implementation, the electronic device converts the first number of binary values into a first number of decimal values respectively to obtain the first number of decimal values as the identification of the first number of adjacent pixel points corresponding to the target character.

[0172] The manner of determining the identification of the first number of adjacent pixel points corresponding to the target character introduced in this implementation corresponds to the manner of obtaining the binary value representing the identification of the pixel point when the identification of the pixel point is a decimal value in the second manner in the foregoing embodiment.

[0173] For example, if the first number of binary values obtained based on the splitting processing of the target character are 00, 10, 01, the first number of binary values are respectively converted into decimal values 0, 2, 1, and the identifiers of the first number of adjacent pixel points corresponding to the target character are respectively 0, 2, and 1.

[0174] For step S404, after obtaining the identifiers of the first number of adjacent pixel points corresponding to each target character, the electronic device can generate, according to the positions of each target character in the target map data, the to-be-processed map data containing the identifiers of the first number of adjacent pixel points corresponding to each target character. The electronic device can also receive width and height information corresponding to the target map data, the width and height information indicating the number of pixel points contained in the to-be-processed map data corresponding to the target map data in the horizontal direction and the number of pixel points contained in the vertical direction. Correspondingly, after determining the identifiers of the first number of adjacent pixel points corresponding to each target character, the electronic device generates the corresponding to-be-processed map data according to the received width and height information.

[0175] For example, the identifiers of the first number of adjacent pixel points corresponding to each target character in the target map data include 000010112. The width and height information indicates that the to-be-processed map data corresponding to the target map data contains 3 pixel points in the horizontal direction and 3 pixel points in the vertical direction, and the electronic device can generate the to-be-processed map data shown in Table 12.

[0176] Table 12

[0177] 0 0 0 0 1 0 1 1 2

[0178] For example, for the target map data shown in Table 9, when generating the target map data shown in Table 9, the number of types of map features is 8, the first number is 2, the second number is 3, and the second digit is 6. The first target character in the target map data is S, the electronic device looks up the corresponding relationship table shown in Table 7 to obtain the index value corresponding to the target character S as 18, and records tmp = 18. The identifiers of the two pixel points corresponding to the target character S are a and b, respectively. The electronic device calculates the values of the identifiers a and b of the two pixel points corresponding to the target character S in the following manner.

[0179] int_8 tmp = 18; / / input the value 18 of tmp;

[0180] int_8 a = tmp >> 3 & 0x7; / / perform bitwise AND operation on the value of (tmp >> 3) and 0x7 to obtain the value of a;

[0181] Int_8 b = tmp & 7. / / perform bitwise AND operation on the value of tmp and 7 to obtain the value of b.

[0182] The value of tmp (i.e. 18) is converted into a binary value of six bits, which is 010010, (tmp » 3) represents right shifting tmp by 3 bits, and right shifting 010010 by 3 bits results in 010. 0x7 represents a hexadecimal value of 7, which is converted into a binary value of 111, and performing a bitwise AND operation between 010 (i.e. the value of (tmp » 3)) and 111 results in 010, which is converted into a decimal value to obtain the value of a, which is 2. The decimal value of 7 is converted into a binary value of 111, which is represented as a binary value of six bits as 000111, and performing a bitwise AND operation between 010010 (i.e. the value of tmp) and 000111 results in 000010, which is converted into a decimal value to obtain the value of b, which is 2. Therefore, the identifiers of the two pixel points corresponding to the target character S are 2 and 2, respectively.

[0183] Similarly, the second target character in the target map data is Q. The electronic device looks up the correspondence table shown in Table 7 to obtain an index value corresponding to the target character Q, which is 16. The electronic device converts the index value 16 into a binary value of six bits to obtain 010000. The electronic device splits the binary value of six bits according to the rule that three characters correspond to one binary value, to obtain two binary values of three bits, which are 010 and 000. The two binary values of three bits are converted into decimal values to obtain the identifiers of two pixel points, which are 2 and 0, respectively.

[0184] The third target character in the target map data is J. The electronic device looks up the correspondence table shown in Table 7 to obtain an index value corresponding to the target character J, which is 9. The electronic device converts the index value 9 into a binary value of six bits to obtain 001001. The electronic device splits the binary value of six bits according to the rule that three characters correspond to one binary value, to obtain two binary values of three bits, which are 001 and 001. The two binary values of three bits are converted into decimal values to obtain the identifiers of two pixel points, which are 1 and 1, respectively.

[0185] Further, according to the positions of the target characters in the to-be-processed map data shown in Table 9, the to-be-processed map data containing the identifiers of the determined pixel points is generated (as shown in Table 8).

[0186] For example, for the target map data shown in Table 11, when the target map data shown in Table 11 is generated, the number of types of map features is 4, the first number is 3, the second number is 2, and the second bit number is 6. The first target character in the target map data is r. The electronic device looks up the correspondence table shown in Table 7 to obtain an index value corresponding to the target character r, which is 43, denoted as tmp = 43. The identifiers of three pixel points corresponding to the target character r are a, b and c, respectively. The electronic device calculates the values of the identifiers a, b and c of the three pixel points corresponding to the target character r in the following manner.

[0187] int_8tmp = 43; / / the value of tmp is 43;

[0188] int_8a = tmp >> 4 & 0x3; / / the value of (tmp >> 4) is bitwise ANDed with 0x3 as the value of a;

[0189] int_8b = tmp >> 2 & 0x3; / / the value of (tmp >> 2) is bitwise ANDed with 0x3 as the value of b;

[0190] int_8c = tmp & 0x3; / / the value of tmp is bitwise ANDed with 0x3 as the value of c.

[0191] The value of tmp (i.e. 43) is converted into a binary value of six bits as 101011, tmp >> 4 indicates that the value of tmp is right shifted by 4 bits, 101011 is right shifted by 4 bits to obtain 10, 0x3 indicates a hexadecimal value of 3, the hexadecimal value of 3 is converted into a binary value of two bits as 11, 10 (i.e. the value of (tmp >> 4)) is bitwise ANDed with 11 to obtain 10, 10 is converted into a decimal value to obtain a as 2. tmp >> 2 indicates that the value of tmp is right shifted by 2 bits, 101011 is right shifted by 2 bits to obtain 1010. 0x3 indicates a hexadecimal value of 3, the hexadecimal value of 3 is converted into a binary value of two bits as 0011, 1010 (i.e. the value of (tmp >> 2)) is bitwise ANDed with 0011 to obtain 0010, 0010 is converted into a decimal value to obtain b as 2. 0x3 indicates a hexadecimal value of 3, the hexadecimal value of 3 is converted into a binary value of two bits as 11, 11 is expressed as a binary value of six bits as 000011, 101011 (i.e. the value of tmp) is bitwise ANDed with 000011 to obtain 000011, 000011 is converted into a decimal value to obtain c as 3, and the identifiers of the three pixel points corresponding to the target character r are 2, 2 and 3 respectively.

[0192] Similarly, the second target character in the target map data is 5. The electronic device looks up the corresponding relationship table shown in Table 7 to obtain an index value corresponding to the target character 5 as 57. The electronic device converts the index value 57 into a binary value of six bits to obtain 111001. The electronic device splits the binary value of six bits according to two characters as one binary value to obtain three binary values of two bits as 11, 10 and 01. The three binary values of two bits are respectively converted into decimal values to obtain the identifiers of the three pixel points as 3, 2 and 1 respectively.

[0193] Further, according to the positions of the target characters in the to-be-processed map data shown in Table 11, the to-be-processed map data containing the determined identities of the pixel points (as shown in Table 10) is generated.

[0194] In some embodiments, on the basis of Figure 4 , see Figure 7 , after step S404, the method can further include the following steps:

[0195] S405: For each pixel point in the to-be-processed map data, determine the color corresponding to the identity of the pixel point.

[0196] S406: Render according to the colors corresponding to the pixel points in the to-be-processed map data to display the map corresponding to the to-be-processed map data.

[0197] The color corresponding to the identity of each pixel point corresponds to the map feature represented by the pixel point. For example, the color corresponding to the identity of the pixel point is blue if the map feature represented by the pixel point is an obstacle, the color corresponding to the identity of the pixel point is gray if the map feature represented by the pixel point is a wall, the color corresponding to the identity of the pixel point is white if the map feature represented by the pixel point is an empty land, and the color corresponding to the identity of the pixel point is red if the map feature represented by the pixel point is the cleaning route of the robot.

[0198] The electronic device creates a corresponding canvas in the display interface according to the number of pixel points contained in the to-be-processed map data, determines the color corresponding to the identity of each pixel point in the to-be-processed map data, and renders at the pixel point in the created canvas to display the map corresponding to the to-be-processed map data, that is, the map of the target scene cleaned by the robot.

[0199] For example, see Figure 8 , Figure 8 A display interface schematic diagram of a map provided by an embodiment of the present application. In Figure 8 , the map of the target scene cleaned by the robot is displayed. Figure 8 In the map of the target scene, different map features are represented by different colors, for example, the empty lands of rooms 1 to 5, the empty lands of rooms 7 to 9, the empty land of the bedroom, the empty land of the living room, the cleaning route of the robot, and the obstacles are represented by different colors. Figure 8 In the map of the target scene, “Article 4” represents the number of obstacles in the target scene.

[0200] In addition, the display interface can also display the current state of the sweeping robot and the cleaning data of the sweeping robot. For example, the current state of the sweeping robot is "drying the mop", and the sweeping robot cleaned 43.8 square meters last time, and the time used is 44 minutes. The display interface can also display the working mode of the sweeping robot, such as "sweeping first and then mopping", "sweeping and mopping at the same time", "single sweeping", and "single mopping". The user can select a working mode, for example, the user can select the "single mopping" working mode and click the "start" button to instruct the sweeping robot to clean according to the working mode selected by the user. The "look home" button in the display interface indicates that the image of the target scene is captured by the image acquisition module of the sweeping robot. The "charging" button indicates that the sweeping robot is currently charging.

[0201] Referring to FIG. 9(a), FIG. 9(a) is a schematic diagram of another display interface of a map provided by an embodiment of the present application. The display interface shown in FIG. 9(a) displays a map of the target scene cleaned by the sweeping robot. In FIG. 9(a), different gray values represent different colors, and different map features in the map of the target scene are represented by different colors, such as empty land, the cleaning route of the sweeping robot, and obstacles.

[0202] In addition, the display interface can also display the current state of the sweeping robot and the cleaning data of the sweeping robot. For example, the current state of the sweeping robot is "drying the mop", and the sweeping robot cleaned 43.8 square meters last time, and the time used is 44 minutes. The display interface can also display the working mode of the sweeping robot, such as "sweeping first and then mopping", "sweeping and mopping at the same time", "single sweeping", and "single mopping". The user can select a working mode, for example, the user can select the "single mopping" working mode and click the "start" button to instruct the sweeping robot to clean according to the working mode selected by the user. The "look home" button in the display interface indicates that the image of the target scene is captured by the image acquisition module of the sweeping robot. The "charging" button indicates that the sweeping robot is currently charging.

[0203] Referring to FIG. 9(b), FIG. 9(b) is a schematic diagram of another display interface of a map provided by an embodiment of the present application. The map displayed in FIG. 9(b) is a map of the target scene cleaned by the sweeping robot at a different time than that in FIG. 9(a). The cleaning area of the sweeping robot in FIG. 9(b) is 31.1 square meters, and the time used is 63 minutes. The cleaning area and the time used of the sweeping robot shown in FIG. 9(b) are greater than those shown in FIG. 9(a), and the area occupied by the cleaning route of the sweeping robot in FIG. 9(b) is greater than that in FIG. 9(a).

[0204] Referring to Figure 10 , Figure 10A schematic diagram of the principle of a map data compression method provided by an embodiment of the present application. The electronic device obtains the to-be-processed map data as 3114. The first number is 2, and the first digit is 3. For the identifier of each pixel point in the to-be-processed map data, the identifier of the pixel point is converted into a three-digit binary value. Specifically, 3 is converted into a three-digit binary value as 011, 1 is converted into a three-digit binary value as 001, and 4 is converted into a three-digit binary value as 100.

[0205] Then, the electronic device splices the binary values corresponding to the two adjacent pixel points, specifically, splices the binary value corresponding to 3 and the binary value corresponding to 1, to obtain a splicing result as 011001, which is expressed as an eight-digit binary value as 00011001. The binary value corresponding to 1 and the binary value corresponding to 4 are spliced to obtain a splicing result as 001100, which is expressed as an eight-digit binary value as 00001100.

[0206] Further, the splicing result is converted into a decimal value to obtain the index value corresponding to the two adjacent pixel points, and the target character corresponding to the two adjacent pixel points is obtained according to the preset correspondence between the index value and the character. Specifically, 00011001 is converted into a decimal value as 25, so that the index value corresponding to 3 and 1 is 25, and the corresponding target character is obtained by querying the correspondence between the index value and the character shown in Table 7 as Z. 00001100 is converted into a decimal value as 12, so that the index value corresponding to 1 and 4 is 12, and the corresponding target character is obtained by querying the correspondence between the index value and the character shown in Table 7 as M. Further, the target map data can be obtained as ZM.

[0207] Referring to Figure 11 , Figure 11 A schematic diagram of the principle of a map data decompression method provided by an embodiment of the present application. The input target character in the target mapData (map data) includes: AAAAAQQJ, and the width and height information corresponding to the target map data, the width and height information includes: the width is 4, and the height is 4, so that the width and height information indicates that the to-be-processed map data obtained by decompression contains 4 pixel points horizontally and 4 pixel points vertically. The index value corresponding to the target character A is 0, the index value corresponding to the target character Q is 16, and the index value corresponding to the target character J is 9, which are obtained by querying the correspondence between the index value and the character shown in Table 7. The index value 0 corresponding to the target character A is converted into a six-digit binary value as 000000; the index value 16 corresponding to the target character Q is converted into a six-digit binary value as 010000, and the index value 9 corresponding to the target character J is converted into a six-digit binary value as 001001.

[0208] Taking the high three bits and the low three bits of the binary value 000000 respectively, two binary values 000 and 000 can be obtained; taking the high three bits and the low three bits of the binary value 010000 respectively, two binary values 010 and 000 can be obtained, and taking the high three bits and the low three bits of the binary value 001001 respectively, two binary values 001 and 001 can be obtained.

[0209] The binary value 000 is converted into a decimal value 0, and the binary value 010 is converted into a decimal value 2, and the binary value 001 is converted into a decimal value 1, and then the final result (i.e. the to-be-processed map data) can be output as: 0000000000202011.

[0210] On the basis of Figure 11 , see Figure 12 , Figure 12 is a principle diagram of a map drawing method provided by the embodiment of the application. According to the width and height information corresponding to the target map data, a canvas of 4*4 pixels is created, that is, a canvas containing 4 pixels horizontally and 4 pixels vertically is created. When drawing a map, the color corresponding to the identification of each pixel in the to-be-processed map data is determined, Figure 12 In the case where different gray values represent different colors in the method embodiment, the identification of different pixels corresponds to different colors, and the color corresponding to the identification of each pixel in the to-be-processed map data is rendered, so that 16 1*1 colored rectangles can be obtained, that is, the map corresponding to the to-be-processed map data can be obtained.

[0211] Corresponding to the method embodiment of Figure 1 , see Figure 13 , Figure 13 is a structural diagram of a map data compression device provided by the embodiment of the application, and the device comprises:

[0212] A to-be-processed map data acquisition module 1301 is configured to acquire to-be-processed map data; wherein the to-be-processed map data comprises the identification of each pixel, and the identification of each pixel is determined based on the map feature represented by the pixel;

[0213] An index value determination module 1302 is configured to encode the identification of each adjacent first number of pixels in the to-be-processed map data to obtain a corresponding index value;

[0214] A target character determination module 1303 is configured to determine the character corresponding to the adjacent first number of pixels as a target character based on the determined index value and a preset corresponding relationship between index values and characters.

[0215] The target map data generation module 1304 is configured to generate map data containing each target character according to the positions of each pixel point in the to-be-processed map data, to obtain target map data.

[0216] Optionally, the index value determination module 1302 is specifically configured to obtain a binary value representing the identifier of each pixel point in the first number of adjacent pixel points; splice the binary values corresponding to the first number of adjacent pixel points according to the positions of the first number of adjacent pixel points in the to-be-processed map data, to obtain a spliced result; and determine the index value corresponding to the first number of adjacent pixel points based on the spliced result.

[0217] Optionally, the index value determination module 1302 is specifically configured to perform base conversion on the spliced result, to obtain a decimal value representing the spliced result as the index value corresponding to the first number of adjacent pixel points.

[0218] Optionally, the to-be-processed map data acquisition module 1301 is specifically configured to acquire original map data of a target scene; obtain the identifier of each pixel point in the original map data based on the map feature of the corresponding position of the pixel point in the target scene; and generate map data containing the identifiers of each pixel point as to-be-processed map data.

[0219] Optionally, the apparatus further includes a target map data sending module configured to send the target map data to a user side after the target map data generation module 1304 generates map data containing each target character according to the positions of each pixel point in the to-be-processed map data, to obtain target map data, so that the user side displays a corresponding map based on the target map data.

[0220] Based on the map data compression apparatus provided in the embodiments of the present application, the identifiers of the first number of pixel points in the to-be-processed map data can be compressed into one character, and the target map data obtained is smaller than the to-be-processed map data, so that the effectiveness of map data compression can be improved.

[0221] Corresponding to the method embodiments of the present application, Figure 4 see the structural diagram of a map data decompression apparatus provided in the embodiments of the present application. Figure 14 , Figure 14 The apparatus includes:

[0222] The target map data acquisition module 1401 is configured to acquire target map data; wherein the target map data is obtained based on the map data compression method in the foregoing embodiments;

[0223] The index value determination module 1402 is configured to determine, for each target character in the target map data, an index value corresponding to the target character according to a preset index value and character correspondence relationship.

[0224] The pixel point identifier determination module 1403 is configured to decode the index value corresponding to the target character to obtain an identifier of a first number of adjacent pixel points corresponding to the target character.

[0225] The to-be-processed map data generation module 1404 is configured to generate to-be-processed map data containing identifiers of a first number of adjacent pixel points corresponding to each target character according to positions of the target characters in the target map data.

[0226] Optionally, the pixel point identifier determination module 1403 is specifically configured to split the index value corresponding to the target character to obtain a first number of binary values, and obtain the identifier of the first number of adjacent pixel points corresponding to the target character based on the first number of binary values.

[0227] Optionally, the pixel point identifier determination module 1403 is specifically configured to perform base conversion on the index value corresponding to the target character to obtain a binary value representing the index value corresponding to the target character, and split the binary value representing the index value corresponding to the target character to obtain a first number of binary values.

[0228] Optionally, the apparatus further includes a color determination module configured to determine a color corresponding to an identifier of each pixel point in the to-be-processed map data after the to-be-processed map data generation module 1404 generates the to-be-processed map data containing identifiers of a first number of adjacent pixel points corresponding to each target character according to positions of the target characters in the target map data, and a map display module configured to render the to-be-processed map data according to colors corresponding to the pixel points in the to-be-processed map data to display a map corresponding to the to-be-processed map data.

[0229] Based on the map data decompression apparatus provided in the embodiments of the present application, the target map data is obtained by compressing identifiers of a first number of pixel points in to-be-processed map data into a character, which can improve the effectiveness of map data compression and can decompress the compressed target map data to obtain corresponding to-be-processed map data. Subsequently, an electronic device can display a corresponding map according to the to-be-processed map data to enable a user to browse, which can improve user experience.

[0230] The embodiments of the present application also provide an electronic device, such as Figure 15As shown, the electronic device includes a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504, wherein the processor 1501, the communication interface 1502, and the memory 1503 communicate with each other through the communication bus 1504, the memory 1503 is configured to store a computer program, and the processor 1501 is configured to execute the program stored in the memory 1503 to implement the map data compression method steps of any one of the preceding embodiments or the map data decompression method steps of any one of the preceding embodiments.

[0231] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus. The communication interface is used for communication between the above electronic device and other devices.

[0232] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), for example, at least one disk memory. Optionally, the memory can also be at least one storage device located away from the above processor.

[0233] The above processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0234] In another embodiment provided in the present application, a sweeping robot system is also provided, including an image acquisition module and a processor;

[0235] The image acquisition module is configured to acquire original map data of a target scene.

[0236] The processor is configured to perform any of the above map data compression method steps.

[0237] In another embodiment provided in the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement any of the above map data compression method steps, or any of the above map data decompression method steps.

[0238] In another embodiment provided in the present application, a computer program product is provided, and the computer program product contains instructions. When the computer program product is executed on a computer, the computer is caused to perform any of the above map data compression method, or any of the above map data decompression method.

[0239] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium, or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, solid state disk (SSD)) and the like.

[0240] It is to be noted that, in the present document, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily implying any actual relationship or order between such entities or actions. Also, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0241] Each of the embodiments in the present specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the device, electronic device, robot cleaner system, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.

[0242] The above only describes the preferred embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A map data compression method characterized by, The method comprises: acquiring to-be-processed map data; wherein the to-be-processed map data contains the identities of each pixel point, and the identity of each pixel point is determined based on a map feature represented by the pixel point; the map feature represented by each pixel point is a map feature of a corresponding position of the pixel point in a target scene; encoding the identities of each adjacent first number of pixel points in the to-be-processed map data to obtain corresponding index values; based on the determined index values and a preset correspondence between index values and characters, determining the characters corresponding to the adjacent first number of pixel points as target characters; generating map data containing each target character according to the positions of each pixel point in the to-be-processed map data to obtain target map data.

2. The method of claim 1, wherein, The encoding of the identities of each adjacent first number of pixel points in the to-be-processed map data to obtain corresponding index values comprises: for each pixel point in the adjacent first number of pixel points, acquiring a binary value representing the identity of the pixel point; splicing the binary values corresponding to the adjacent first number of pixel points according to the positions of the adjacent first number of pixel points in the to-be-processed map data to obtain a splicing result; based on the splicing result, determining the index values corresponding to the adjacent first number of pixel points.

3. The method of claim 2, wherein, The determination of the index values corresponding to the adjacent first number of pixel points based on the splicing result comprises: performing a base conversion on the splicing result to obtain a decimal value representing the splicing result as the index values corresponding to the adjacent first number of pixel points.

4. The method of claim 1, wherein, The acquisition of to-be-processed map data comprises: acquiring original map data of a target scene; for each pixel point in the original map data, obtaining the identity of the pixel point based on a map feature of a corresponding position of the pixel point in the target scene; generating map data containing the identities of each pixel point as to-be-processed map data.

5. The method of claim 1, wherein, After the generation of target map data by generating map data containing each target character according to the positions of each target character in the target map data, the method further comprises: sending the target map data to a user terminal to enable the user terminal to display a corresponding map based on the target map data.

6. A map data decompression method characterized by comprising: The method comprises: acquiring target map data; wherein the target map data is obtained based on the map data compression method of any one of claims 1-5; for each target character in the target map data, determining the index value corresponding to the target character according to a preset correspondence between index values and characters; decoding the index value corresponding to the target character to obtain the identities of the adjacent first number of pixel points corresponding to the target character; generating to-be-processed map data containing the identities of the adjacent first number of pixel points corresponding to each target character according to the positions of each target character in the target map data; wherein the identity of each pixel point is determined based on a map feature represented by the pixel point; the map feature represented by each pixel point is a map feature of a corresponding position of the pixel point in a target scene.

7. The method of claim 6, wherein, The index value corresponding to the target character is decoded to obtain an identifier of the first number of adjacent pixel points corresponding to the target character, including: Splitting processing is performed based on the index value corresponding to the target character to obtain a first number of binary values; Based on the first number of binary values, the identifier of the first number of adjacent pixel points corresponding to the target character is obtained.

8. The method of claim 7, wherein, The splitting processing based on the index value corresponding to the target character to obtain a first number of binary values includes: The index value corresponding to the target character is converted to a binary value representing the index value corresponding to the target character; The binary value representing the index value corresponding to the target character is split to obtain a first number of binary values.

9. The method of claim 6, wherein, After the map data containing the identifiers of the first number of adjacent pixel points corresponding to each target character is generated according to the positions of each target character in the target map data, the method further includes: For each pixel point in the to-be-processed map data, determine the color corresponding to the identifier of the pixel point; Render according to the colors corresponding to each pixel point in the to-be-processed map data to display the map corresponding to the to-be-processed map data.

10. A map data compression apparatus characterized by comprising: The device includes: A to-be-processed map data acquisition module is configured to acquire to-be-processed map data; wherein the to-be-processed map data contains identifiers of each pixel point, and the identifier of each pixel point is determined based on a map feature represented by the pixel point; the map feature represented by each pixel point is a map feature at a position corresponding to the pixel point in a target scene; An index value determination module is configured to encode the identifiers of each first number of adjacent pixel points in the to-be-processed map data to obtain corresponding index values; A target character determination module is configured to determine the character corresponding to the first number of adjacent pixel points based on the determined index values and a preset correspondence between index values and characters, as a target character; A target map data generation module is configured to generate map data containing each target character according to the positions of each pixel point in the to-be-processed map data to obtain target map data.

11. The apparatus of claim 10, wherein, The index value determination module is specifically configured to acquire a binary value representing the identifier of each pixel point in the first number of adjacent pixel points; splice the binary values corresponding to the first number of adjacent pixel points according to the positions of the first number of adjacent pixel points in the to-be-processed map data to obtain a spliced result; and determine the index value corresponding to the first number of adjacent pixel points based on the spliced result; The index value determination module is specifically configured to perform base conversion on the spliced result to obtain a decimal value representing the spliced result as the index value corresponding to the first number of adjacent pixel points; The to-be-processed map data acquisition module is specifically configured to acquire original map data of a target scene; for each pixel point in the original map data, obtain the identifier of the pixel point based on a map feature at a position corresponding to the pixel point in the target scene; Generate map data containing the identifiers of each pixel point as to-be-processed map data; The device further comprises: The target map data sending module is configured to, after the target map data generating module generates the target map data by generating the map data containing each target character according to the position of each pixel point in the to-be-processed map data, send the target map data to the user end, so that the user end displays the corresponding map based on the target map data.

12. A map data decompression device characterized by comprising: The device comprises: The target map data obtaining module is configured to obtain target map data, wherein the target map data is obtained based on the map data compression method in any one of claims 1-5; The index value determining module is configured to determine, for each target character in the target map data, an index value corresponding to the target character according to a preset index value and character correspondence relationship; The pixel point identifier determining module is configured to decode the index value corresponding to the target character to obtain the identifier of the first number of adjacent pixel points corresponding to the target character; The to-be-processed map data generating module is configured to generate to-be-processed map data containing the identifier of the first number of adjacent pixel points corresponding to each target character according to the position of each target character in the target map data, wherein the identifier of each pixel point is determined based on the map feature represented by the pixel point, and the map feature represented by each pixel point is the map feature of the corresponding position of the pixel point in the target scene.

13. The apparatus of claim 12, wherein, The pixel point identifier determining module is specifically configured to split the index value corresponding to the target character to obtain a first number of binary values, and obtain the identifier of the first number of adjacent pixel points corresponding to the target character based on the first number of binary values. The pixel point identifier determining module is specifically configured to perform base conversion on the index value corresponding to the target character to obtain a binary value representing the index value corresponding to the target character. The binary value representing the index value corresponding to the target character is split to obtain a first number of binary values. The device further comprises: The color determining module is configured to, after the to-be-processed map data generating module generates the to-be-processed map data containing the identifier of the first number of adjacent pixel points corresponding to each target character according to the position of each target character in the target map data, determine the color corresponding to the identifier of each pixel point in the to-be-processed map data. The map display module is configured to render according to the color corresponding to each pixel point in the to-be-processed map data to display the map corresponding to the to-be-processed map data.

14. An electronic device, comprising: The device comprises a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store a computer program; The processor is used to execute the program stored in the memory to implement the method steps in any one of claims 1-5 or any one of claims 6-9.

15. A robotic floor sweeping system, comprising: The device comprises an image acquisition module and a processor; The image acquisition module is configured to acquire original map data of a target scene; The processor is configured to execute the method steps in any one of claims 1-5.

16. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps in claims 1-5, or the method steps in any one of claims 6-9.

Citation Information

Patent Citations

  • Methods and devices for compressing and decompressing map data

    CN103401561A

  • Map data processing method and device of sweeper, storage medium and electronic equipment

    CN114090565A