Method for obtaining position information using image and electronic device supporting the same

An electronic device is provided. The electronic device includes a camera that collects image data, a communication circuit that performs communication with an external device, a memory, and a processor. The processor obtains first position information about the electronic device, stores first feature point information based on the first position information, obtains an image via the camera, recognizes an object from the image, extracts second feature point information about the recognized object, and calculates second position information of higher accuracy than the first position information based on comparing the first feature point information with the second feature point information.

BACKGROUND

The disclosure relates to a method for obtaining position information using an image and an electronic device supporting the same.

2. Description of Related Art

An electronic device such as a smartphone or a tablet personal computer (PC) may capture an image using its camera. The electronic device may analyze the image captured using the camera and may provide position information. As a result, a user easily recognizes his or her current position and may quickly move to a desired place.

SUMMARY

When providing position information using an image, an electronic device may provide position information by means of comparison between a previously captured image and a currently captured image. In this case, the amount of calculation for extracting a feature point from each of the actually captured images may increase. Thus, the time the user waits may increase.

Furthermore, when camera settings or capture environments between the actually captured images are different from each other, it may be difficult to extract a feature point. Thus, accurate position information may fail to be provided to the user.

Aspects of the disclosure are to address at least the above-mentioned problems and/or disadvantages and to provide at least the advantages described below. Accordingly, an aspect of the disclosure is to provide position information using an image.

In accordance with an aspect of the disclosure, an electronic device is provided. The electronic device includes a camera module configured to collect image data, a communication circuit configured to perform communication with an external device, a memory, and a processor. The processor may obtain first position information about the electronic device, may store first feature point information based on the first position information, may obtain an image by means of the camera module, may recognize an object from the image, may extract second feature point information about the recognized object, and may calculate second position information of higher accuracy than the first position information based on comparing the first feature point information with the second feature point information.

The electronic device according to various embodiments disclosed in the disclosure may provide a user with accurate position information by means of feature point comparison between an image extracted from a three-dimensional virtual map rendered based on text information about terrain or feature and an actually captured image.

DETAILED DESCRIPTION

FIG.2illustrates a method for obtaining position information using an image according to an embodiment of the disclosure.

Operations210to250according to various embodiments may be performed by at least one component (e.g., a processor120ofFIG.1) of an electronic device101ofFIG.1.

Referring toFIG.2, in operation210, a processor120may obtain first position information of an electronic device101. The first position information may include at least one of, for example, latitude/longitude information and/or azimuth angle information. For example, the processor120may obtain first position information by means of at least one of a wireless communication module (e.g., a wireless communication module192ofFIG.1) and/or a sensor module (e.g., a sensor module176ofFIG.1). The wireless communication module192may receive position information from a global navigation satellite system (GNSS) (e.g., a global positioning system (GPS)) and/or a base station included in a cellular network (e.g., a second network199ofFIG.1). The sensor module176may include at least one inertia sensor (e.g., an accelerometer, a gyroscope, and/or a magnetometer).

According to various embodiments, the first position information may be information with relatively low accuracy, which is obtained by means of the wireless communication module (e.g., the wireless communication module192ofFIG.1) and/or the sensor module (e.g., the sensor module176ofFIG.1). For example, the first position information collected using the wireless communication module192and/or the sensor module (e.g., the sensor module176ofFIG.1) in an urban area where tall buildings or steel structures are concentrated may include latitude/longitude information and/or azimuth angle information, which have/has a difference in first error range with a real position or an azimuth angle of the electronic device101. The first error range may include, for example, a range of dozens of meters or a range of dozens of degrees, but not limited thereto.

In operation220, the processor120may store first feature point information based on the first position information. The first feature point information may be extracted from a three-dimensional virtual map (hereinafter, referred to as a 3D virtual map) rendered based on text information about terrain or feature. The first feature point information may include at least one one-dimensional hash vector.

According to an embodiment, the processor120may generate a 3D virtual map in the electronic device101and may extract at least one first feature point information from a region (hereinafter, referred to as a first virtual region) on the 3D virtual map corresponding to the first position information. The first virtual region may include a position and a surrounding region (within a 1 km radius or within a 1 km in a plurality of specified directions) corresponding to the first position information. For example, the processor120may extract a one-dimensional vector corresponding to a position per a specified direction (e.g., 5 degrees) and/or per a specified distance (e.g., 1 m) in the first virtual region as the first feature point information.

According to an embodiment, the processor120may transmit the first position information to a server108through a communication module190and may receive data for the first virtual region corresponding to the first position information on the generated 3D virtual map from the server108. The processor120may extract the first feature point information from the data for the first virtual region.

According to another embodiment, the processor120may transmit the first position information to the server108through the communication module190and may receive the first feature point information about the first virtual region.

According to an embodiment, the processor120may store at least temporarily store the extracted or received first feature point information in a memory (e.g., a memory130ofFIG.1).

Various embodiments about the generation of the 3D virtual map will be described below with reference toFIG.3.

In operation230, the processor120may obtain an image (e.g., a captured image or a real image) using a camera module (e.g., a camera module180ofFIG.1. According to an embodiment, the image may be a preview image of a camera application. According to another embodiment, the image may be an image which is captured by means of the camera module180and is stored in the electronic device101.

According to various embodiments, when obtaining the image by means of the camera module180, the processor120may obtain image capture setting information (e.g., an angle of view, and/or a zoom magnification setting) and/or environmental information (e.g., weather and/or time) together.

In operation240, the processor120may obtain second feature point information from the image. The second feature point information may include at least one one-dimensional hash vector. For example, the processor120may recognize an object (e.g., a building, a tree, a car, or a person) included in the image using a specified object recognition algorithm. The processor120may detect a border line of the recognized object and may convert the border line into data easy to extract a feature point. For example, the processor120may obtain the second feature point information from the converted data.

According to another embodiment, the processor120may store at least temporarily store the extracted second feature point information in the memory (e.g., the memory130ofFIG.1).

The extraction of the feature point according to various embodiments will be described below with reference toFIGS.4to8.

In operation250, the processor120may calculate second position information based on comparing the first feature point information extracted from the 3D virtual map with the second feature point information extracted from the image obtained by means of the camera module180. The second position information may have higher accuracy than the first position information. For example, in an urban area where tall buildings or steel structures are concentrated, the second position information may include latitude/longitude information and/or azimuth angle information, which are/is the same as a real position and/or an azimuth angle of the electronic device101or have/has a second error range less than the first error range. For example, the second error range may include, for example, a range less than dozens of meters or a range less than dozens of degrees, but not limited thereto.

According to various embodiments, the processor120or the server108may measure a similarity between a plurality of first images (e.g., virtual images) extracted from the first virtual region of the 3D virtual map and the second image (e.g., the captured image) obtained by means of the camera module180and may calculate the second position information. The plurality of first images may be extracted per a specified direction (e.g., 5 degrees) and/or per a specified distance (e.g., 1 m) in the first virtual region. In various embodiments of the disclosure, it is described that the first image is extracted for convenience of description, but it should be noted that it is able to only a feature vector of the first virtual region. For example, the processor120or the server108may extract only a feature vector without performing an operation of capturing and storing the image from the first virtual region.

For example, the processor120or the server108may extract each of a hash vector (or a feature vector) of the first image and a hash vector of the second image by means of an image hashing algorithm (refer toFIG.6). For example, the hash vector may be in the form of a one-dimensional bit array or a hex string. The processor120or the server108may determine the first image with a minimum hash hamming distance between the hash vector of the first image and the hash vector of the second image as being most similar to the second image. The hash hamming distance may be determined by comparing respective elements of the same position of each vector and counting the number of bits or characters having different values (e.g., 0, 1, or a character). The processor120or the server108may calculate a position and an azimuth angle corresponding to the determined first image as the second position information.

According to various embodiments, after calculating the second position information, the processor120may detect a change in state of the electronic device101. For example, the processor120may reduce a re-search radius of the first feature point information based on the second position information and the amount of change of sensing information collected by means of the sensor module, which is input in real time, to quickly correct a position and an azimuth angle.

According to various embodiments, at least some of the operations performed by the processor120inFIG.2may be performed by means of the server108.

FIG.3illustrates generation of a 3D virtual map according to an embodiment of the disclosure.

Referring toFIG.3, a processor120of an electronic device101or a server108may generate a 3D virtual map301. The 3D virtual map301may be a map rendered and generated based on text information, such as elevation data (e.g., the highest height above sea level) and/or artificial structure data, rather than an actually captured image.

According to various embodiments, the 3D virtual map301may fail to include information about a detailed shape or a color of a facility and/or a building. For example, all of buildings included in the 3D virtual map301may have the same type of figure (e.g., a rectangular parallelepiped), a shape similar to the shape of the earth, or a shape in which a shape of a facility and/or a building is simplified, which may be rendered to differ in size and/or height based on text information.

According to an embodiment, the elevation data may be text including height information about a specific point of the ground. The elevation data may be a numerical model applied to one coordinate system.

According to an embodiment, the artificial structure data may be text including information about a ground size or a height of a building or a facility. The artificial structure data may be managed by means of a separate server, and the processor120may request the server (e.g., the server108or an additional server (not shown)) to receive and store the artificial structure data. For example, the artificial structure data may include an infrastructure (e.g., a road, a park, and/or a railroad) and/or position information (e.g., an address) of a building, ground information (e.g., an area or a shape), or height information (e.g., the number of floors in the building).

According to an embodiment, the artificial structure data may include a three-dimensional model for a facility or a building. For example, the three-dimensional model may be in the form of a vector or in the form of having height information about each point. When there is a three-dimensional model for an artificial structure, the processor120or the server108may apply a coordinate system applied to elevation data to the three-dimensional model for the artificial structure to generate the 3D virtual map301.

According to various embodiments, the artificial structure data may fail to include a three-dimensional model for a facility or a building. In this case, the processor120or the server108may reflect height information of each building in a two-dimensional model (e.g., where a ground shape is displayed as a plane) for a facility or a building to generate a three-dimensional model for an artificial structure. The processor120or the server108may extrude the floor of a building by a height using height information of a two-dimensional model to generate a three-dimensional model for an artificial structure.

According to an embodiment, the artificial structure data may define a height of a facility or a building, the number of floors in the building, or an interfloor height of the building. The processor120or the server108may extrude the floor of the building from a virtual ground by a height of the corresponding building included in the artificial structure data or the number of floors*an interfloor height (e.g., a value of an average interfloor height) to generate a three-dimensional model.

According to an embodiment, the processor120or the server108may reflect an actual shape of the building to generate a three-dimensional model for an artificial structure. For example, the processor120or the server108may generate a shape (or exterior) of the building in the form of a quadrangle depending to a default setting. Alternatively, when there is separate data for the actual shape of the building (e.g., when shape data in which the top is unique, for example, the Chrysler Building, is included), the processor120or the server108may reflect the data in the shape of the building.

According to various embodiments, the processor120or the server108may additionally reflect (e.g., add) elevation data corresponding to each coordinates in the three-dimensional model generated based on the artificial structure data to generate the 3D virtual map301in which a natural object and an artificial structure are added.

According to various embodiments, data for generating the 3D virtual map may further include natural object data. For example, the natural object data may include information associated with a position of a river and/or a river width.

FIG.4illustrates recognition and classification of geographic features in an image obtained by means of a camera module according to an embodiment of the disclosure.

Referring toFIG.4, a processor120may obtain an original image (or a captured image)410. According to an embodiment, the original image410may be an image obtained through a preview screen of a camera module180. According to another embodiment, the original image410may be an image which is captured by means of the camera module180and is stored in an electronic device101.

According to various embodiments, the processor120may store the original image410together with position information of the electronic device101, which is obtained by means of a wireless communication module (e.g., a wireless communication module192ofFIG.1) and/or a sensor module (e.g., a sensor module176ofFIG.1) of the electronic device101. For example, the processor120may store latitude/longitude information and/or azimuth angle information of the electronic device101, which is calculated using a GPS sensor and an inertial sensor (an accelerometer, a gyroscope, and/or a magnetometer) at a time when the original image410is captured, together with the original image410in a memory (e.g., a memory130ofFIG.1).

According to various embodiments, the processor120may recognize an object from the original image (or the captured image)410and may classify the recognized object into specified items to generate a geographic feature image420. The items may be preset and stored for various objects other than an object included in the original image410. The geographic feature image420may be an image obtained by classifying the recognized object into specified items and dividing arrangement regions of the specified items. The processor120may classify each pixel in the original image410for each object (or classify whether each pixel is included any object) and may recognize an object (e.g., the sky, a building, a road, a pole).

According to an embodiment, the processor120may classify the object recognized from the original image410into specified items. The items may be preset and stored for various objects other than an object included in the original image410(e.g., the sky, a building, a road, a person, a car, and/or a pole). The specified item may be divided and specified into a plurality of groups.

According to an embodiment, the specified item may be classified into a first group and a second group. The first group may be a group obtained by classifying objects, which are large in size (are above a reference pixel range (e.g., 10%) in the image) and are fixed, into a specified item. For example, the first group may include an object which is fixed or is large in size, for example, the sky, a building, or a road, as a specified item. The second group may include an object, which is relatively smaller in size than the first group and is moved, as a specified item. For example, the second group may include an object, such as a pole, a pedestrian, a vehicle, or vegetation, as a specified item. Alternatively, the second group may further include an object in which it is impossible to identify the recognized object. For another example, the second group may include all objects which are not included in the first group among the recognized objects.

According to an embodiment, the processor120may perform first classification for dividing the recognized object into items of the first group. For example, the first image may include three specified times such as the sky, a structure (e.g., a building or a wall), and a road (e.g., a roadway or a sidewalk). The processor120may classify the object recognized from the original image410as the sky, the structure (e.g., the building or the wall), or the road (e.g., the roadway or the sidewalk) and may generate the geographic feature image420in which an arrangement region corresponding to each object is divided. The generated geographic feature image420may be an image obtained by dividing objects classified into the specified items into arrangement regions. For example, the geographic feature image420may include a sky arrangement region421including the sky classified based on the first group, a building arrangement region422including at least one building, or a road arrangement region423including at least one road.

According to an embodiment, the processor120may classify the recognized object using a pre-trained semantic segmentation deep learning model (a model example: HRnetV2 or DeepLabV3). Alternatively, the processor120may use another object recognition model or algorithm, but not limited thereto.

According to various embodiments, the processor120may perform second classification for dividing objects recognized from the original image410into items of the second group. For example, the second group may include four items such as a pole (e.g., a street light, traffic lights, or a sign), a person, a vehicle (e.g., a car or a motorcycle), vegetation, and an unknown object.

According to various embodiments, the processor120may divide objects classified based on the second group, which are included in the geographic feature image420, into an arrangement region. For example, the geographic feature image420may include the other arrangement region424corresponding to at least one object classified based on the second group.

According to various embodiments, although not illustrated, the processor120may change (or replace) an object which belongs to the second group to an object which belongs to the first group depending on a specified condition. For example, the processor120may change a pole or traffic lights between buildings to a building.

Alternatively, the processor120may include an object which belongs to the second group in an arrangement region corresponding to an object which belongs to the first group in the geographic feature image420. For example, the processor120may include an object recognized as a pole or traffic lights included between buildings in the building arrangement region422and may include an object recognized as a tree in the sky arrangement region421. Various embodiments about the classification and change of the object will be described below with reference toFIG.5.

According to an embodiment, the processor120may correct a border between the sky and another object by means of additional image processing (e.g., an edge detection algorithm) As a result, the processor120may reduce a probability of incorrectly recognizing a portion of the sky as a portion of a building or a road or incorrectly recognizing a portion of the building or the road as the sky depending on a weather state (e.g., movement of a cloud or the sun) of the sky or arrangement of artificial objects (e.g., arrangement of wires). After performing the additional image processing, the processor120may determine the sky arrangement region421corresponding to the sky on the geographic feature image420.

According to an embodiment, the processor120may detect a border of an arrangement region of an object (hereinafter, referred to as a sky border line421a), which is different from the sky arrangement region421, by means of the edge detection algorithm.

For example, the processor120may detect an edge image (e.g., an edge image720ofFIG.7) of the original image410. The processor120may detect a height of a border point where a value greater than a specified first threshold is indicated for the first time while moving from an upper end (h=0) to a lower end (h=H) for each column C1, C2. . . or CNof the edge image. The column may refer to a column of pixels divided into a specified number of pixels (e.g., 1 or 2).

According to various embodiments, the first threshold may vary with a characteristic of the original image410. The first threshold value may be differently set, when two regions (the sky/an object except for the sky) have very similar colors (or contrast) or have very different colors (or contrast). For example, the first threshold value may be determined as a value with a maximum difference between pixel values with respect to a border line calculated when applying all of values between from10to300.

The processor120may detect a sequence of heights of border points detected for each column and may determine the sky border line421ausing the sequence. To perform fine tune, the processor120may filter an interval where a change in the sky border line421ais greater than or equal to a specified second threshold to adjust the sky border line421a.

According to various embodiments, the second threshold may vary with a height of the original image410. For example, when the height of the original image410is 300 pixels, the second threshold may be 30 pixels.

According to various embodiments, the processor120may set a pixel located above the sky border line421ato a first value (e.g., 1) and may set a pixel located below the sky border line421ato a second value (e.g., 0) to generate a sky mask.

FIG.5illustrates reclassification of geographic features according to an embodiment of the disclosure.

Referring toFIG.5, a processor120may extract a similar color region515with respect to a specific pixel511of an original image (or a captured image)510. The specific pixel511may be selected based on one of pixels occupying the most color in the original image510or one of pixels included in the most characteristic object. For example, the specific pixel511may be one pixel, which is a pixel located in the center.

The similar color region515may be a region where a change in RGB color is less than or equal to a specified value and where the change in color, which is less than or equal to the specified value, is maintained in at least one of specified directions (e.g., eight directions of 0 degree, 45 degrees, 90 degrees, 135 degrees, 180 degrees, 225 degrees, 270 degrees, and 315 degrees) with respect to a pixel adjacent to (or touching with) a corresponding pixel.

According to various embodiments, the processor120may divide the original image (or the captured image)510into a plurality of tiles (e.g., N*M square tiles) and may extract the similar color region515with respect to a center point (or any position) of each tile.

According to various embodiments, when pixels in the similar color region515include an object included in a first group and an object included in the second group, the processor120may replace a pixel corresponding to the object included in the second group in the similar color region515with the object included in the first group.

For example, when the number of pixels corresponding to the object included in the first group among pixels in the similar color region515is greater than or equal to a specified number (e.g., 4), the processor120may replace a pixel corresponding to the object included in the second group in the similar color region515with the object included in the first group (more than half).

For another example, when pixels in the similar color region515are less than or equal to a specified number (e.g., 4) and when there is an object in the first group in the similar color region515, the processor120may replace a pixel corresponding to the object included in the second group in the similar color region515with the object included in the first group (an edge portion).

For example, a first geographic feature image560may include poles of the second group in a road arrangement region561of the first group. When the road arrangement region561of the first group and the pole arrangement region562of the second group are determined as a similar color region, the processor120may generate a second geographic feature image570by replacing the pole arrangement region562with the road arrangement region561.

According to various embodiments, the processor120may extract each object contour from the object of the second group. The processor120may replace a pixel, classified as a geographic feature, in which a horizontal (or vertical) length of the extracted contour is less than or equal to a specified ratio (e.g., 1/5) of a width (or height) of the original image510and in which left and right (or upper and lower) pixels outside the contour are the same as each other, with a geographic feature by first classification.

FIG.6illustrates vector generation using a geographic feature image according to an embodiment of the disclosure.

Referring toFIG.6, a processor120may generate a geographic feature image620based on an original image (e.g., an original image410ofFIG.4or an original image510ofFIG.5). The geographic feature image620may be generated by performing first classification and second classification of an object included in the original image.

According to various embodiments, the processor120may convert the geographic feature image620into a one-dimensional vector (hereinafter, referred to as a hash feature vector) for matching a feature point.

According to an embodiment, the processor120may resize the geographic feature image620(e.g., 64*20) to generate a reduced geographic feature image630. InFIG.6, a 50% reduction ratio is illustratively shown, but not limited thereto. For example, the reduction ratio may be 30%, 15%, or 5%.

According to an embodiment, the processor120may divide the reduced geographic feature image630depending on an arrangement region. For example, the processor120may divide the reduced geographic feature image630for each classified arrangement region to a first division image641corresponding to a sky arrangement region, a second division image642corresponding to a building arrangement region, and a third division image643corresponding to a road arrangement region. Each of the first to third division images641,642, and643may have the same size as the reduced geographic feature image630.

According to an embodiment, the processor120may arrange the first to third division images641,642, and643in a specified direction (e.g., a horizontal direction) to generate one combination image650. For example, when the first to third division images have a size of 10 horizontal pixels and 32 vertical pixels, they may be arranged in a horizontal direction to generate the combination image650having a size of 32 vertical pixels and 30 horizontal pixels. The processor120may generate a binary image655for the combination image650. The binary image655may be an image composed of two colors (e.g., a black color and a white color). The binary image655may be an image, a pixel having a color value greater than 0 of which is written with a first value (e.g., 1) and the other color values of which are displayed with a second value (e.g., 0).

According to an embodiment, the processor120may generate a hex code in units of eight pixels (bits) of the binary image655to generate a hash feature vector680.

FIG.7illustrates detection of a border line of an object according to an embodiment of the disclosure.

Referring toFIG.7, a processor120may detect a border line from an original image710captured by means of a camera module180to generate an edge image720. The original image710may include various objects (e.g., a building, a road, the sky, a person, or a tree). For example, the original image710may include the sky711, a building712, a road713, or a person714.

According to an embodiment, the processor120may extract an object, for example, a border line of the building712, from the original image710, by means of an edge detection technology in an image processing scheme. For example, the processor120may detect pixels where a brightness of the image rapidly changes to a specified threshold or more. The processor120may detect at least one of a change in material property and/or a change in scene illumination to detect an edge.

According to an embodiment, the processor120may generate (or extract) the edge image720based on the original image710, by means of edge detection. The edge image720may mainly display a border line between the sky711and the building712. The processor120may perform image processing of the original image710of an RGB pixel using an edge detection technique to extract a sky border line711aand/or a building contour712a.

FIG.8illustrates verification for detection of geographic features according to an embodiment of the disclosure.

Referring toFIG.8, a processor120may extract a feature point using a geographic feature image to enhance accuracy of first position information calculated by means of a GPS or a wireless network to verify whether it is able to calculate second position information. When it is verified, the geographic feature image may be compared with an image of a 3D virtual map.

For example, the processor120may verify whether the generated first geographic feature image810includes a feature point of a level capable of calculating position information (e.g., second position information) of an electronic device101. When a specified verification condition is not met, the processor120may capture a new image to generate a geographic feature image again.

According to various embodiments, the processor120may identify whether the first geographic feature image810includes objects of a first group, which are greater than or equal to a specified number. For example, when the first geographic feature image810includes two or more objects of the first group, the processor120may perform feature point comparison.

According to an embodiment, the processor120may identify whether a pixel ratio (hereinafter, referred to as a blockage ratio) occupied by an object of a second group in a second geographic feature image820is less than or equal to a specified reference value. For example, the number of pixels in the second geographic feature image820is H*W and when the number of pixels of the second group is NB, the blockage ratio may be defined as NB/(H*W). When the blockage ratio is less than or equal to the specified reference value, feature point matching may be performed.

According to an embodiment, the processor120may identify a ratio of pixels (hereinafter, referred to as a geographic feature border line securing rate) which are not hidden by an object (e.g., a pole, a person, or a car) of the second group between border lines (hereinafter, geographic feature border lines) between objects (e.g., the sky, a building, and a road) included in the first group in the second geographic feature image820.

According to an embodiment, in the first geographic feature image810, the processor120may calculate a distance L in a horizontal direction from a first column851where a border of the first group (a board between a first object811and a second object812) appears for the first time to a second column852where the border of the first group last appears. Furthermore, the processor120may calculate the number Nx of columns including a border between the second object812and a third object813, between the first column851and the second column852. In the first geographic feature image810, the geographic feature border line ensuring rate (L/Nx) may be greater than or equal to (or greater than) a specified reference value (e.g., 0.5) and feature point matching may be performed.

In the second geographic feature image820, the processor120may calculate a distance L in a horizontal direction from a first column861where the border of the first group (the border between the first object821and the second object822) appears for the first time to a second column862where the border of the first group last appears. Furthermore, the processor120may calculate the number Nx of columns including a border between the second object822and the third object823, between the first column861and the second column862. In the second geographic feature image820, the geographic feature border line ensuring rate (L/Nx) may be less than (or less than or equal to) the specified reference value (e.g., 0.5) and feature point matching may fail to be performed.

FIG.9illustrates storage of first images of various angles of view according to an embodiment of the disclosure.

Referring toFIG.9, a processor120or a server108may store a feature point database for first images corresponding various points (e.g., virtual points) of a 3D virtual map, various angles (e.g., virtual angles), or various angles of view (virtual angles of view). For example, the processor120or the server108may store feature point information of each of a first view angle image911and a second view angle image912, which have the same position information.

The processor120or the server108may use setting information (e.g., zoom magnification and/or view angle information) of a camera module180for feature point comparison, in the feature point database.

For example, when a first original image921having a first angle of view is captured, the processor120or the server108may use a feature vector of the first view angle image911corresponding to the first angle of view between the first view angle image911and the second view angle image912, which have the same position information, and may fail to use a feature vector of the second view angle image912.

For another example, when a second original image922having a second angle of view is captured, the processor120or the server108may use the feature vector of the second view angle image912corresponding to the second angle of view between the first view angle image911and the second view angle image912, which have the same position information, and may fail to use the feature vector of the first view angle image911. As a result, accuracy and a speed of feature point comparison may be enhanced.

FIG.10illustrates matching between a virtual first image and an actually captured second image according to an embodiment of the disclosure.

Referring toFIG.10, a processor120of an electronic device101or a server108may generate a 3D virtual map1001. The 3D virtual map1001may be a map rendered and generated based on text information, such as elevation data (e.g., the highest height above sea level) and/or artificial structure data, rather than an actually captured image.

According to various embodiments, the processor120or the server108may extract at least one a plurality of first images1011and1012based on first position information of the electronic device101(e.g., a latitude/longitude and/or an azimuth angle measured by means of a wireless communication module192and/or a sensor module (e.g., a sensor module176ofFIG.1)). The processor120or the server108may compare feature points of the plurality of first images1011and1012with feature points of second images1051and1052captured by means of a camera module180.

For example, the processor120or the server108may extract the plurality of first images1011corresponding to a first position1010. The processor120or the server108may determine a first image1011ain which a hash hamming distance from a geographic feature image based on the second image1051is minimized among the plurality of first images1011and may calculate a position and an azimuth at the first position1010as second position information which is more accurate than the first position information (e.g., the latitude/longitude and/or the azimuth angle measured by means of the wireless communication module192and/or the sensor module (e.g., the sensor module176ofFIG.1)) based on second position information corresponding to the determined first image1011a.

For another example, the processor120or the server108may extract the plurality of first images1012corresponding to the second position1020. The processor120or the server108may determine a first image1012ain which a hash hamming distance from a geographic feature image based on the second image1052is minimized among the plurality of first images1012and may calculate a position and an azimuth at a second position1020of the electronic device101as second position information which is more accurate than the first position information (e.g., the latitude/longitude and/or the azimuth angle measured by means of the wireless communication module192and/or the sensor module (e.g., the sensor module176ofFIG.1)) based on second position information corresponding to the determined first image1012a.

An electronic device (e.g., an electronic device101ofFIG.1) according to various embodiments may include a camera module (e.g., a camera module180ofFIG.1) configured to collect image data, a communication circuit configured to perform communication with an external device, a memory (e.g., a memory130ofFIG.1), and a processor (e.g., a processor120ofFIG.1). The processor (e.g., the processor120ofFIG.1) may obtain first position information about the electronic device (e.g., the electronic device101ofFIG.1), may store first feature point information based on the first position information, may obtain an image by means of a camera module (e.g., a camera module180ofFIG.1), may recognize an object from the image, may extract second feature point information about the recognized object, and may calculate second position information of higher accuracy than the first position information based on comparing the first feature point information with the second feature point information.

According to various embodiments, the electronic device (e.g., the electronic device101ofFIG.1) may further include a sensor module. The first position information may be obtained by means of the sensor module.

According to various embodiments, the first position information may include latitude, longitude, and azimuth angle information of the electronic device (e.g., the electronic device101ofFIG.1).

According to various embodiments, the first feature point information may be extracted from a three-dimensional virtual map rendered based on text information about terrain or feature.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may transmit the first position information to an external server (e.g., a server108ofFIG.1) and may receive the first feature point information corresponding to the first position information from the external server (e.g., the server108ofFIG.1).

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may transmit the first position information to the external server (e.g., the server108ofFIG.1), may receive map data of a portion corresponding to the first position information in a three-dimensional virtual map rendered based on text information about terrain or feature from the external server (e.g., the server108ofFIG.1), and may extract the first feature point information from the map data.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may classify the recognized object into items of a first group.

According to various embodiments, the first group may include the sky, a building, or a road.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may classify an object which is not classified into the first group among the recognized objects into items of a second group.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may reclassify the object classified into the second group into an item of the first group depending on a specified condition.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may extract the second feature point information, when the object classified into the first group is greater than or equal to a specified number.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may extract the second feature point information, when the ratio of the number of pixels of the object classified into the second group to all pixels of the second image is less than or equal to a specified number.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may extract the second feature point information, when a ratio which is not blocked by an object of the second group among border lines among objects of the first group is greater than equal to a specified value.

According to various embodiments, the first position information may have a first error range, and the second position information may have a second error range less than the first error range.

An electronic device (e.g., an electronic device101ofFIG.1) according to various embodiments may include a camera module (e.g., a camera module180ofFIG.1) configured to collect image data, a communication circuit configured to perform communication with an external device, a memory (e.g., a memory130ofFIG.1), and a processor (e.g., a processor120ofFIG.1). The processor (e.g., the processor120ofFIG.1) may obtain first position information about the electronic device (e.g., the electronic device101ofFIG.1), may extract first feature point information from a region corresponding to the first position information in a three-dimensional virtual map rendered based on text information about terrain or feature, may obtain an image by means of a camera module (e.g., a camera module180ofFIG.1), may recognize an object from the image, may extract second feature point information about the recognized object, and may calculate second position information of higher accuracy than the first position information based on comparing the first feature point information with the second feature point information.

According to various embodiments, the processor (e.g., the processor120ofFIG.1) may extract the first feature point information based on setting information associated with capturing the image by means of the camera module (e.g., the camera module180ofFIG.1).

A method for obtaining position information using an image according to various embodiments may be performed in an electronic device (e.g., an electronic device101ofFIG.1), which may include obtaining first position information about the electronic device (e.g., the electronic device101ofFIG.1), storing first feature point information in a memory (e.g., a memory130ofFIG.1) of the electronic device (e.g., the electronic device101ofFIG.1) based on the first position information, obtaining an image by means of the camera, recognizing an object from the image, extracting second feature point information about the recognized object, and calculating second position information of higher accuracy than the first position information based on comparing the first feature point information with the second feature point information.

According to various embodiments, the obtaining of the first position information may include obtaining the first position information by means of a sensor module of the electronic device (e.g., the electronic device101ofFIG.1).

According to various embodiments, the storing of the first feature point information may include extracting the first feature point information from a three-dimensional virtual map rendered based on text information about terrain or feature.

According to various embodiments, the storing of the first feature point information may include transmitting the first position information to an external server (e.g., a server108ofFIG.1) and receiving the first feature point information corresponding to the first position information from the external server (e.g., the server108ofFIG.1).