A positioning method, electronic equipment and medium

By determining the color of the target area in the underground parking lot image in an electronic device and performing database matching, the problem of low visual positioning accuracy in the underground parking lot is solved and higher positioning accuracy is achieved.

CN117115481BActive Publication Date: 2024-09-27HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310444615.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2024-09-27
Estimated Expiration
2043-04-14

AI Technical Summary

Technical Problem

In scenes with a large number of repeated textures, such as underground parking lots, the accuracy of the visual positioning system is low, resulting in positioning errors during AR navigation.

Method used

Obtain the image to be positioned through electronic equipment, determine the color of the target area in the image, and match it with the corresponding image in the database to reduce the scope of image matching and improve positioning accuracy by combining color information.

Benefits of technology

The accuracy of visual positioning is improved, false matching results caused by similar image textures are reduced, and the accuracy of positioning is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117115481B
    Figure CN117115481B
Patent Text Reader

Abstract

The present application discloses a positioning method, electronic device and medium, and relates to the field of computer technology. The method can be applied to electronic devices, and the method comprises: obtaining an image to be positioned; determining the color of a target area in the image to be positioned, wherein the target area is a plane area in the image to be positioned; matching the image to be positioned with an image in a database corresponding to the color of the target area to obtain a matching result; and determining the position corresponding to the image to be positioned according to the matching result. The method can improve the accuracy of visual positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a positioning method, electronic equipment and medium. Background Art

[0002] With the development of computer technology, especially the rapid development of visual algorithms, augmented reality (AR) technology has also been widely used in various fields, such as indoor positioning. Among them, the visual positioning system is an important part of AR technology, especially the rise of indoor AR navigation, which solves the problem of users finding their destination in complex or unfamiliar indoor environments. For example, finding a store in a shopping mall or a car in an underground parking lot.

[0003] Visual positioning is required during AR navigation, but in scenes with a large number of repeated textures (for example, underground parking lots), the visual positioning accuracy is low. Summary of the invention

[0004] The present application provides a positioning method, electronic equipment and medium, which can improve the accuracy of visual positioning.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, the present application provides a positioning method, which can be performed by an electronic device or by the electronic device and a server in collaboration. The present application takes the execution of the electronic device as an example. Specifically, the method includes:

[0007] The electronic device obtains the image to be located, and then determines the color of the target area in the image to be located. The target area is a plane area in the image to be located, for example, it can be a wall area, it can be a ground area, or it can be a wall area and a ground area. In different cases, the target area is different. Then, the electronic device can match the image to be located with the image in the database corresponding to the color of the target area to obtain a matching result. The image in the database corresponding to the color of the target area includes position information. According to the matching result, the position corresponding to the image to be located is determined.

[0008] In this method, during the visual positioning process of the electronic device, the color corresponding to the wall in the image to be positioned is first used to determine the corresponding database, thereby reducing the number of images to be compared in the image matching process, that is, a preliminary screening is performed first, and then the corresponding database after the preliminary screening is used for matching. In this way, the color information of the image is combined to improve the accuracy of positioning. Compared with the traditional solution, this solution introduces the color information of the image, so that it can avoid the result of different colors but the same spatial structure or layout after image matching, thereby improving the accuracy of positioning.

[0009] In some possible implementations, the electronic device may obtain the hue values, saturation values, and color-brightness values ​​corresponding to multiple pixel points of the target area of ​​the image to be located, and then determine the colors corresponding to the multiple pixel points based on the hue values, saturation values, and color-brightness values ​​corresponding to the multiple pixel points, and then determine the color of the target area based on the colors corresponding to the multiple pixel points.

[0010] In some possible implementations, the electronic device may determine the pixel values ​​corresponding to the multiple pixel points based on a first mapping relationship between a preset pixel value and a hue value, a saturation value, and a color brightness value; and then determine the colors corresponding to the multiple pixel points based on the pixel values ​​corresponding to the multiple pixel points and a second mapping relationship between a preset color and the pixel value.

[0011] In some possible implementations, the electronic device may use the color corresponding to the pixel points with the largest number or the largest proportion as the color of the target area.

[0012] In some possible implementations, the electronic device matches the image to be located with the image in the database corresponding to the color of the target area to obtain a matching result, which may be: the electronic device determines the top M images in similarity sorting based on the similarity between the image to be located and the image in the database corresponding to the color of the target area, where M is a positive integer.

[0013] In some possible implementations, the electronic device may also determine the parking lot partition corresponding to the color of the target area based on the color of the target area and a third mapping relationship between color and parking lot partition; and then determine the top M images in similarity ranking based on the similarity between the image to be located and the image in the database corresponding to the parking lot partition.

[0014] In some possible implementations, the image to be located further includes a parking space area;

[0015] When a vehicle is parked in the parking space area, the target area is a wall area; or,

[0016] When there is no vehicle parked in the parking space area, the target area is a wall area and / or a ground area.

[0017] In some possible implementations, the target area is a wall area and the ground area, and the color of the wall area is the same as the color of the ground area.

[0018] In a second aspect, an embodiment of the present application provides an electronic device, comprising: a camera, a processor and a memory; the camera captures images; wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the electronic device executes a method as described in any one of the first aspects.

[0019] In a third aspect, the present application provides a computer storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes any method as described in the first aspect.

[0020] In a fourth aspect, the present application provides a computer program product, comprising instructions; when the instructions are executed by an electronic device, the electronic device executes any one of the methods in the first aspect above.

[0021] The technical solution of this application has the following beneficial effects:

[0022] The present application provides a positioning method, which can be applied to electronic devices. After the electronic device obtains the image to be positioned, it first performs plane detection on the image to determine the target area in the image, and then determines the color of the target area, performs image matching from the database corresponding to the color of the target area, obtains the matching result, and performs positioning based on the matching result. In this method, the electronic device distinguishes the database by color information. Compared with the traditional solution of performing image matching in the entire database, performing image matching in the database corresponding to the color of the target area can narrow the scope of image matching, which not only improves the matching efficiency, but also reduces the erroneous matching results due to different partitions due to similar image textures, thereby improving the matching accuracy. It can be seen that the scheme of the present application introduces color information, which can avoid obtaining results with different colors but the same spatial structure or layout after image matching, thereby improving the accuracy of positioning.

[0023] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in the present embodiment can also be combined in any appropriate manner. Those skilled in the art will understand that the embodiment can be realized without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in a specific embodiment that does not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 An exemplary diagram of the composition of an electronic device provided in an embodiment of the present application;

[0025] Figure 2 A software structure block diagram of an electronic device provided in an embodiment of the present application;

[0026] Figure 3 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0027] Figure 4 A flowchart of a positioning method provided in an embodiment of the present application;

[0028] Figure 5 A schematic diagram of an image acquisition interface provided in an embodiment of the present application;

[0029] Figure 6 A schematic diagram of a shooting interface provided in an embodiment of the present application;

[0030] Figure 7 A schematic diagram of a gallery interface provided in an embodiment of the present application;

[0031] Figure 8 A schematic diagram of a target area provided in an embodiment of the present application;

[0032] Fig. 9 A schematic diagram of another target area provided in an embodiment of the present application;

[0033] Fig.10 A schematic diagram of the zoning of a parking lot provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The terms "first", "second", "third", etc. in the specification, claims and drawings of this application are used to distinguish different objects rather than to limit a specific order.

[0035] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0036] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given:

[0037] AR, or augmented reality, is a technology that brings computer technology into real life. AR is the fusion of virtual images and real images, and has the characteristics of virtual reality fusion, real-time interaction, and three-dimensional registration. Among them, three-dimensional registration is also called three-dimensional registration, which emphasizes the correspondence between the virtual images generated by the computer and the real environment.

[0038] In order to ensure a better integration of the real environment and virtual effects, visual positioning system (VPS) technology plays an important role. However, in scenes with a large number of repeated textures, the VPS technology will fail and cannot accurately locate. For example, in an underground parking lot, different parking areas only differ in wall color, and are difficult to distinguish in spatial structure or layout.

[0039] Using the current technical solution, positioning errors may occur in some scenarios. For example, in a scenario where a parking lot is partitioned by the color of the walls near the parking spaces, the wall color in the image to be positioned is red. Through traditional methods, multiple images with similar spatial structures or layouts to the image to be positioned may be found in the database, such as images with blue walls and images with red walls. Since the prior art does not consider the impact of color information on positioning, the position corresponding to the image with blue wall color may be used as the position of the image to be positioned, resulting in positioning errors. It can be seen that the accuracy of visual positioning in traditional solutions is low.

[0040] In view of this, the present application provides a positioning method, which can be applied to electronic devices. The electronic device can obtain an image to be positioned, and then determine the target area in the image. For example, the target area can be a wall area, and then determine the color corresponding to the wall area. Then, the image to be positioned is matched with the image in the database corresponding to the color corresponding to the wall area, and based on the matching result, the position corresponding to the image to be positioned is determined.

[0041] It can be seen that in this method, during the visual positioning process of the electronic device, the color corresponding to the wall in the image to be positioned is first used to determine the corresponding database, thereby reducing the number of images to be compared in the image matching process, that is, a preliminary screening is performed first, and then the corresponding database after the preliminary screening is used for matching. In this way, the color information of the image is combined to improve the accuracy of positioning. Compared with the traditional solution, this solution introduces the color information of the image, so that it can avoid obtaining results with different colors but the same spatial structure or layout after image matching, thereby improving the accuracy of positioning.

[0042] In some embodiments, the electronic device may be a mobile phone, a tablet computer, a desktop, a laptop, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a personal digital assistant (PDA), a wearable electronic device, a smart watch, etc. The present application does not impose any special restrictions on the specific form of the above electronic devices. In this embodiment, the structure of the electronic device may be as follows: Figure 1 As shown, Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0043] like Figure 1 As shown, the electronic device may include a processor 110, an internal memory 121, a sensor module 180, a camera 193, a display screen 194, etc. The sensor module 180 may include a gyroscope sensor 180B, an acceleration sensor 180E, a distance sensor 180F, a touch sensor 180K, etc.

[0044] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0045] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, in the present application, the processor can obtain an image to be located; determine the color of a target area in the image to be located, the target area being a plane area in the image to be located; match the image to be located with an image in a database corresponding to the color of the target area to obtain a matching result, the image in the database corresponding to the color of the target area includes location information; according to the matching result, determine the position corresponding to the image to be located. This method can improve the accuracy of visual positioning.

[0046] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0047] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0048] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0049] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0050] The electronic device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0051] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0052] A series of graphical user interfaces (GUIs) can be displayed on the display screen 194 of the electronic device, and these GUIs are the main screen of the electronic device. Generally speaking, the size of the display screen 194 of the electronic device is fixed, and only limited controls can be displayed on the display screen 194 of the electronic device. A control is a GUI element, which is a software component included in an application program, and controls all data processed by the application program and the interactive operations on these data. Users can interact with the control through direct manipulation to read or edit the relevant information of the application program. Generally speaking, a control can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. .

[0053] The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0054] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0055] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0056] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. For example, in this embodiment, the processor 110 can execute the instructions stored in the internal memory 121 to enable the electronic device to perform the following steps: obtain the image to be located; determine the color of the target area in the image to be located, where the target area is a plane area in the image to be located; match the image to be located with the image in the database corresponding to the color of the target area to obtain a matching result, where the image in the database corresponding to the color of the target area includes location information; determine the position corresponding to the image to be located according to the matching result.

[0057] The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0058] The gyro sensor 180B can be used to determine the motion posture of the electronic device. In some embodiments, the angular velocity of the electronic device around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0059] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in all directions (generally three axes). When the electronic device is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0060] The distance sensor 180F is used to measure the distance. The electronic device can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0061] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device, which is different from the position of the display screen 194.

[0062] In addition, an operating system is running on the above components, such as the iOS operating system developed by Apple, the Android open source operating system developed by Google, and the Windows operating system developed by Microsoft. Application programs can be installed and run on the operating system.

[0063] The operating system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.

[0064] like Figure 2 As shown, this figure is a software structure block diagram of an electronic device provided in an embodiment of the present application.

[0065] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

[0066] The application layer can include a series of application packages. The application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

[0067] The framework layer provides application programming interface (API) and programming framework for the application layer. The framework layer includes some predefined functions. The framework layer can include window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0068] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0069] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0070] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0071] The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including answering, hanging up, etc.).

[0072] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0073] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0074] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0075] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0076] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0077] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0078] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0079] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0080] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0081] A 2D graphics engine is a drawing engine for 2D drawings.

[0082] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0083] It should be noted that although the embodiments of the present application are described using the Android system as an example, its basic principles are also applicable to electronic devices based on operating systems such as iOS and Windows.

[0084] In order to make the technical solution of the present application clearer and easier to understand, the application scenario of the positioning method provided in the embodiment of the present application is first introduced below.

[0085] like Figure 3 As shown, the figure is a schematic diagram of an application scenario provided by an embodiment of the present application.

[0086] In this scenario, a user 301 can use an electronic device 302 to take photos in an indoor parking lot, thereby obtaining an image 303 to be positioned, where the image 303 to be positioned includes a wall area 3031 and a parking space area 3032 .

[0087] In some examples, the parking lot can be partitioned by the color of the wall, and the electronic device can perform plane detection on the image to be located 303, thereby obtaining the plane part in the image to be located 303, that is, the wall area 3031. Then, the electronic device can determine the color corresponding to the wall area 3031, so as to perform image matching in the database corresponding to the color of the wall area 3031, and finally, based on the matching result, determine the position corresponding to the image to be located 303, thereby achieving positioning. Then, the electronic device can show the user the position corresponding to the image to be located 303 taken by it, for example, it can be the position when the electronic device takes the image, or it can be the position where the user takes the image through the electronic device. Among them, the databases corresponding to different partitions can be pre-built, for example, when the wall color is divided into red zone, green zone and yellow zone, the red zone database, the green zone database and the yellow zone database can be pre-built.

[0088] In one scenario, after the user parks the vehicle in a parking space, the image to be located may be an image of the parking space taken by the user. When the user enters the parking lot again, the location of the user's vehicle can be determined based on the previously taken image to be located. In another scenario, the user may also be lost in the parking lot. The image to be located may be an image of the parking lot taken by the user. The electronic device can determine its own location based on the image to be located taken by the user, thereby realizing route planning to the destination.

[0089] It should be noted that in the embodiment of the present application, partitioning the parking lot by the color of the wall is merely an exemplary introduction, and the parking lot can also be partitioned by the color of the parking spaces and the color of the walls (in this method, the color of the parking spaces is the same as the color of the walls).

[0090] In the above-mentioned scenarios, the spatial structure and layout of indoor parking lots are relatively similar. Relying solely on the spatial structure and layout displayed by the image will lead to inaccurate positioning. In the solution of the present application, color information is introduced. The database is first screened through the color information of the image to be located to determine the database corresponding to the color, and then image matching is performed from the database. This can improve the accuracy of image matching and thus improve the accuracy of positioning.

[0091] The positioning method provided by the embodiment of the present application is introduced below in conjunction with the accompanying drawings. Figure 4 As shown, the figure is a flow chart of a positioning method provided in an embodiment of the present application, the method comprising:

[0092] S401: The electronic device obtains an image to be located.

[0093] The image to be located may be an image used to represent the current location of the user. The image to be located is compared with images with marked locations in a database to determine the location corresponding to the image to be located, that is, the location of the user or the electronic device.

[0094] The electronic device can obtain the image to be located in a variety of ways, such as Figure 5 As shown, this figure is a schematic diagram of an image acquisition interface provided by an embodiment of the present application. The image acquisition interface includes a shooting control 501 and a gallery control 502. Among them, the shooting control 501 refers to obtaining the image to be located by real-time shooting, and the gallery control 502 refers to obtaining the image to be located by uploading it locally from the electronic device.

[0095] In some embodiments, the user may click on the shooting control 501, and the electronic device may present a shooting interface in response to the user's click operation on the shooting control 501. Figure 6 As shown, this figure is a schematic diagram of a shooting interface provided by an embodiment of the present application. The shooting interface includes a shutter control 601 and a preview screen 602. The user can click the shutter control 601, and the electronic device can respond to the click operation of the shutter control 601 to perform framing (or imaging), thereby obtaining an image to be located. Among them, the preview screen 602 is used to preview the image captured by the camera of the electronic device.

[0096] In other examples, the user may click on the gallery control 502, and the electronic device may present the gallery interface in response to the user's click operation on the gallery control 502. Figure 7 As shown, this figure is a schematic diagram of a gallery interface provided in an embodiment of the present application. The gallery interface includes a submission control 701 and multiple candidate images 702. The user can select any image from the multiple candidate images 702 and then click the submission control 701. The electronic device can respond to the user's click operation on the submission control 701, obtain the candidate image selected by the user, and then obtain the image to be located.

[0097] S402: The electronic device performs plane detection on the image to be positioned to obtain a plane detection result.

[0098] The plane detection result is used to indicate which areas of the image are planes. In some examples, after the electronic device determines the image to be located, it can perform plane detection on the image to be located using a preset algorithm to obtain the plane detection result. In other examples, the electronic device can also send the image to be located to a cloud server, and the cloud server performs plane detection on the image to be located using a preset algorithm to obtain a plane detection result, and then the cloud server sends the plane detection result to the electronic device, and the electronic device obtains the plane detection result.

[0099] It should be noted that plane detection can be performed locally on electronic devices without a network, making electronic devices more adaptable to environments with poor signals such as indoor parking lots; plane detection is performed on cloud servers, which have higher computing power than electronic devices, and can improve detection efficiency. The detection methods described in the above examples are only illustrative, and those skilled in the art can select appropriate detection methods based on actual needs.

[0100] Among them, the preset algorithm can be a PlaneRCNN (3D Plane Detection and Reconstruction from a Single Image) algorithm. The PlaneRCNN algorithm includes three parts. The first part is a plane detection network based on Mask R-CNN (an instance segmentation algorithm), the second part is a segmentation refinement network, and the third part is a warping loss module. The embodiment of the present application can perform plane detection on the image to be positioned through the plane detection network of the first part, and then obtain a plane detection result.

[0101] In some embodiments, after determining the image to be located, the electronic device can extract feature points in the separated image (for example, points in the image with large changes in brightness, intensity, and color, and the feature points are usually located at the corners), and use VIO and IMU to calculate and track the three-dimensional spatial information of these feature points. During the tracking process, the feature point information is processed, and feature points with similar positions in space or that conform to certain rules are constructed into a plane. If the construction is successful, the plane is detected. The plane detection results may include the plane position, direction, and boundary information, etc. Among them, IMU (Inertial Measurement Unit) is an inertial measurement unit, and VIO (Viausl Inertial Odometry) is a technology that integrates vision and IME to achieve mileage calculation.

[0102] It should be noted that the above is only an exemplary description of the plane detection method, and those skilled in the art can select a suitable method to perform plane detection on the image to be positioned based on actual needs, and then obtain the plane detection result.

[0103] S403: The electronic device determines the color of the target area of ​​the image to be located according to the plane detection result.

[0104] The target area may be a plane area such as a wall area, a ground area, etc. The target area may be pre-set, for example, the target area may be pre-set as a wall area, the target area may be pre-set as a ground area, or the target area may be pre-set as a wall area and a ground area. The ground area may refer to the area of ​​a parking space.

[0105] The following describes how to determine the target area based on different situations.

[0106] The first type: there is a vehicle parked in the parking space in the image to be positioned.

[0107] In some embodiments, the electronic device may detect the image to be located by a target detection algorithm to determine whether a vehicle is parked in the parking space area in the image to be located. If a vehicle is parked in the parking space area in the image to be located, the target area is a wall area.

[0108] In some examples, the electronic device can detect the wall area in the image to be located through a wall detection model, and the electronic device can also perform depth detection on the image to be located through the above-mentioned preset algorithm (PlaneRCNN), and determine the wall area in the image to be located according to the depth detection result. Among them, the electronic device can also transmit the image to be located to a cloud server, and the cloud server identifies the wall area in the image to be located, and sends the position of the wall area in the image to be located to the electronic device. In other examples, the electronic device can also use the area corresponding to the plane with the largest area in the plane detection result as the target area.

[0109] like Figure 8 As shown, the figure is a schematic diagram of a target area provided by an embodiment of the present application. After the electronic device performs plane detection on the image to be located, a first plane area 801, a second plane area 802, a third plane area 803, etc. can be obtained, wherein the wall area is the first plane area 801. At this time, the first plane area 801 is used as the target area.

[0110] It should be noted that the above method for determining the wall area is merely an exemplary introduction, and those skilled in the art can design a method for determining the wall area based on actual needs.

[0111] The second type: there is no vehicle parked in the parking space in the image to be located.

[0112] Similarly, the electronic device can detect the image to be located by using a target detection algorithm to determine whether a vehicle is parked in the parking area in the image to be located. When there is no vehicle parked in the parking area in the image to be located, the target area is a wall area and / or a ground area. For ease of understanding, the following description takes the target area as a wall area and a ground area as an example, and in other examples, the target area may also be a ground area.

[0113] It should be noted that, in the second case, the parking spaces in the same partition of the indoor parking lot are consistent in color with the wall.

[0114] In some examples, the electronic device can detect the wall area in the image to be located through the wall-ground detection model, and the electronic device can also perform depth detection on the image to be located through the above-mentioned preset algorithm (PlaneRCNN), and determine the wall area and ground area in the image to be located according to the depth detection result. Among them, the electronic device can also transmit the image to be located to the cloud server, and the cloud server identifies the wall area and ground area in the image to be located, and sends the position of the wall area and ground area in the image to be located to the electronic device. In other examples, the electronic device can also use the area corresponding to the top N (for example, N can be 2) planes ranked from large to small in the plane detection result as the target area.

[0115] It should be noted that the above-mentioned method of determining the wall area and the ground area is merely an exemplary introduction, and those skilled in the art can design a method of determining the wall area and the ground area based on actual needs.

[0116] like Fig. 9 As shown, this figure is a schematic diagram of another target area provided by an embodiment of the present application. After the electronic device performs plane detection on the image to be located, a fourth plane area 901, a fifth plane area 902, a sixth plane area 903, etc. can be obtained, wherein the fourth plane area 901 is a ground area, and the fifth plane area 902 is a wall area. At this time, the fourth plane area 901 and the fifth plane area 902 are used as target areas.

[0117] Then, the electronic device can extract the color in the image to be located.

[0118] The electronic device can first extract the R (red), G (green), and B (blue) values ​​corresponding to each pixel of the image to be located, and then convert the R, G, and B values ​​into H (hue), S (saturation), and V (value).

[0119] It should be noted that in the above examples, only each pixel is processed as an example, and in other examples, multiple pixels may also be processed. When the term "each" is mentioned later, "each" is only an example, and it may also be "multiple", which will not be repeated later.

[0120] In some examples, the electronic device may obtain the value of H by the following formula:

[0121]

[0122] Among them, H1 is the intermediate variable.

[0123] In some examples, the electronic device may obtain the value of S by the following formula:

[0124]

[0125] Among them, max(R,G,B) represents the maximum value among R, G, and B, and min(R,G,B) represents the minimum value among R, G, and B.

[0126] In some examples, the electronic device may obtain the value of V by the following formula:

[0127]

[0128] Among them, max(R,G,B) represents the maximum value among R, G, and B.

[0129] After determining the H, S and V values ​​of the image to be located, the electronic device can determine the pixel value of the mask image according to a first mapping relationship between the preset pixel value and the hue value, saturation value and color brightness value.

[0130] In some examples, the first mapping relationship is shown in the following formula:

[0131]

[0132] Among them, mask pixel is the pixel value of the mask image; The first H threshold, is the second H threshold, is the third H threshold, Fourth H threshold, Fifth H threshold, The sixth H threshold, Seventh H threshold, Eighth H threshold, Ninth H threshold, 10th H threshold; The first S threshold, The second S threshold, The third S threshold, The fourth S threshold, Fifth S threshold, The sixth S threshold, Seventh S threshold, The eighth S threshold, Ninth S threshold, Tenth S threshold; First V threshold, Second V threshold, The third V threshold, Fourth V threshold, Fifth V threshold, Sixth V threshold, Seventh V threshold, Eighth V threshold, Ninth V threshold, The tenth V threshold; "other" means that when H, S and V are no longer within the above range, the pixel value of the mask image is 255.

[0133] It should be noted that the above preset rules are merely exemplary introductions, and those skilled in the art may adjust the thresholds of each H, each S, and each V based on actual needs.

[0134] In some examples, the second mapping relationship between the color and the pixel value of the mask image may be preset. For example, the setting may be performed as shown in Table 1 below.

[0135] Table 1:

[0136] color Purple orange color green blue red other Pixel Value 0 50 100 150 200 255

[0137] As shown in Table 1, when the pixel value of the mask image is 0, the corresponding color is purple, when the pixel value of the mask image is 50, the corresponding color is orange, when the pixel value of the mask image is 100, the corresponding color is green, when the pixel value of the mask image is 150, the corresponding color is blue, when the pixel value of the mask image is 200, the corresponding color is red, and when the pixel value of the mask image is 255, the corresponding color is other.

[0138] It should be noted that Table 1 is only an exemplary introduction to the second mapping relationship between colors and pixel values ​​of the mask image, and those skilled in the art may set more colors or fewer colors according to actual needs, thereby changing the second mapping relationship.

[0139] Based on this, after obtaining the pixel value corresponding to each pixel point of the image to be located, the electronic device can determine the color corresponding to the pixel point based on the second mapping relationship shown in Table 1 above, and then the electronic device can output the color of each pixel point of the image to be located.

[0140] After the electronic device determines the target area and the color of each pixel in the image to be located, it can determine the color corresponding to the target area.

[0141] In some embodiments, the electronic device can count the colors corresponding to the pixels in the target area to obtain the number or proportion of pixels corresponding to each color, and the electronic device can use the color corresponding to the pixel with the largest number or the largest proportion as the color of the target area. For example, the number of pixels in the target area is 100, of which the number of purple pixels is 90, the number of orange pixels is 5, the number of green pixels is 3, and the number of blue pixels is 2. The number of purple pixels is the largest and the proportion is the largest. The electronic device uses purple as the color of the target area.

[0142] In other embodiments, after the electronic device determines the target area, it can extract the color of the target area to obtain the color of the target area.

[0143] It should be noted that the process of extracting the color of the target area by the electronic device is similar to the process of extracting the color of the entire image to be positioned in the above embodiment, and will not be described in detail here.

[0144] S404: The electronic device matches the image to be located with the image in the database corresponding to the color of the target area to obtain a matching result.

[0145] The image in the database corresponding to the color of the target area includes location information. In some embodiments, databases corresponding to different colors can be pre-set. For example, a database corresponding to purple, a database corresponding to orange, a database corresponding to green, a database corresponding to blue, and a database corresponding to red can be set. Different colors can correspond to different partitions of the parking lot, such as Fig.10As shown, the figure is a schematic diagram of the partition of a parking lot provided in an embodiment of the present application. Among them, the partitions of the parking lot may include: purple partition 1001, orange partition 1002, green partition 1003, blue partition 1004 and red partition 1005. Among them, the color corresponding to the parking spaces and / or walls of the purple partition 1001 is purple, the color corresponding to the parking spaces and / or walls of the orange partition 1002 is orange, the color corresponding to the parking spaces and / or walls of the green partition 1003 is green, the color corresponding to the parking spaces and / or walls of the blue partition 1004 is blue, and the color corresponding to the parking spaces and / or walls of the red partition 1005 is red. In this way, the database corresponding to different colors can also be the database corresponding to different partitions of the parking lot.

[0146] After the electronic device determines the color corresponding to the target area, the electronic device can determine the parking lot partition corresponding to the color of the target area according to the color of the target area and the third mapping relationship between the color and the parking lot partition, and then use the database corresponding to the parking lot partition to perform an image matching process. Compared with performing image matching in the entire database of the parking lot in the traditional solution, performing image matching in the database corresponding to the color of the target area can narrow the scope of image matching, which not only improves matching efficiency, but also reduces erroneous matching results due to different partitions due to similar image textures, thereby improving matching accuracy.

[0147] In other embodiments, the electronic device can send the image to be located to a cloud server, which stores a database corresponding to each partition. The cloud server performs image matching on the image to be located based on the database corresponding to the color of the target area to obtain an image matching result, and then sends the matching result to the electronic device, which can then obtain the above matching result.

[0148] The following describes the image matching process from the perspective of electronic equipment:

[0149] The electronic device can perform feature extraction on the image to be located to obtain a feature vector of the image to be located. The electronic device can also pre-acquire a feature vector corresponding to each image in the database. Then, the electronic device performs similarity calculation based on the feature vector of the image to be located and the feature vector corresponding to each image in the database, and then sorts the images from large to small according to the similarity to obtain the top M images in the sorting, where M is a positive integer, for example, M is 5, and of course M can also be 20, 30, etc. The matching result can be the above-mentioned top M images.

[0150] S405: The electronic device determines the position corresponding to the image to be located according to the matching result.

[0151] In some embodiments, the electronic device can calculate the posture of the electronic device through the PnP algorithm, and locate the image to be located based on the posture of the electronic device. PnP (Perspective-n-Points) refers to the object motion positioning from 3D to 2D point pairs, that is, the coordinates of the object in the world coordinate system and the pixel coordinates of the object in the image plane of the camera are known to solve the posture of the camera. The camera can be a camera on the electronic device, and the posture of the camera can be the posture of the electronic device.

[0152] In some examples, the electronic device can perform feature matching based on the feature vectors of the first M images to obtain feature points, and then calculate the posture of the electronic device based on the obtained feature points. In order to further improve the computing efficiency, the electronic device can obtain 4 feature points, use 3 of the feature points to calculate 4 sets of solutions, each set of solutions corresponds to a posture information, calculate the posture of the electronic device based on the posture information, and then use the 4th feature point and the posture of the electronic device to calculate the posture error, and use the posture corresponding to the set of solutions with the smallest error as the posture of the electronic device. After determining its own posture, the electronic device can determine the position corresponding to the image to be located based on its own posture.

[0153] In other embodiments, corresponding positions may be set in advance for images in the database, for example, image 1 in the database corresponds to position 1, image 2 corresponds to position 2, etc. After obtaining the matching results, the electronic device may obtain the first M images, and then obtain the M positions of the first M image pairs. The electronic device may locate the image to be located based on the M positions. For example, the electronic device may use the center of the M positions as the position of the electronic device to achieve the location of the image to be located.

[0154] Based on the above description, an embodiment of the present application provides a positioning method, which can be applied to electronic devices. After the electronic device obtains the image to be positioned, it first performs plane detection on the image to determine the target area in the image, and then determines the color of the target area, performs image matching from the database corresponding to the color of the target area, obtains a matching result, and performs positioning based on the matching result. In this method, the electronic device distinguishes the database by color information. Compared with the traditional solution of performing image matching in the entire database, performing image matching in the database corresponding to the color of the target area can narrow the scope of image matching, not only improve matching efficiency, but also reduce erroneous matching results due to different partitions due to similar image textures, thereby improving matching accuracy. It can be seen that the scheme of the present application introduces color information, which can avoid obtaining results with different colors but the same spatial structure or layout after image matching, thereby improving the accuracy of positioning.

[0155] This embodiment also provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device executes Figure 4 The relevant method steps in the embodiment are used to implement the method in the above embodiment.

[0156] This embodiment also provides a computer program product including instructions. When the computer program product is run on an electronic device, the electronic device executes the following Figure 4 The relevant method steps in the embodiment are used to implement the method in the above embodiment.

[0157] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A positioning method, It is characterized in that Applied to electronic equipment, the method comprises: Acquire the image to be positioned; Determine the color of the target area in the image to be located, where the target area is a wall area and / or a ground area of ​​the parking lot in the image to be located; Matching the image to be located with an image in a database corresponding to the color of the target area to obtain a matching result, wherein the image in the database corresponding to the color of the target area includes location information; According to the matching result, the position corresponding to the image to be located is determined.

2. The method according to claim 1, It is characterized in that Determining the color of the target area in the image to be located includes: Obtaining the hue value, saturation value, and color brightness value corresponding to a plurality of pixel points in the target area of ​​the image to be located; Determine the colors corresponding to the plurality of pixel points according to the hue values, saturation values, and color brightness values ​​corresponding to the plurality of pixel points; The color of the target area is determined according to the colors corresponding to the multiple pixel points.

3. The method according to claim 2, It is characterized in that The determining the colors corresponding to the plurality of pixel points according to the hue values, saturation values, and color brightness values ​​corresponding to the plurality of pixel points includes: Determine the pixel values ​​corresponding to the plurality of pixel points according to a first mapping relationship between a preset pixel value and a hue value, a saturation value, and a color brightness value; The colors corresponding to the multiple pixel points are determined according to the pixel values ​​corresponding to the multiple pixel points and a preset second mapping relationship between the colors and the pixel values.

4. The method according to any one of claims 1 to 3, It is characterized in that Determining the color of the target area according to the colors corresponding to the plurality of pixel points includes: The color corresponding to the pixel with the largest number or the largest proportion is taken as the color of the target area.

5. The method according to claim 1, It is characterized in that The step of matching the image to be located with an image in a database corresponding to the color of the target area to obtain a matching result includes: According to the similarity between the image to be located and the image in the database corresponding to the color of the target area, the top M images in similarity ranking are determined, where M is a positive integer.

6. The method according to claim 5, It is characterized in that The method further comprises: Determine the parking lot partition corresponding to the color of the target area according to the color of the target area and a third mapping relationship between the color and the parking lot partition; Determining the top M images in similarity order according to the similarity between the image to be located and the image in the database corresponding to the color of the target area includes: According to the similarity between the image to be located and the images in the database corresponding to the parking lot partition, the top M images in similarity ranking are determined.

7. The method according to claim 1, It is characterized in that The image to be located also includes a parking space area; When a vehicle is parked in the parking space area, the target area is a wall area; or, When there is no vehicle parked in the parking space area, the target area is a wall area and / or a ground area.

8. The method according to claim 7, It is characterized in that The target area is the wall area and the ground area, and the color of the wall area is the same as the color of the ground area.

9. An electronic device, It is characterized in that include: Camera, processor and memory; The camera collects images; One or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8.

10. A computer storage medium, It is characterized in that The method comprises computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 8.