Method and device for transforming three-dimensional objects in two-dimensional images based on virtual reality

By acquiring and scaling the three-dimensional point cloud of the two-dimensional image, and considering the lighting characteristics, the problem of low authenticity when enlarging three-dimensional objects is solved, and the user experience and visual effects are improved.

CN115937483BActive Publication Date: 2024-08-27ZHONGKE MEILUO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211548678.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2024-08-27
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

When amplifying a three-dimensional object in a two-dimensional image, the existing technology does not consider the change in distance between the three-dimensional object and the two-dimensional image shooting lens, resulting in low authenticity of the enlarged three-dimensional object and poor user experience.

Method used

By obtaining the three-dimensional point cloud of the two-dimensional image, the three-dimensional point cloud of the three-dimensional object is scaled according to the user's operation instructions, and the scaled three-dimensional point cloud is reduced in dimension and mapped to the two-dimensional image, taking into account the depth information of the three-dimensional object. and lighting characteristics to improve the authenticity of the map.

Benefits of technology

It improves the authenticity of the enlarged three-dimensional object and enhances the user experience. By synchronously changing the distance information of the three-dimensional object relative to the observer, the texture is closer to the visual perspective effect of the human eye.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115937483B
    Figure CN115937483B
Patent Text Reader

Abstract

The present invention provides a method and device for transforming a three-dimensional object in a two-dimensional image based on virtual reality, the method comprising: obtaining a three-dimensional point cloud corresponding to the two-dimensional image, and a three-dimensional object to be scaled in the two-dimensional image; scaling the three-dimensional point cloud corresponding to the three-dimensional object according to a user's operation instruction for the three-dimensional object; and mapping the three-dimensional image corresponding to the scaled three-dimensional point cloud to the two-dimensional image after dimensionality reduction. The application of the embodiments of the present invention improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtual reality technology, and in particular to a method and device for transforming three-dimensional objects in two-dimensional images based on virtual reality. Background Art

[0002] In some application scenarios, such as product effect display, it is necessary to enlarge certain targets in a two-dimensional image. When the target is enlarged, other objects in the image do not change.

[0003] In the prior art, the invention patent application with the document number CN111626920A discloses a method, device and electronic device for image processing: identifying the head area and body area of ​​a human body in the image to be processed, wherein the body area is the area of ​​the human body except the head area; enlarging the head area of ​​the human body in the image: using the lower boundary line of the enlarged head area as the upper boundary line of the body area, and shrinking the body area. The step of enlarging the head area of ​​the human body in the image includes: determining a first direction and a second direction of the head area, wherein the first direction is a direction parallel to the lower boundary line of the head area, and the second direction is a direction perpendicular to the lower boundary line of the head area; at the center point of the head of the head area, stretching the head area to both ends along the first direction; at the center point of the head of the head area, stretching the head area to both ends along the second direction.

[0004] That is to say, the prior art directly stretches the local area corresponding to the three-dimensional object in the two-dimensional image in the direction set by the user. However, when the area corresponding to the three-dimensional object in the two-dimensional image is directly enlarged, it does not take into account the change in the distance of different parts of the three-dimensional object relative to the two-dimensional image shooting lens after the three-dimensional object is enlarged, resulting in lower authenticity of the enlarged three-dimensional object in the two-dimensional image, which in turn leads to a poor user experience. Summary of the invention

[0005] The technical problem to be solved by the present invention is how to make the magnified three-dimensional object in the two-dimensional image more realistic.

[0006] The present invention solves the above technical problems through the following technical means:

[0007] The present invention provides a method for transforming a three-dimensional object in a two-dimensional image based on virtual reality, the method comprising:

[0008] Obtaining a three-dimensional point cloud corresponding to the two-dimensional image and a three-dimensional object that needs to be scaled in the two-dimensional image;

[0009] The three-dimensional point cloud corresponding to the three-dimensional object is scaled according to the user's operation instructions for the three-dimensional object; the three-dimensional image corresponding to the scaled three-dimensional point cloud is reduced in dimension and mapped into the two-dimensional image.

[0010] Optionally, obtaining a three-dimensional point cloud corresponding to the two-dimensional image includes:

[0011] Capture the corresponding 3D point cloud when capturing a 2D image, or,

[0012] Extracting a first object feature contained in a two-dimensional image region corresponding to the three-dimensional object according to the three-dimensional object selected by the user's operation instruction; and extracting each object feature subset contained in the three-dimensional point cloud;

[0013] According to the matching degree between the first object feature and each object feature subset, a subset of object features matching the first object feature is selected, and the subset of object features is used as the second feature. According to the distribution range of the second feature, a three-dimensional point cloud corresponding to the three-dimensional object is obtained, wherein the first object feature and the second object feature respectively include: one or a combination of edges, inflection points, and proportional relationships.

[0014] Optionally, before scaling the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object, the method further includes:

[0015] The first object feature is matched with the second object feature to obtain a transformation matrix of the second object feature relative to the first object feature; and the three-dimensional point cloud is transformed according to the transformation matrix to obtain a transformed three-dimensional point cloud, and the transformed three-dimensional point cloud corresponding to the three-dimensional object is obtained from the transformed three-dimensional point cloud.

[0016] Optionally, reducing the dimension of the stereo image corresponding to the scaled three-dimensional point cloud and mapping it into a two-dimensional image includes:

[0017] When the user's operation instruction is a zoom-in instruction, the enlarged three-dimensional point cloud is rendered as a first three-dimensional image of the object according to the pixel distribution in the two-dimensional image, and the first three-dimensional image of the object is reduced to a two-dimensional map and mapped to the corresponding position in the two-dimensional image.

[0018] Optionally, rendering the magnified three-dimensional point cloud into a first three-dimensional image of the object according to pixel distribution in the two-dimensional image includes:

[0019] Perform color rendering on the magnified three-dimensional point cloud according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image;

[0020] The illumination direction is calculated according to the illumination distribution characteristics of the three-dimensional object before magnification, and the light source position is estimated according to the illumination direction, wherein the illumination distribution characteristics include: one or a combination of shadow direction characteristics, shadow length characteristics, and pixel brightness change characteristics on the common object plane.

[0021] The illumination of the color rendering image is rendered again based on the light source position to obtain a first three-dimensional image of the object.

[0022] Optionally, scaling the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object; and reducing the dimension of the stereoscopic image corresponding to the scaled three-dimensional point cloud and mapping it into the two-dimensional image include:

[0023] When the user's operation instruction for the three-dimensional object is a reduction instruction, obtaining an image area that is vacant after the three-dimensional object is reduced relative to before the reduction;

[0024] Acquire a residual point cloud of a neighboring object associated with the image region, and fill in the residual point cloud according to a structural rule of the neighboring object to obtain a three-dimensional point cloud of the neighboring object, render the three-dimensional point cloud of the neighboring object into a second three-dimensional image according to pixel distribution in the neighboring object or according to pixel distribution of objects of the same type, reduce the dimension of the rendered second three-dimensional point cloud into a two-dimensional map, and map it to a corresponding area in the two-dimensional image;

[0025] The three-dimensional point cloud corresponding to the three-dimensional object is reduced, and the reduced three-dimensional point cloud is rendered into a third three-dimensional image according to the pixel distribution in the two-dimensional image. The rendered third three-dimensional image is reduced to a two-dimensional map and mapped to the area corresponding to the three-dimensional object in the two-dimensional image.

[0026] Optionally, rendering the reduced three-dimensional point cloud into a third three-dimensional image according to pixel distribution in the two-dimensional image includes:

[0027] Perform color rendering on the reduced three-dimensional point cloud according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image;

[0028] The illumination direction is calculated according to the illumination distribution characteristics of the three-dimensional object before reduction, and the light source position is estimated according to the illumination direction, wherein the illumination distribution characteristics include: one or a combination of shadow direction characteristics, shadow length characteristics, and pixel brightness change characteristics on the common object plane.

[0029] The illumination of the color rendering image is rendered again based on the light source position to obtain a third three-dimensional image of the object.

[0030] The embodiment of the present invention further provides a device for transforming a three-dimensional object in a two-dimensional image based on virtual reality, the device comprising:

[0031] An acquisition module, used to acquire a three-dimensional point cloud corresponding to a two-dimensional image, and a three-dimensional object that needs to be scaled in the two-dimensional image;

[0032] The mapping module is used to scale the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instructions for the three-dimensional object; the stereoscopic image corresponding to the scaled three-dimensional point cloud is reduced in dimension and mapped into the two-dimensional image.

[0033] Optionally, the acquisition module is used to:

[0034] Capture the corresponding 3D point cloud when capturing a 2D image, or,

[0035] Extracting a first object feature contained in a two-dimensional image region corresponding to the three-dimensional object according to the three-dimensional object selected by the user's operation instruction; and extracting each object feature subset contained in the three-dimensional point cloud;

[0036] According to the matching degree between the first object feature and each object feature subset, a subset of object features matching the first object feature is selected, and the subset of object features is used as the second feature. According to the distribution range of the second feature, a three-dimensional point cloud corresponding to the three-dimensional object is obtained, wherein the first object feature and the second object feature respectively include: one or a combination of edges, inflection points, and proportional relationships.

[0037] Optionally, the device further includes a matching module, configured to:

[0038] The first object feature is matched with the second object feature to obtain a transformation matrix of the second object feature relative to the first object feature; and the three-dimensional point cloud is transformed according to the transformation matrix to obtain a transformed three-dimensional point cloud, and the transformed three-dimensional point cloud corresponding to the three-dimensional object is obtained from the transformed three-dimensional point cloud.

[0039] The advantages of the present invention are:

[0040] By applying the embodiments of the present invention, the corresponding three-dimensional point cloud is obtained according to the two-dimensional image of the three-dimensional object that needs to be enlarged, and the three-dimensional point cloud is scaled. Since the three-dimensional point cloud contains depth information, the distance information of the three-dimensional object relative to the observer will be changed synchronously when scaling, so that the mapping of the enlarged three-dimensional object is closer to the human visual perspective effect, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic flow chart of a method for transforming a three-dimensional object in a two-dimensional image based on virtual reality provided by an embodiment of the present invention;

[0042] Figure 2 A schematic diagram of the transformation effect provided by an embodiment of the present invention;

[0043] Figure 3 A schematic structural diagram of a device for transforming three-dimensional objects in a two-dimensional image based on virtual reality provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] Example 1

[0046] Embodiment 1 of the present invention first introduces the process of enlarging a three-dimensional object in a two-dimensional image:

[0047] Figure 1 A flowchart of a method for transforming a three-dimensional object in a two-dimensional image based on virtual reality provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0048] S101: Acquire a three-dimensional point cloud corresponding to a two-dimensional image and a three-dimensional object that needs to be scaled in the two-dimensional image.

[0049] For example, in the first aspect, most smartphones now have depth lenses such as structured light lenses, time-of-flight lenses, or lidar lenses. Therefore, while a user uses the optical lens of a mobile phone to capture a two-dimensional image of a three-dimensional object, he or she can also use the depth lens carried by the smartphone to capture a three-dimensional point cloud image of the same viewing range. This embodiment of the present invention is preferably applicable to scenes where objects within the viewing range do not change in a short period of time.

[0050] After seeing the two-dimensional image, the user needs to enlarge the car contained in the image. The user clicks the position of the car on the mobile phone interface, and the mobile phone identifies the object that the user needs to enlarge according to the position clicked by the user. It is understandable that after the user uses the mobile phone to shoot the optical image, the image segmentation algorithm, such as the neural network algorithm, can be used to segment the two-dimensional optical image to obtain the image blocks of each object contained in the two-dimensional image, and then identify which three-dimensional object the user selected according to the position clicked by the user. Then, the first feature is identified in the optical image block of the car shot by the mobile phone. In practical applications, the edge detection algorithm can be used to detect the edge to identify the contour line, and then identify the inflection point of the contour line; the convolution layer in the pre-trained neural network model can also be used to identify other features contained in the optical image, such as circular contour features, tire center features, vehicle contour edges and contour inflection point features, vehicle windshield edge features, window edge features, and window corner features, headlight edge features, headlight inflection point features, etc.

[0051] Then, the features of each object contained in the depth image are identified, and the features of each object are classified into a feature subset to obtain several feature subsets. Each feature subset may include: tire circular contour features, tire center features, vehicle contour edge and contour inflection point features, vehicle windshield edge features, window edge features, and window corner features, headlight edge features, headlight inflection point features, the number of rows of vehicle air intake grilles, the interval between grilles, and license plate position features, digital features on the license plate, etc. The first feature can be realized using image feature extraction algorithms such as AKAZE, ORB, SIFT, and SURF.

[0052] Then, the features in each feature subset are matched with the first feature. If the features in the first feature that are greater than the set ratio can be matched with the feature subset, it means that the two may describe the same three-dimensional object. Therefore, the feature subset can be used as the second feature. It should be emphasized that when the features in the feature subset are relatively simple, for example, when the three-dimensional object is a table, chair, bench, conventional building, etc., the shape and outline are relatively simple, the matching process can be directly matched by turning points and edges; when the features in the feature subset are relatively complex, such as buildings with certain artistic creativity, trees, components with complex curved surfaces, etc., the features in the feature subset can be reduced in dimension to obtain low-dimensional features under different viewing angles, and then the low-dimensional features can be matched with the features of the first object. The camera position can be obtained when the two-dimensional image is captured, and the viewing angle can be determined based on the camera position.

[0053] Then, the feature subset matching the first object feature is used as the second object feature, and then the point cloud in the enveloping area formed according to the position of the second object feature in the three-dimensional point cloud is used as the three-dimensional point cloud of the three-dimensional object. The reason for obtaining the corresponding three-dimensional point cloud according to the second object feature instead of using the three-dimensional point cloud of the object corresponding to the matching feature subset as the three-dimensional point cloud of the three-dimensional object is that due to the viewing angle, the user may only be able to observe part of the surface of the three-dimensional object. Therefore, there is no need to process the point cloud of the part that the user cannot observe, which can reduce the amount of calculation and improve processing efficiency.

[0054] In the embodiment of the present invention, the three-dimensional object may be a tree, a building, a flower bed, a sculpture, a mobile phone, a tea cup, a table, a wall, a door, etc., and is not limited to a car.

[0055] It is understandable that on a smartphone, the depth lens is usually installed on the back of the phone together with the ordinary optical lens, and the distance between the two is only 1-2 cm. Therefore, in low-precision scenes, it can be considered that the images taken by the two are matched, and there is no need to align the point cloud map of the scene. Of course, in application scenarios with relatively high precision requirements, such as when the surface details of a three-dimensional object are relatively rich, if the depth lens is not calibrated, the deviation between the depth map and the optical image will cause some details to appear ghosting, then it is necessary to consider the distance between the two lenses and the error caused by the user's hand shaking. In actual applications, the depth map records the coordinates of each point on the object within the viewing range relative to the depth lens, and the depth map point cloud can be calibrated according to the coordinates and the relative coordinates between the two lenses; further, in order to calibrate the posture changes caused by the user's hand shaking, the data of the internal posture sensor of the mobile phone can be referred to. This process can be implemented using existing geometric algorithms, and the embodiments of the present invention will not be repeated here.

[0056] Secondly, when using other devices to take depth maps for the same viewing range, for example, a depth lens can be used to pre-take a depth map of the indoor area containing various objects; or a depth map can be obtained by using other depth lenses that cooperate with optical cameras to achieve better real-time performance. For example, on the basis of existing outdoor optical monitoring, one or more depth lenses are installed in nearby positions or directions to capture real-time or near real-time depth images.

[0057] In this case, the following steps are required to obtain the 3D point cloud of the 3D object:

[0058] First, the area corresponding to the three-dimensional object selected by the user's operation instruction is obtained, and then the first object feature contained in the two-dimensional image area corresponding to the three-dimensional object is extracted from the optical image.

[0059] Then, the coordinates of the depth map are transformed, and the depth map is converted into a depth map under the perspective of the optical lens according to the orientation and distance of the depth lens relative to the optical lens. The depth map is then segmented, and the features of all objects contained in the segmented point cloud are extracted using a feature extraction algorithm. According to each object, the corresponding features are divided into corresponding feature subsets, and then the feature subsets are matched with the features of the first object.

[0060] When the position and distance of the depth lens relative to the optical lens cannot be known, first, for each feature subset, the low-dimensional features in the feature subset are matched with the low-dimensional features in the first object features, and the feature subsets that are relatively close to the first object features are screened out. Usually, the low-dimensional features refer to points, lines, etc. Then, for each relatively close feature subset, the high-dimensional features in the feature subset are converted at each viewing angle, and the converted high-dimensional features are matched with the high-dimensional features in the first object features. In practical applications, the features in the feature subset can also be reduced in dimensionality to obtain low-dimensional features at different viewing angles, and then the low-dimensional features are matched with the first object features.

[0061] S102: scaling the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object; reducing the dimension of the three-dimensional image corresponding to the scaled three-dimensional point cloud and mapping it into the two-dimensional image.

[0062] Exemplarily, when the user's operation instruction is a zoom instruction, the zoom ratio is obtained according to the user's operation, such as the change in the relative distance between two fingers, and then the three-dimensional point cloud is zoomed in according to the zoom ratio to obtain the zoomed three-dimensional point cloud. Then, according to the correspondence between each part in the three-dimensional point cloud and each part of the three-dimensional object in the two-dimensional image, the colors in the two-dimensional image are rendered into the three-dimensional point cloud to obtain the first three-dimensional image: for example, if the front hood of the vehicle is white, the plane fitted by the point cloud corresponding to the front hood of the vehicle in the three-dimensional point cloud is rendered in the same white. Then, the first three-dimensional image is reduced in dimension according to the viewing angle of the optical image into a two-dimensional map, and the two-dimensional map is pasted at the location of the three-dimensional object in the two-dimensional image.

[0063] Furthermore, considering the change in the lighting effect of the three-dimensional object after it is enlarged, in the embodiment of the present invention, the enlarged three-dimensional point cloud can be color rendered according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image.

[0064] Then, based on one or a combination of the shadow direction feature, shadow length feature, and pixel brightness change feature on the common object plane, the illumination direction is estimated using the method provided in Zheng Yi's "A Review and Outlook of Augmented Reality Illumination Direction Estimation Methods", and then the light source position is estimated based on the intersection between the illumination directions. For surface light sources or light sources such as the sun where there is no intersection between illumination directions, secondary rendering can be performed based on the illumination direction.

[0065] Figure 2 A schematic diagram of the transformation effect provided by an embodiment of the present invention, Figure 2 (a) is the original image without enlargement. Figure 2 (b) is the magnified result. It can be seen that the ratio of the reflective area in (a) to that in (b) is not equal to the ratio of the diameters of the two circular rings. That is to say, the two are not simply stretched. Therefore, compared with the existing technology, it is closer to the effect actually observed by the human eye.

[0066] The illumination of the color rendering image is rendered twice based on the light source position to obtain a first three-dimensional image of the object. The first three-dimensional image of the object is then reduced to a two-dimensional map and mapped to a corresponding position in the two-dimensional image. In the embodiment of the present invention, the influence of illumination on the object is taken into account, so that the magnified object can be more realistic and the visual effect can be improved.

[0067] In order to facilitate the understanding of the technical solution of the embodiment of the present invention, the embodiment of the present invention briefly introduces several typical application scenarios of the embodiment of the present invention:

[0068] In images of natural scenes, the target and the background are generally at different depths. Using image depth information can not only better describe the objects in the scene, but also more effectively express the foreground and background information, and then the efficient segmentation and recognition of objects within the framing range can be achieved based on the foreground and background information, and then it can be used to lock suspects and / or suspected vehicles in police systems, identify unidentified objects in anti-terrorism systems, etc. Taking unidentified object recognition as an example, in scenes such as railway stations, cargo yards, and logistics centers, there are many types of objects, and the similarity of the objects is relatively high. The efficiency of manual recognition is low, and the possibility of error is high; therefore, the prior art mostly uses an artificial intelligence system supported by a visual algorithm for recognition. However, after identifying a suspicious object, how to allow the user to quickly identify the suspicious object is a technical problem that needs to be solved urgently. In the prior art, a labeling box is usually used to select each object, but when there are multiple or many objects in the framing range, the number of standard boxes will be large, which will cause the user to be unable to quickly lock the unidentified object. In the embodiment of the present invention, the unidentified object is magnified and displayed, and the magnification ratio can be adjusted according to the actual setting of the user. The size of the magnified object, which is different from that of ordinary objects, can be more eye-catching, so that the user can quickly lock the unidentified object. Further, in the embodiment of the present invention, the original image of the original size of the unidentified object and the magnified image can be displayed cyclically, and the cycle interval can be 1 second, or 1.5 seconds, etc. Furthermore, the magnified image can also be annotated with color, that is, the unidentified object with the original color and original size is displayed cyclically, and then the magnified image of the unidentified object after color rendering is displayed after a set interval.

[0069] It should be emphasized that the above-mentioned display method can be applied in areas including but not limited to smart policing, and can also be applied to driving safety assistance systems.

[0070] The embodiments of the present invention can also be used for target display in a police FPS (First Person Shooting) simulation training system based on virtual reality. For example, in 10m pistol shooting training, for setting conditions with a lower training difficulty level, the game target is displayed in an enlarged manner; for setting conditions with a higher training difficulty level, the game target is displayed in a reduced size, thereby realizing personalized training for police officers in different positions and with different skill levels.

[0071] Similarly, the embodiments of the present invention are also applicable to visual enhancement for people with low vision. For example, a user uses an electronic device to capture a framing range, and then selects a target object of interest in the optical image. The electronic device then uses the embodiments of the present invention to magnify the target object to facilitate the user's observation and understanding.

[0072] Similarly, the embodiments of the present invention are also applicable to road obstacle warning in driving safety assistance systems. The basic principle of the existing obstacle recognition system based on visual recognition is: using the vehicle's driving recorder or other high-definition probe to capture images in front of the vehicle and in front of the left and right sides, and then using the image recognition algorithm to identify each object, and using the laser radar or binocular vision algorithm to identify the distance of the object, and then judging the distance of each object relative to the vehicle, or judging whether each object is located on the vehicle's driving path. If the object may affect driving safety, the object is highlighted in the captured image using eye-catching colors. However, the inventor found that the colors in the real world are diverse, and the use of color eye-catching display requires the identification of the colors of other objects near the obstacle. The calculation process is complicated, time-consuming, and inefficient. It is difficult or impossible to identify the color of the object at night, which leads to the inability to identify the obstacle with color eye-catching. Therefore, the existing technology has low efficiency and the application scenario is limited to the daytime. Technical problems. During driving, a vehicle using the principles of the embodiments of the present invention uses an on-board camera terminal to shoot various objects within the viewing range, such as vehicles, people, animals, buildings, trees, stones, etc. When an obstacle is identified that may affect driving safety, the object is magnified and displayed without relying on color, thereby solving the technical problem of limited application scenarios. At the same time, the color recognition algorithm is replaced by a geometric operation process, which has higher operation efficiency. Furthermore, in order to more prominently display obstacles to users, colors can be used to render the magnified obstacles to more prominently display the three-dimensional object to users.

[0073] Example 2

[0074] In Example 2 of the present invention, based on Example 1, the method further includes the following steps before step S102:

[0075] When the azimuth difference or distance difference between the depth lens of the depth lens and the optical lens is relatively large, and the azimuth difference and distance between the two cannot be known, it is impossible to use geometric methods to correct the depth map. Therefore, the embodiment of the present invention obtains a transformation matrix of the second object feature relative to the first object feature based on matching the first object feature with the second object feature; and transforms the three-dimensional point cloud according to the transformation matrix to obtain a transformed three-dimensional point cloud, and obtains the transformed three-dimensional point cloud corresponding to the three-dimensional object from the transformed three-dimensional point cloud.

[0076] It is understandable that the azimuth difference between the depth lens and the optical lens cannot be too large, that is, there should be common features for the same three-dimensional object in the depth map taken by the depth lens and the two-dimensional optical map taken by the optical lens, that is, there should be a feature similar to an intersection between the first feature and the second feature that can be used for feature matching.

[0077] In practical applications, FLANN+KNN can be used to achieve alignment and calibration of image features.

[0078] Example 3

[0079] Based on the first embodiment of the present invention, the third embodiment of the present invention introduces the process of reducing a three-dimensional object in a two-dimensional image:

[0080] In some scenarios, for example, the user has processed the three-dimensional object. In order to avoid the existence of the three-dimensional object causing visual interference to the processing of other three-dimensional objects, the three-dimensional object is reduced in an embodiment of the present invention:

[0081] Embodiment 3 of the present invention adds the following steps on the basis of Embodiment 1:

[0082] First, when the user's operation instruction for the three-dimensional object is a reduction instruction, the image area that is vacant after the three-dimensional object is reduced relative to before the reduction is obtained;

[0083] Then, the residual defect cloud of the adjacent object associated with the image area is obtained. For example, other three-dimensional objects blocked by the three-dimensional object or other three-dimensional objects having visual intersection with the three-dimensional object can be regarded as adjacent objects.

[0084] Then, the incomplete point cloud is filled in according to the structural rules of the nearby objects to obtain the 3D point cloud of the nearby objects. For example, the structural rules of buildings are usually a combination of planes and curved surfaces, or a combination of planes and planes; vehicles are usually a combination of cylindrical wheels and box-shaped structures; tables are usually a combination of plates and columns; according to these combination rules, the blocked plane can be extended, and the closed and intersecting relationships between planes can be used to achieve the approximate filling operation of the corresponding point cloud. In practical applications, when filling in the point cloud of the blocked part of the nearby object, the depth map taken by some other depth lenses with known perspectives or orientations can be mapped as a reference or supplement. Of course, the relative orientation and height relationship between each depth lens should be pre-calibrated.

[0085] Then, according to the pixel distribution in the adjacent object, or according to the pixel distribution of the same type of object, the 3D point cloud of the adjacent object is rendered into a second 3D image, and the rendered second 3D point cloud is reduced to a 2D map and mapped to a corresponding area in the 2D image;

[0086] In this step, the three-dimensional point cloud corresponding to the three-dimensional object can be rendered first, but this processing results in a larger rendering area and a larger amount of calculation. In order to reduce the amount of calculation and increase the rendering speed, in the embodiment of the present invention, the three-dimensional point cloud corresponding to the three-dimensional object is first reduced, and then the reduced three-dimensional point cloud is rendered into a third three-dimensional image according to the pixel distribution in the two-dimensional image. Then, the rendered third three-dimensional image is reduced to a two-dimensional map and mapped to the area corresponding to the three-dimensional object in the two-dimensional image. This reduces the rendering area and improves the rendering efficiency. The specific rendering process is the same as the rendering process in Example 1, and the embodiment of the present invention will not be repeated here.

[0087] Similarly, the reduced three-dimensional point cloud can be color rendered according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image;

[0088] The illumination direction is calculated according to the illumination distribution characteristics of the three-dimensional object before reduction, and the light source position is estimated according to the illumination direction, wherein the illumination distribution characteristics include: one or a combination of shadow direction characteristics, shadow length characteristics, and pixel brightness change characteristics on the common object plane.

[0089] The illumination of the color rendering image is rendered again based on the light source position to obtain a third three-dimensional image of the object.

[0090] Figure 2 A schematic diagram of the transformation effect provided by an embodiment of the present invention, Figure 2 (a) is the original image without enlargement. Figure 2 (c) is the result after reduction. It can be seen that the ratio of the reflective area in (a) to (c) is not equal to the ratio of the diameters of the two circular rings. That is to say, the two are not simply reduced in area. Therefore, compared with the existing technology, it is closer to the effect actually observed by the human eye.

[0091] In actual applications, the area left empty after shrinking the ring is simulated and generated. Although there is a certain gap between the simulation result and the actual result, the wooden board as the background is not the main object observed by the user, so it does not cause obvious discomfort to the user. Moreover, the wood grain is a highly continuous feature, so it can be realized by using the existing wood grain simulation algorithm. Or it can be filled with pixels from other areas with similar texture structures.

[0092] Example 4

[0093] Corresponding to Embodiment 1 of the present invention, Embodiment 4 of the present invention further provides a device for transforming a three-dimensional object in a two-dimensional image based on virtual reality, the device comprising:

[0094] An acquisition module 301 is used to acquire a three-dimensional point cloud corresponding to a two-dimensional image and a three-dimensional object that needs to be scaled in the two-dimensional image;

[0095] The mapping module 302 is used to scale the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object; and map the three-dimensional image corresponding to the scaled three-dimensional point cloud into a two-dimensional image after reducing the dimension.

[0096] In a specific implementation of the embodiment of the present invention, the acquisition module 301 is used to:

[0097] Capture the corresponding 3D point cloud when capturing a 2D image, or,

[0098] Extracting a first object feature contained in a two-dimensional image region corresponding to the three-dimensional object according to the three-dimensional object selected by the user's operation instruction; and extracting each object feature subset contained in the three-dimensional point cloud;

[0099] According to the matching degree between the first object feature and each object feature subset, a subset of object features matching the first object feature is selected, and the subset of object features is used as the second feature. According to the distribution range of the second feature, a three-dimensional point cloud corresponding to the three-dimensional object is obtained, wherein the first object feature and the second object feature respectively include: one or a combination of edges, inflection points, and proportional relationships.

[0100] In a specific implementation of the embodiment of the present invention, the device further includes a matching module, which is used to:

[0101] The first object feature is matched with the second object feature to obtain a transformation matrix of the second object feature relative to the first object feature; and the three-dimensional point cloud is transformed according to the transformation matrix to obtain a transformed three-dimensional point cloud, and the transformed three-dimensional point cloud corresponding to the three-dimensional object is obtained from the transformed three-dimensional point cloud.

[0102] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for transforming three-dimensional objects in two-dimensional images based on virtual reality. It is characterized in that The method comprises: Acquire a three-dimensional point cloud corresponding to a two-dimensional image, and a three-dimensional object that needs to be scaled in the two-dimensional image; wherein the acquisition of the three-dimensional point cloud corresponding to the two-dimensional image includes: photographing the corresponding three-dimensional point cloud when photographing the two-dimensional image; extracting a first object feature contained in the two-dimensional image region corresponding to the three-dimensional object according to the three-dimensional object selected by the user's operation instruction; and extracting each object feature subset contained in the three-dimensional point cloud; selecting an object feature subset matching the first object feature according to the matching degree between the first object feature and each object feature subset, taking the object feature subset as the second feature, and acquiring the three-dimensional point cloud corresponding to the three-dimensional object according to the distribution range of the second feature, wherein the first object feature and the second object feature respectively include: one or a combination of an edge, an inflection point, and a proportional relationship; Scaling the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object; The stereoscopic image corresponding to the scaled three-dimensional point cloud is reduced in dimension and then mapped to the two-dimensional image, including: when the user's operation instruction is a zoom-in instruction, the enlarged three-dimensional point cloud is rendered as a first three-dimensional image of the object according to the pixel distribution in the two-dimensional image, and the first three-dimensional image of the object is reduced in dimension to a two-dimensional map and mapped to a corresponding position in the two-dimensional image; the rendering of the enlarged three-dimensional point cloud as the first three-dimensional image of the object according to the pixel distribution in the two-dimensional image includes: color rendering of the enlarged three-dimensional point cloud according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image; calculating the illumination direction according to the illumination distribution characteristics of the three-dimensional object before zooming in, estimating the light source position according to the illumination direction, wherein the illumination distribution characteristics include: one or a combination of shadow direction characteristics, shadow length characteristics, and brightness change characteristics of pixels on the common object plane, and performing secondary rendering of the illumination of the color rendering image based on the light source position to obtain the first three-dimensional image of the object.

2. The method for transforming three-dimensional objects in two-dimensional images based on virtual reality according to claim 1, It is characterized in that Before scaling the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object, the method further includes: The first object feature is matched with the second object feature to obtain a transformation matrix of the second object feature relative to the first object feature; and the three-dimensional point cloud is transformed according to the transformation matrix to obtain a transformed three-dimensional point cloud, and the transformed three-dimensional point cloud corresponding to the three-dimensional object is obtained from the transformed three-dimensional point cloud.

3. The method for transforming three-dimensional objects in two-dimensional images based on virtual reality according to claim 1, It is characterized in that The scaling process is performed on the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object; The stereo image corresponding to the scaled 3D point cloud is reduced in dimension and mapped into a 2D image, including: When the user's operation instruction for the three-dimensional object is a reduction instruction, obtaining an image area that is vacant after the three-dimensional object is reduced relative to before the reduction; Acquire a residual point cloud of a neighboring object associated with the image region, and fill in the residual point cloud according to a structural rule of the neighboring object to obtain a three-dimensional point cloud of the neighboring object, render the three-dimensional point cloud of the neighboring object into a second three-dimensional image according to pixel distribution in the neighboring object or according to pixel distribution of objects of the same type, reduce the dimension of the rendered second three-dimensional point cloud into a two-dimensional map, and map it to a corresponding area in the two-dimensional image; The three-dimensional point cloud corresponding to the three-dimensional object is reduced, and the reduced three-dimensional point cloud is rendered into a third three-dimensional image according to the pixel distribution in the two-dimensional image. The rendered third three-dimensional image is reduced to a two-dimensional map and mapped to the area corresponding to the three-dimensional object in the two-dimensional image.

4. The method for transforming three-dimensional objects in two-dimensional images based on virtual reality according to claim 3, It is characterized in that The step of rendering the reduced three-dimensional point cloud into a third three-dimensional image according to the pixel distribution in the two-dimensional image includes: Perform color rendering on the reduced three-dimensional point cloud according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image; The illumination direction is calculated according to the illumination distribution characteristics of the three-dimensional object before reduction, and the light source position is estimated according to the illumination direction, wherein the illumination distribution characteristics include: one or a combination of shadow direction characteristics, shadow length characteristics, and pixel brightness change characteristics of the common object plane, The illumination of the color rendering image is rendered again based on the light source position to obtain a third three-dimensional image of the object.

5. A device for transforming three-dimensional objects in two-dimensional images based on virtual reality. It is characterized in that The device comprises: An acquisition module is used to acquire a three-dimensional point cloud corresponding to a two-dimensional image and a three-dimensional object that needs to be scaled in the two-dimensional image; the acquisition module is specifically used to: capture the corresponding three-dimensional point cloud when capturing the two-dimensional image, or, based on the three-dimensional object selected according to the user's operation instruction, extract a first object feature contained in the two-dimensional image area corresponding to the three-dimensional object; and extract each object feature subset contained in the three-dimensional point cloud; select an object feature subset matching the first object feature according to the matching degree between the first object feature and each object feature subset, use the object feature subset as the second feature, and acquire the three-dimensional point cloud corresponding to the three-dimensional object according to the distribution range of the second feature, wherein the first object feature and the second object feature respectively include: one or a combination of an edge, an inflection point, and a proportional relationship; A mapping module is used to scale the three-dimensional point cloud corresponding to the three-dimensional object according to the user's operation instruction for the three-dimensional object; reduce the dimension of the stereoscopic image corresponding to the scaled three-dimensional point cloud and map it to the two-dimensional image; specifically includes: when the user's operation instruction is a zoom-in instruction, the enlarged three-dimensional point cloud is rendered as a first three-dimensional image of the object according to the pixel distribution in the two-dimensional image, and the first three-dimensional image of the object is reduced to a two-dimensional map and mapped to the corresponding position in the two-dimensional image; the rendering of the enlarged three-dimensional point cloud as the first three-dimensional image of the object according to the pixel distribution in the two-dimensional image includes: color rendering the enlarged three-dimensional point cloud according to the pixel distribution of the three-dimensional object in the two-dimensional image to obtain a color rendering image; calculate the illumination direction according to the illumination distribution characteristics of the three-dimensional object before zooming in, and estimate the light source position according to the illumination direction, wherein the illumination distribution characteristics include: one or a combination of shadow direction characteristics, shadow length characteristics, and pixel brightness change characteristics of the common object plane, and the illumination of the color rendering image is secondary rendered based on the light source position to obtain the first three-dimensional image of the object.

6. The device for transforming three-dimensional objects in two-dimensional images based on virtual reality according to claim 5, It is characterized in that The device also includes a matching module, which is used to: The first object feature is matched with the second object feature to obtain a transformation matrix of the second object feature relative to the first object feature; and the three-dimensional point cloud is transformed according to the transformation matrix to obtain a transformed three-dimensional point cloud, and the transformed three-dimensional point cloud corresponding to the three-dimensional object is obtained from the transformed three-dimensional point cloud.