Electronic device for generating a map and method for controlling the same
An electronic device and a control method thereof are provided. The electronic device includes a communication interface, memory storing one or more computer programs, and one or more processors communicatively coupled to the communication interface and the memory. The one or more computer programs include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to obtain a 2-dimensional (2D) map of an indoor space generated based on sensing data, and traveling data obtained by at least one external device, simplify the obtained 2D map, based on the traveling data, and generate a 3-dimensional (3D) map, based on the simplified 2D map.
1 . An electronic device, comprising:
a communication interface;
memory storing one or more computer programs; and
one or more processors communicatively coupled to the communication interface and the memory,
wherein the one or more computer programs include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
obtain a 2-dimensional (2D) map of an indoor space generated based on sensing data, and traveling data obtained by at least one external device,
simplify the obtained 2D map, based on the traveling data, and
generate a 3-dimensional (3D) map, based on the simplified 2D map, and
wherein the obtaining of the 2D map comprises:
obtaining a 2D grid map based on the sensing data,
obtaining a binary image based on information on obstacles included in the 2D grid map, and
obtaining, as the 2D map, a 2D linear vector map based on the binary image.
2 . The electronic device of claim 1 , wherein the obtaining of the 2D map comprises:
performing a thinning process of uniformly converting a thickness of a line included in the binary image;
extracting straight-line linear vector candidates from the binary image; and
obtaining the 2D linear vector map by connecting the extracted straight-line linear vector candidates and converting to a linear vector.
3 . The electronic device of claim 2 , wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
remove noise included in the 2D linear vector map;
simplify polylines included in the 2D linear vector map with the noise removed, based on the traveling data; and
correct a room area included in the indoor space, based on the simplified 2D linear vector map.
4 . The electronic device of claim 3 , wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
determine a line with a length of the line being less than or equal to a threshold value or a line with an irregularity being greater than or equal to the threshold value as noise from among a plurality of lines included in the 2D linear vector map.
5 . The electronic device of claim 3 , wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
simplify polylines included in the 2D linear vector map with the noise removed for an area traveled by a robot cleaner to be included as an indoor area, based on the traveling data.
6 . The electronic device of claim 3 , wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
delete an area that falls outside a boundary line included in the simplified 2D linear vector map from an existing room area from among room areas included in the indoor space; and
add an area which is not included as the room area despite being within the boundary line included in the simplified 2D linear vector map as a new room area.
7 . The electronic device of claim 3 , further comprising:
a display,
wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
display a user interface (UI) asking a user about performing simplification during a simplification process on the display.
8 . The electronic device of claim 1 , wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
adjust a degree of simplification of the 2D map, based on a user input or obstacle information obtained from the sensing data.
9 . The electronic device of claim 1 , wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to:
determine at least one from among a form, a height, and a thickness of a wall included in the 3D map, based on obstacle information obtained from the sensing data.
10 . The electronic device of claim 1 , further comprising:
a display,
wherein the one or more computer programs further include computer-executable instructions that, when executed by the one or more processors, cause the electronic device to display an editing user interface (UI) for editing the 2D map or the 3D map, based on a user input on the display.
11 . A method performed by an electronic device, the method comprising:
obtaining, by the electronic device, a 2-dimensional (2D) map of an indoor space generated based on sensing data, and traveling data obtained by at least one external device;
simplifying, by the electronic device, the obtained 2D map, based on the traveling data; and
generating, by the electronic device, a 3-dimensional (3D) map, based on the simplified 2D map,
wherein the obtaining of the 2D map comprises:
obtaining a 2D grid map based on the sensing data,
obtaining a binary image based on information on obstacles included in the 2D grid map, and
obtaining, as the 2D map, a 2D linear vector map based on the binary image.
12 . The method of claim 11 , wherein the obtaining of the 2D map comprises:
performing a thinning process of uniformly converting a thickness of a line included in the binary image;
extracting straight-line linear vector candidates from the binary image; and
obtaining the 2D linear vector map by connecting the extracted straight-line linear vector candidates and converting to a linear vector.
13 . The method of claim 12 , wherein the simplifying comprises:
removing noise included in the 2D linear vector map;
simplifying polylines included in the 2D linear vector map with the noise removed, based on the traveling data; and
correcting a room area included in the indoor space, based on the simplified 2D linear vector map.
14 . The method of claim 13 , wherein the removing of the noise comprises:
determining a line with a length of the line being less than or equal to a threshold value or a line with an irregularity being greater than or equal to the threshold value as noise from among a plurality of lines included in the 2D linear vector map.
15 . The method of claim 13 , wherein the simplifying comprises:
simplifying polylines included in the 2D linear vector map with the noise removed for an area traveled by a robot cleaner to be included as an indoor area, based on the traveling data.
16 . The method of claim 13 , wherein the simplifying comprises:
deleting an area that falls outside a boundary line included in the simplified 2D linear vector map from an existing room area from among room areas included in the indoor space; and
adding an area which is not included as the room area despite being within the boundary line included in the simplified 2D linear vector map as a new room area.
17 . The method of claim 13 , wherein the simplifying comprises:
display a user interface (UI) asking a user about performing simplification during a simplification process on a display of the electronic device.
18 . The method of claim 11 , further comprising:
adjusting a degree of simplification of the 2D map, based on a user input or obstacle information obtained from the sensing data.
19 . One or more non-transitory computer-readable storage media storing one or more computer programs including computer-executable instructions that, when executed by one or more processors of an electronic device, cause the electronic device to perform operations, the operations comprising:
obtaining a 2-dimensional (2D) map of an indoor space generated based on sensing data, and traveling data obtained by at least one external device;
simplifying the obtained 2D map, based on the traveling data; and
generating a 3-dimensional (3D) map, based on the simplified 2D map,
wherein the obtaining of the 2D map comprises:
obtaining a 2D grid map based on the sensing data,
obtaining a binary image based on information on obstacles included in the 2D grid map, and
obtaining, as the 2D map, a 2D linear vector map based on the binary image.
20 . The one or more non-transitory computer-readable storage media of claim 19 , wherein to obtain the 2D map the operations further comprise:
performing a thinning process of uniformly converting a thickness of a line included in the binary image;
extracting straight-line linear vector candidates from the binary image; and
obtaining the 2D linear vector map by connecting the extracted straight-line linear vector candidates and converting to a linear vector.