Image processing method, device, storage medium and electronic device
By obtaining the target image and position information of the virtual scene in the real scene, adjusting the virtual scene to accurately align it with the real scene, the problem of poor positioning effect in indoor virtual reality scenes is solved, and a simple and efficient virtual reality experience is achieved.
Patent Information
- Application Number
- CN202111640765.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-12-29
AI Technical Summary
The prior art virtual object positioning effect is poor and the implementation method is complex in indoor virtual reality scenarios. Especially GPS, compass technology and computer vision technology require professional equipment and complex data acquisition processes, making it difficult to achieve accurate virtual and real scenarios. Unified coordinates.
By obtaining the target image in the real scene, determining the position information of the preset image in the target image, and adjusting the scene image of the virtual scene based on this information, so that the virtual object and the real object overlap, and using the target conversion matrix and position difference calculation, it realizes Accurate alignment of virtual scenes and real scenes.
There is no need to pre-install professional equipment, which realizes accurate positioning of indoor virtual scenes, simplifies the process, and enhances the user experience. The perspectives of virtual scenes and real scenes overlap, providing a more realistic experience.
Smart Images

Figure CN114494365B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of AR technology, and in particular, to an image processing method, device, storage medium and electronic device. Background Art
[0002] With the continuous development of electronic information technology, AR technology has been added to many applications to give users a more realistic experience. In the process of developing applications with AR functions, developers often need to place virtual objects in the space of real scenes, which requires unifying the coordinates of the virtual scene with the coordinates of the real scene.
[0003] At present, the coordinates of the virtual scene and the real scene are often unified through GPS and compass technology, beacon positioning technology or computer vision technology and pattern matching positioning methods. However, most of the above methods have the problem of poor indoor positioning effect and complex implementation. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides an image processing method, device, storage medium and electronic device.
[0005] According to a first aspect of an embodiment of the present disclosure, a method for image processing is provided, the method comprising: acquiring a target image in a real scene; when it is determined that the target image includes a first preset image, acquiring first position information of the first preset image in the real scene; and according to the first position information, adjusting a scene image of a virtual scene corresponding to the real scene so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene.
[0006] Optionally, when the first preset image is the first image obtained from the target image after the terminal enters the virtual scene, adjusting the scene image of the virtual scene corresponding to the real scene according to the first position information includes: obtaining the second position information of the first preset image in the virtual scene; calculating a first target transformation matrix according to the first position information and the second position information; and adjusting the scene image of the virtual scene according to the first target transformation matrix.
[0007] Optionally, when the first preset image is not the first image obtained from the target image after the terminal enters the virtual scene, adjusting the scene image of the virtual scene corresponding to the real scene based on the first position information includes: obtaining the third position information of the second preset image most recently obtained from the historical target image in the real scene; determining the position difference between the first preset image and the second preset image based on the first position information and the third position information; and adjusting the scene image of the virtual scene based on the first position information and the position difference.
[0008] Optionally, adjusting the scene image of the virtual scene based on the first position information and the position difference includes: when the position difference is greater than or equal to a preset position difference threshold, obtaining the second position information of the first preset image in the virtual scene; calculating a first target conversion matrix based on the first position information and the second position information; taking the first target conversion matrix and an average value of a preset number of second target conversion matrices obtained historically as a third target conversion matrix; and adjusting the scene image of the virtual scene based on the third target conversion matrix.
[0009] Optionally, the method further includes: when the position difference is less than the preset position difference threshold, acquiring a fourth target conversion matrix corresponding to the second preset image; and adjusting the scene image of the virtual scene according to the fourth target conversion matrix.
[0010] Optionally, the method also includes: obtaining the initial position of the terminal when entering the virtual scene; taking the initial position as the origin position; establishing a scene coordinate system based on the origin position; obtaining the first position information of the first preset image in the real scene includes: obtaining the first position information of the first preset image in the real scene based on the scene coordinate system.
[0011] Optionally, the position difference includes an absolute value of a distance difference and an absolute value of an angle difference between the first preset image and the second preset image in the real scene.
[0012] According to a second aspect of an embodiment of the present disclosure, there is provided an image processing device, comprising: a first acquisition module, for acquiring a target image in a real scene; a second acquisition module, for acquiring first position information of a first preset image in the real scene when it is determined that the target image includes a first preset image; and an adjustment module, for adjusting a scene image of a virtual scene corresponding to the real scene according to the first position information, so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene.
[0013] Optionally, when the first preset image is the first image obtained from the target image after the terminal enters the virtual scene, the adjustment module is used to obtain the second position information of the first preset image in the virtual scene; calculate the first target transformation matrix based on the first position information and the second position information; and adjust the scene image of the virtual scene based on the first target transformation matrix.
[0014] Optionally, when the first preset image is not the first time the terminal obtains the image from the target image after entering the virtual scene, the adjustment module is used to obtain the third position information of the second preset image that was most recently obtained from the historical target image in the real scene; determine the position difference between the first preset image and the second preset image based on the first position information and the third position information; and adjust the scene image of the virtual scene based on the first position information and the position difference.
[0015] Optionally, the adjustment module is used to obtain the second position information of the first preset image in the virtual scene when the position difference is greater than or equal to a preset position difference threshold; calculate a first target conversion matrix based on the first position information and the second position information; take the first target conversion matrix and an average value of a preset number of second target conversion matrices obtained historically as a third target conversion matrix; and adjust the scene image of the virtual scene based on the third target conversion matrix.
[0016] Optionally, the adjustment module is further used to obtain a fourth target transformation matrix corresponding to the second preset image when the position difference is less than the preset position difference threshold; and adjust the scene image of the virtual scene according to the fourth target transformation matrix.
[0017] Optionally, the device also includes: a third acquisition module, used to obtain the initial position of the terminal when entering the virtual scene, and use the initial position as the origin position; a coordinate system establishment module, used to establish a scene coordinate system based on the origin position; the second acquisition module is used to obtain the first position information of the first preset image in the real scene based on the scene coordinate system.
[0018] Optionally, the position difference includes an absolute value of a distance difference and an absolute value of an angle difference between the first preset image and the second preset image in the real scene.
[0019] According to a third aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the image processing method described in the first aspect of the present disclosure are implemented.
[0020] According to a fourth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the image processing method of the first aspect of the present disclosure.
[0021] Through the above technical solution, the target image in the real scene is obtained; when it is determined that the target image includes the first preset image, the first position information of the first preset image in the real scene is obtained; according to the first position information, the scene image of the virtual scene corresponding to the real scene is adjusted so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene. In this way, the scene graph of the virtual scene can be adjusted by the first preset image in the real scene, without the need to pre-install professional equipment, the implementation method is simple, and accurate positioning can be performed indoors, so that the perspective picture of the virtual scene coincides with the perspective picture of the real scene, giving users a more realistic experience.
[0022] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0024] Figure 1 is a flowchart of an image processing method provided by an embodiment of the present disclosure;
[0025] Figure 2 is a flowchart of another image processing method provided by an embodiment of the present disclosure;
[0026] Figure 3 is a flowchart of another image processing method provided by an embodiment of the present disclosure;
[0027] Figure 4 is a structural schematic diagram of an image processing device provided by an embodiment of the present disclosure;
[0028] Figure 5 is a schematic diagram of the structure of another image processing device provided by an embodiment of the present disclosure;
[0029] Figure 6It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0031] In the description below, words such as “first” and “second” are only used for the purpose of distinguishing the description and should not be understood as indicating or implying relative importance or order.
[0032] First, the application scenario of the present disclosure is explained. The present disclosure can be applied to the scenario of positioning the virtual scene. With the continuous development of electronic information technology, AR technology has been added to many applications to enable users to have a more realistic real experience. In the process of developing applications with AR functions, developers often need to place virtual objects in the space of the real scene, which requires the coordinates of the virtual scene to be unified with the coordinates of the real scene. At present, the coordinates of the virtual scene and the coordinates of the real scene are often unified by GPS and compass technology, beacon positioning technology or computer vision technology and pattern matching positioning methods. Among them, GPS and compass technology have fast positioning speed. Generally, after the target device moves for a period of time, it is sampled and analyzed to predict its subsequent moving position to eliminate errors. Beacon positioning technology is achieved by installing hardware equipment at a specified location indoors in advance, and then communicating with the hardware equipment through mobile terminals such as mobile phones to achieve positioning. Computer vision technology and pattern matching positioning methods need to collect visual data in real scenes in advance, analyze and process the visual data, and then perform pattern matching based on the images collected by the mobile phone to analyze the current position and orientation of the mobile phone, thereby achieving positioning. Based on the above scenarios, the inventors found that the positioning error range of GPS and compass technology is generally around 5 meters, which is not suitable for positioning requirements in AR application scenarios, and the positioning effect for slow-moving objects is poor. Most beacon positioning technologies are expensive, and require professionals to install and calibrate the hardware equipment in advance, and the implementation method is relatively complicated. Computer vision technology and pattern matching positioning methods also require professional equipment to collect data from real scenes in advance, and when the real scene undergoes partial changes, the accuracy of positioning will also be affected.
[0033] In order to solve the above technical problems, the present disclosure provides an image processing method, device, storage medium and electronic device. By acquiring a target image in a real scene; when it is determined that the target image includes a first preset image, acquiring the first position information of the first preset image in the real scene; according to the first position information, adjusting the scene image of the virtual scene corresponding to the real scene, so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene. In this way, the scene graph of the virtual scene can be adjusted by the first preset image in the real scene, the implementation method is simple, and accurate positioning can be performed indoors, so that the perspective picture of the virtual scene coincides with the perspective picture of the real scene, giving users a more realistic experience.
[0034] The present disclosure is described below in conjunction with specific embodiments.
[0035] Figure 1 This is an image processing method according to an exemplary embodiment. The method can be applied to a terminal, and the terminal can include but is not limited to a mobile phone, a tablet computer or AR glasses. The method may include the following steps:
[0036] In step S101, a target image in a real scene is acquired.
[0037] The target image can be collected in real time by a camera on the terminal. There are multiple images in the real scene and each image contains different feature information, that is, each image is easy to distinguish, so that the first preset image can be accurately identified from the target image. The first preset image is any one of the multiple images.
[0038] In addition, in order to improve the accuracy of positioning, multiple images can be set at different locations of the real scene, and multiple images can be set on areas that users may pass through, so that the terminal can capture more images, thereby adjusting the scene image of the virtual scene according to the images at different locations.
[0039] In step S102, when it is determined that the target image includes a first preset image, first position information of the first preset image in the real scene is obtained.
[0040] It can be understood that if the camera of the terminal recognizes the first preset image from the target image collected in real time, it can be determined that the target image includes the first preset image. Among them, it is considered that the first preset image may not appear completely in the target image in the actual application scenario. Therefore, in this embodiment, in the scenario where part of the first preset image exists in the target image, it can be determined that the target image includes the first preset image. For example, if the area where the first preset image appears in the target image reaches 40% to 100% of the area of the complete first preset image, it can be determined that the target image includes the first preset image.
[0041] Secondly, when it is determined that the target image includes the first preset image, the first position information of the first preset image in the real scene is obtained. Among them, the first coordinate information is used to characterize the coordinate position and angle of the first preset image in the real scene, and the coordinate position can be determined based on the scene coordinate system. Among them, the scene coordinate system is a coordinate system established based on the origin position, and the origin position is the initial position when the terminal enters the virtual scene. For example, when the user opens an application with AR function, it can be determined that the terminal enters the virtual scene, and the initial position of the terminal at that moment is recorded, and the initial position is used as the origin position, and a scene coordinate system is established.
[0042] Correspondingly, acquiring the first coordinate information of the first preset image in the real scene may include: acquiring the first coordinate information of the first preset image in the real scene based on the scene coordinate system.
[0043] In step S103, the scene image of the virtual scene corresponding to the real scene is adjusted according to the first position information.
[0044] According to the first position information of the first preset image obtained in the above step S102, the scene image of the virtual scene corresponding to the real scene is adjusted so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene. The virtual scene is a three-dimensional scene space corresponding to the real scene.
[0045] By adopting the above method, the scene image of the virtual scene can be adjusted through the first preset image in the real scene, without the need to pre-install professional equipment. The implementation is simple and can be accurately positioned indoors, so that the perspective picture of the virtual scene coincides with the perspective picture of the real scene, giving users a more realistic experience.
[0046] In some embodiments, according to the first position information, the scene image of the virtual scene corresponding to the real scene is adjusted by the following two implementation methods:
[0047] In one possible implementation, Figure 2 As shown, in the case where the first preset image is the first image obtained from the target image after the terminal enters the virtual scene, the above step S103 adjusts the scene image of the virtual scene corresponding to the real scene according to the first position information, which may include the following steps:
[0048] In step S1031, second position information of the first preset image in the virtual scene is obtained.
[0049] It is understandable that, in the case where it is determined that the target image includes the first preset image, if the first preset image is the first image obtained from the target image after the terminal enters the virtual scene, the second position information of the first preset image in the virtual scene can be obtained. Among them, the coordinate information of multiple images set in the real scene in the real scene can be marked in the virtual scene in advance as the second position information. The second coordinate information is used to characterize the coordinate position and angle of the first preset image in the virtual scene.
[0050] In step S1032, a first target transformation matrix is calculated based on the first position information and the second position information.
[0051] For example, according to the first position information and the second position information, the first target conversion matrix can be calculated by the following formula:
[0052]
[0053] Among them, T c_new is the first target transformation matrix, T pv is the second position information, T c is the initial coordinate matrix of the virtual scene, T p_cap It is the first location information.
[0054] In step S1033, the scene image of the virtual scene is adjusted according to the first target transformation matrix.
[0055] According to the first target matrix obtained in the above step S1032, the current scene image of the virtual scene is adjusted so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene.
[0056] In another possible implementation, Figure 3 As shown, in the case where the first preset image is not the first image obtained from the target image after the terminal enters the virtual scene, the above step S103, according to the first position information, adjusts the scene image of the virtual scene corresponding to the real scene, which may include the following steps:
[0057] In step S1034, the third position information of the second preset image most recently acquired from the historical target image in the real scene is obtained.
[0058] It is understandable that, in the case of determining that the target image includes the first preset image, if the first preset image is not the first time the terminal obtains the image from the target image after entering the virtual scene, the third position information of the second preset image most recently obtained from the historical target image in the real scene can be obtained. The third coordinate information is used to characterize the coordinate position and angle of the second preset image in the real scene. The virtual scene is adjusted by comparing with the third position information of the second preset image. It should be noted that the second preset image may be the same as or different from the first preset image.
[0059] In step S1035, a position difference between the first preset image and the second preset image is determined according to the first position information and the third position information.
[0060] In this step, the position difference between the first preset image and the second preset image can be determined based on the first position information and the third position information, wherein the position difference may include the absolute value of the distance difference and the absolute value of the angle difference between the first preset image and the second preset image in the real scene.
[0061] In step S1036, the scene image of the virtual scene is adjusted according to the first position information and the position difference.
[0062] It can be understood that the distance between the first preset image and the second preset image can be determined based on the position difference. If the position difference indicates that there is a large deviation between the scene image of the virtual space corresponding to the first preset image and the scene image of the virtual space corresponding to the second preset image, then the scene image of the virtual scene can be adjusted based on the first position information. If the position difference indicates that there is no large deviation between the scene image of the virtual space corresponding to the first preset image and the scene image of the virtual space corresponding to the second preset image, then the first position information of the first preset image obtained this time can be ignored.
[0063] For example, when the position difference is greater than or equal to the preset position difference threshold, for example, when the absolute value of the distance difference between the first preset image and the second preset image is greater than or equal to 5 cm, and the absolute value of the angle difference is greater than or equal to 5 degrees, it can be determined that the scene image of the virtual space corresponding to the first preset image and the scene image of the virtual space corresponding to the second preset image have a large deviation. The second position information of the first preset image in the virtual scene can be obtained. And according to the first position information and the second position information, the first target conversion matrix is calculated. Similarly, the first target conversion matrix can be calculated according to the formula in the above step S202 based on the first position information and the second position information, which will not be repeated here. Secondly, the average value of the first target conversion matrix and the preset number of second target conversion matrices obtained historically can be used as the third target conversion matrix. Among them, the second target conversion matrix is calculated based on the position information of the preset image in the real scene and the position information in the virtual scene obtained from the historical target image. And according to the third target conversion matrix, the scene image of the virtual scene is adjusted. So that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene.
[0064] When the position difference is less than the preset position difference threshold, for example, when the absolute value of the distance difference between the first preset image and the second preset image is less than 5 cm and / or the absolute value of the angle difference is less than 5 degrees, it can be determined that there is no significant deviation between the scene image of the virtual space corresponding to the first preset image and the scene image of the virtual space corresponding to the second preset image, and the first position information of the first preset image acquired this time can be ignored. In other words, the fourth target conversion matrix corresponding to the second preset image can be acquired. The fourth target conversion matrix is calculated based on the position information of the second preset image acquired from the historical target image in the real scene and the position information in the virtual scene. And the scene image of the virtual scene can be adjusted according to the fourth target conversion matrix.
[0065] By adopting the above method, the scene graph of the virtual scene can be adjusted through the first preset image in the real scene, without the need to pre-install professional equipment. The implementation is simple and accurate positioning can be performed indoors, so that the perspective picture of the virtual scene coincides with the perspective picture of the real scene, giving users a more realistic experience.
[0066] Figure 4 An image processing device is shown according to an exemplary embodiment. The device 400 includes:
[0067] The first acquisition module 401 is used to acquire a target image in a real scene;
[0068] A second acquisition module 402 is used to acquire first position information of the first preset image in the real scene when it is determined that the target image includes the first preset image;
[0069] The adjustment module 403 is used to adjust the scene image of the virtual scene corresponding to the real scene according to the first position information, so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene.
[0070] Optionally, when the first preset image is the first image obtained from the target image after the terminal enters the virtual scene, the adjustment module 403 is used to obtain the second position information of the first preset image in the virtual scene; calculate the first target transformation matrix based on the first position information and the second position information; and adjust the scene image of the virtual scene based on the first target transformation matrix.
[0071] Optionally, when the first preset image is not the first time the terminal obtains the image from the target image after entering the virtual scene, the adjustment module 403 is used to obtain the third position information of the second preset image that was most recently obtained from the historical target image in the real scene; determine the position difference between the first preset image and the second preset image based on the first position information and the third position information; and adjust the scene image of the virtual scene based on the first position information and the position difference.
[0072] Optionally, the adjustment module 403 is used to obtain the second position information of the first preset image in the virtual scene when the position difference is greater than or equal to a preset position difference threshold; calculate a first target transformation matrix based on the first position information and the second position information; use the first target transformation matrix and an average value of a preset number of second target transformation matrices obtained historically as a third target transformation matrix; and adjust the scene image of the virtual scene based on the third target transformation matrix.
[0073] Optionally, the adjustment module 403 is further used to obtain a fourth target conversion matrix corresponding to the second preset image when the position difference is less than the preset position difference threshold; and adjust the scene image of the virtual scene according to the fourth target conversion matrix.
[0074] Alternatively, if Figure 5 As shown, the device 400 also includes:
[0075] The third acquisition module 404 is used to acquire the initial position of the terminal when entering the virtual scene, and use the initial position as the origin position;
[0076] A coordinate system establishing module 405 is used to establish a scene coordinate system based on the origin position;
[0077] The second acquisition module 402 is used to acquire the first position information of the first preset image in the real scene based on the scene coordinate system.
[0078] Optionally, the position difference includes an absolute value of a distance difference and an absolute value of an angle difference between the first preset image and the second preset image in the real scene.
[0079] By using the above-mentioned device, the scene graph of the virtual scene can be adjusted through the first preset image in the real scene, without the need to pre-install professional equipment. The implementation is simple, and accurate positioning can be performed indoors, so that the perspective picture of the virtual scene coincides with the perspective picture of the real scene, giving users a more realistic experience.
[0080] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0081] Figure 6 FIG. 6 is a block diagram of an electronic device 600 according to an exemplary embodiment. Figure 6 As shown, the electronic device 600 may include: a processor 601 and a memory 602. The electronic device 600 may also include one or more of a multimedia component 603, an input / output (I / O) interface 604, and a communication component 605.
[0082] The processor 601 is used to control the overall operation of the electronic device 600 to complete all or part of the steps in the above-mentioned image processing method. The memory 602 is used to store various types of data to support the operation of the electronic device 600. For example, these data may include instructions for any application or method used to operate on the electronic device 600, and application-related data, such as contact data, messages sent and received, pictures, audio, video, etc. The memory 602 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 603 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 602 or sent through the communication component 605. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 604 provides an interface between the processor 601 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 605 is used for wired or wireless communication between the electronic device 600 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 605 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0083] In an exemplary embodiment, the electronic device 600 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned image processing method.
[0084] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned image processing method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 602 including program instructions, and the above-mentioned program instructions can be executed by the processor 601 of the electronic device 600 to complete the above-mentioned image processing method.
[0085] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program executable by a programmable device, and the computer program has a code portion for executing the above-mentioned image processing method when executed by the programmable device.
[0086] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings. However, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, the technical solution of the present disclosure can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the present disclosure. It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0087] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A method for image processing, characterized in that: The method comprises: Acquire target images in real scenes; In a case where it is determined that the target image includes a first preset image, obtaining first position information of the first preset image in the real scene; According to the first position information, adjusting the scene image of the virtual scene corresponding to the real scene so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene; In a case where the first preset image is not the first image acquired from the target image after the terminal enters the virtual scene, adjusting the scene image of the virtual scene corresponding to the real scene according to the first position information includes: Acquire third position information of a second preset image most recently acquired from the historical target image in the real scene; determining a position difference between the first preset image and the second preset image according to the first position information and the third position information; adjusting the scene image of the virtual scene according to the first position information and the position difference; The adjusting the scene image of the virtual scene according to the first position information and the position difference includes: When the position difference is greater than or equal to a preset position difference threshold, obtaining second position information of the first preset image in the virtual scene; Calculating a first target conversion matrix according to the first position information and the second position information; The average value of the first target conversion matrix and a preset number of second target conversion matrices obtained historically is used as a third target conversion matrix; wherein the second target conversion matrix is calculated based on the position information of the preset image obtained from the historical target image in the real scene and the position information in the virtual scene; The scene image of the virtual scene is adjusted according to the third target transformation matrix.
2. The method according to claim 1, characterized in that In a case where the first preset image is an image first acquired from the target image after the terminal enters the virtual scene, adjusting the scene image of the virtual scene corresponding to the real scene according to the first position information includes: Acquire second position information of the first preset image in the virtual scene; Calculating a first target conversion matrix according to the first position information and the second position information; The scene image of the virtual scene is adjusted according to the first target transformation matrix.
3. The method according to claim 1, characterized in that The method further comprises: When the position difference is less than the preset position difference threshold, obtaining a fourth target transformation matrix corresponding to the second preset image; The scene image of the virtual scene is adjusted according to the fourth target transformation matrix.
4. The method according to claim 1, characterized in that: The method further comprises: Obtaining the initial position of the terminal when entering the virtual scene; Taking the initial position as the origin position; Based on the origin position, a scene coordinate system is established; The acquiring of first position information of the first preset image in the real scene includes: Acquire the first position information of the first preset image in the real scene based on the scene coordinate system.
5. The method according to any one of claims 1 to 4, characterized in that The position difference includes the absolute value of the distance difference and the absolute value of the angle difference between the first preset image and the second preset image in the real scene.
6. An image processing device, characterized in that: include: A first acquisition module is used to acquire a target image in a real scene; A second acquisition module is used to acquire first position information of the first preset image in the real scene when it is determined that the target image includes the first preset image; an adjustment module, configured to adjust the scene image of the virtual scene corresponding to the real scene according to the first position information, so that the position of the first preset image in the virtual scene coincides with the position of the first preset image in the real scene; In the case where the first preset image is not the first image obtained from the target image after the terminal enters the virtual scene, the adjustment module is used to obtain the third position information of the second preset image most recently obtained from the historical target image in the real scene; determine the position difference between the first preset image and the second preset image according to the first position information and the third position information; and adjust the scene image of the virtual scene according to the first position information and the position difference; The adjustment module is configured to obtain second position information of the first preset image in the virtual scene when the position difference is greater than or equal to a preset position difference threshold; A first target conversion matrix is calculated based on the first position information and the second position information; an average value of the first target conversion matrix and a preset number of second target conversion matrices obtained historically is used as a third target conversion matrix; wherein the second target conversion matrix is calculated based on the position information of a preset image obtained from historical target images in the real scene and the position information in the virtual scene; and the scene image of the virtual scene is adjusted based on the third target conversion matrix.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
8. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Augmented reality information processing method and device
CN109978945A