Pixel perspective estimation and refinement in images

The neural network model is used to determine the pixel perspective direction and normal direction in the image, which solves the difficulty of estimating the main direction of outdoor images and noise problems in the existing technology, and achieves more accurate pixel direction marking and image processing effects.

CN118570322APending Publication Date: 2024-08-30FACE CUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410215254.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-02-28
Filing Date
2024-02-27
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing pixel coordinate estimation models, such as FrameNet, are difficult to accurately estimate the main direction of pixels in outdoor images, and are prone to noise and jitter problems due to their dependence on local information.

Method used

A neural network model is used to handle indoor and outdoor situations by determining the perspective and normal directions of each pixel in the image, refining the pixel main direction based on global normalized information, and using 2D vanishing point estimation to generate virtual features. images, providing more accurate pixel orientation labeling.

Benefits of technology

Improved visual quality of image processing, reduced noise and jitter, accurate determination of pixel orientation in indoor and outdoor images, suitable for still images, video and augmented reality applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570322A
    Figure CN118570322A
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to pixel perspective estimation and refinement in an image. A method and network for refining pixels in an image is provided. The method includes determining a principal direction of pixels in the image and determining a normal direction of pixels in the image. The method further includes segmenting a region in the image into one or more horizontal regions and one or more vertical regions based on a normal direction of the pixels, and obtaining global normalization information of the image from the segmented regions. The method further includes refining a principal direction of pixels in the image based on the global normalization information. A method for determining a perspective direction of a pixel in an image is also provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments described herein generally relate to image synthesis in computer vision and graphics. More specifically, embodiments described herein relate to determining pixel directions in an image and refining the pixel directions using a neural network. Background Art

[0002] Current state-of-the-art models for pixel coordinate estimation, such as pixel perspective direction, cannot estimate the main direction of pixels in indoor and outdoor images. For example, FrameNet (Huang et al., FrameNet: A Local Canonical Framework for Learning 3D Surfaces from a Single RGB Image, arXiv, 2019, (arxiv.org / pdf / 1903.12305.pdf, accessed on January 16, 2023)) is a neural network model that can be used to predict per-pixel features, such as three-dimensional orthogonal coordinates, such as a canonical framework represented by three orthogonal axes (in the normal direction and two on its tangent plane). However, without wishing to be bound by theory, because FrameNet uses a dataset with a fixed environment, it is easy to collect data on a fixed environment, for example, from the reconstruction of indoor environments with strong correlation / deviations with larger planar surfaces (such as walls and floors), the main direction of the pixel and the ground truth are poorly estimated for wild images (such as outdoor and natural images). In addition, since the estimation of the main direction in the FrameNet model is performed pixel by pixel using local information, the placement of objects in the planar region may be noisy, such as jitter. This kind of noise or jitter may result because FrameNet ignores the use of strong global correlation based on the main direction of the global center of gravity of the image. Summary of the invention

[0003] Features of the embodiments disclosed herein provide a neural network framework or model that is configured to determine the perspective direction of each pixel in an image, which can be used to process indoor and outdoor images. In one embodiment, the neural network model can be configured to determine the three-dimensional main direction for each pixel in the image, specifically, the horizontal main direction [x∈SO3] and the vertical main direction [y∈SO3] and / or the normal direction. The neural network model can also be configured to generate a reference true value label for the main direction and / or normal direction of the field image, which can be used to train the neural network. In this way, the neural network model can be configured to determine the perspective direction and / or main direction from any type of image (including but not limited to indoor images, outdoor images, and natural images), and project the virtual object to anywhere in the image with an appropriate perspective (e.g., the perspective of the pixel (one or more) having the virtual object).

[0004] In one example embodiment, a method for refining pixels in an image is provided. The method may include determining a main direction of pixels in the image and determining a normal direction of pixels in the image. The method may further include segmenting a region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel in the segmented region, and obtaining global normalization information of the image from the segmented region. The method may also include refining the main direction of pixels in the image based on the global normalization information.

[0005] In another example embodiment, a method for determining a perspective direction of pixels in an image is provided. The method may include receiving an image and generating a two-dimensional geometric region for an object in the image using a two-dimensional vanishing point estimate. The method may also include determining a virtual intrinsic for each geometric region based on an image size of the object, and determining a normal direction and a principal direction of pixels in the image based on the vanishing point estimate.

[0006] In yet another embodiment, a non-transitory computer-readable medium having computer-executable instructions stored thereon may be provided. The computer-readable medium, when executed, may cause one or more processors to perform operations including: determining a main direction of pixels in an image; determining a normal direction of pixels in the image; segmenting a region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel in the segmented region; obtaining global normalization information of the image from the segmented region; and refining the main direction of pixels in the image based on the global normalization information.

[0007] In yet another embodiment, a neural network for refining pixels in an image may be provided. The neural network may include an imaging module for receiving an image and a prediction module, the prediction module being configured to determine a main direction of each pixel in the image and determine a determined normal direction and an uncertainty level for each pixel in the image. The neural network may also include a refinement module and a rendering module, the refinement module being configured to segment a region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel, obtain global normalization information for the image from the segmented regions, and refine the main direction of each pixel in the image based on the global normalization information, the rendering module being used to render a virtual object in the image having a perspective direction of the pixel. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In the following detailed description, the embodiments are described for illustration only, since various changes and modifications will become apparent to those skilled in the art from the following detailed description. The same reference numerals are used in different drawings to indicate similar or identical items.

[0009] Figure 1An example model for refining pixels in an image, arranged in accordance with at least some embodiments described and detailed herein, is illustrated.

[0010] Figure 2 An example process flow for implementing pixel refinement of pixels in accordance with at least some embodiments described and detailed herein is shown.

[0011] Figure 3 An example process flow for determining a perspective direction for pixels in an image, arranged in accordance with at least some embodiments described and detailed herein, is shown.

[0012] Figure 4 Shown is a method for implementing Figure 3 An example process of the processing flow.

[0013] Figure 5 An example representation of input data modified to have refined pixels produced by a pixel refinement model, arranged in accordance with at least some embodiments described herein, is shown.

[0014] Figure 6 Illustrative computing embodiments are shown in which any of the processes and sub-processes for automatic data generation may be implemented as executable instructions stored on a non-transitory computer-readable medium. DETAILED DESCRIPTION

[0015] In the following detailed description, specific embodiments of the present disclosure are described herein with reference to the accompanying drawings that form part of the description. In this specification and the accompanying drawings, unless the context otherwise dictates, similar reference numerals represent elements that can perform the same, similar or equivalent functions. In addition, unless otherwise specified, the description of each consecutive figure may refer to one or more features from the previous figures to provide a clearer context and a more substantial explanation of the current example embodiment. Nevertheless, the example embodiments described in the detailed description, the accompanying drawings, and the claims are not intended to be restrictive. Other embodiments may be utilized, and other changes may be made without departing from the spirit or scope of the subject matter presented herein. It will be readily understood that, as shown in the overall description and the accompanying drawings herein, the various aspects of the present disclosure may be arranged, replaced, combined, separated and designed in a variety of different configurations, all of which are clearly intended herein.

[0016] It should be understood that the disclosed embodiments are merely examples of the present disclosure, which may be embodied in a variety of forms. Well-known functions or configurations are not described in detail to avoid obscuring the present disclosure in unnecessary detail. Therefore, the specific structural and functional details disclosed herein should not be interpreted as limiting, but merely as a basis for the claims and as a representative basis for teaching those skilled in the art to use the present disclosure in different ways in almost any appropriate detailed structure.

[0017] In addition, the present disclosure may be described in terms of functional block components and various processing steps. It should be understood that such functional blocks may be implemented by any number of hardware and / or software components configured to perform specific functions.

[0018] The scope of the present disclosure should be determined by the appended claims and their legal equivalents, rather than by the examples given herein. For example, the steps detailed in any method claim may be performed in any order and are not limited to the order presented in the claims. In addition, no element is essential to the practice of the present disclosure unless specifically described herein as "critical" or "essential."

[0019] In this specification and detailed description, the following terms may be used in addition to their commonly recognized meanings.

[0020] As used herein, an "image" may refer to a static two-dimensional image, such as a picture image, or a frame from a video or augmented reality stream. The image may then be received by a pixel refinement model, as discussed herein for pixel refinement.

[0021] As used herein, “vanishing point” may refer to a point on an image plane of a perspective object in an image where two-dimensional perspective projections of mutually parallel lines in three-dimensional space appear to converge.

[0022] As used herein, "ground truth" may refer to known or pseudo-known information, e.g., information deemed to be known or true for comparison with predictions or determinations, e.g., for supervised classification to determine accuracy and minimize error.

[0023] As used herein, "principal direction" may refer to the orientation direction of a pixel in an image based on an eigenpoint of the image. Although the principal directions used herein are related to the x-direction and y-direction of a pixel, it should be understood that such disclosure is not intended to limit the scope of the present disclosure. Instead, the principal directions may refer to other directions, including but not limited to other multi-dimensional directions, linear and non-linear directions, spatial or temporal orientation directions.

[0024] As used herein, a "cross product," which may be represented as "x," may refer to a binary operation on two vectors in a three-dimensional oriented Euclidean vector space, where the vectors are perpendicular to two independent vectors, eg, perpendicular to a plane.

[0025] As referred to herein, a "multilayer perceptron" or "MLP" may refer to a feed-forward artificial neural network that can generate a set of outputs from a set of inputs. It should be understood that the characteristics of an MLP may be characterized by several layers of input nodes connected between input and output layers as a directed graph.

[0026] As referred to herein, a “model” or “framework” may refer to software, such as algorithms and / or procedures, hardware or firmware, or any combination thereof, that supports machine learning, natural language understanding, natural language processing, speech identification, computer vision, etc.

[0027] As referred to herein, "images-in-the-wild" may refer to uncontrolled images, rather than images taken in a controlled space with known coordinates, identification, or classification, e.g., a three-dimensional grid aligned with an RGB image, such as images from ScanNet. Images-in-the-wild may include outdoor images or natural images.

[0028] As referred to herein, a "neural network" may refer to a convolutional neural network, which may include a collection of connected units or nodes or MLPs that process data (e.g., signals to the units or nodes), and may include multiple layers, e.g., an input layer, a hidden layer, and an output layer. A neural network may be trained using a deep learning architecture, which may be supervised, semi-supervised, or unsupervised.

[0029] As referred to herein, a "module" may refer to a network, an algorithm, a program, hardware, or any combination thereof that is configured or otherwise provided to perform the recited functions.

[0030] Using features in the embodiments disclosed herein, a pixel refinement model is provided, which is configured to determine the perspective direction of a pixel or each pixel in an image, and refine the pixel principal directions of the pixels in the image to provide enhanced visual quality. As discussed herein, although it is not intended to limit the scope of the present disclosure, in one embodiment, the pixel refinement model may be a neural network, such as a convolutional neural network (CNN), which is configured to determine the principal direction and / or normal direction with a determined uncertainty level of the pixels in the image, which can be applied to indoor images, as well as outdoor images, including natural images. The pixel refinement model can also be configured to employ global information and refine the principal directions of pixels in one or more horizontal and / or one or more vertical regions in the image based on global normalization. In order to improve image processing of outdoor and natural images, a pixel refinement model can be trained from field images, wherein the pixel refinement model can be configured to use a two-dimensional vanishing point detection strategy to generate pseudo-reference ground truth principal directions and normal directions of field images that can be used for such training. As a result, the pixel-refined model is able to provide imaging results with better visual quality and estimation for virtual object insertion with pixel-correct perspective, for example, for virtual advertising placement or animation in still images, videos, or augmented reality applications.

[0031] Figure 1An example system is shown in which a pixel refinement model 100 for refining pixels in an image may be implemented, the pixel refinement model being arranged according to at least some of the embodiments described and detailed herein. The pixel refinement model 100 may be a neural network for image processing, such as a convolutional neural network, which may include generating and / or determining pixel perspective, pixel orientation, ground truth, and pixel refinement. The pixel refinement model 100 may also be configured to insert virtual objects (one or more) in the image. In one embodiment, the pixel refinement model 100 may be based on the EfficientNet framework, as taught by Bae et al. in Estimating and Exploiting Aleatoric Uncertainty in Surface Normal Estimation, arXiv:2109.09881, 2021 (https: / / doi.org / 10.48550 / arXiv.2109.09881, accessed on January 16, 2023), which is incorporated herein by reference. Once the pixel refinement model 100 has been trained, the pixel refinement model 100 may be deployed for inference. In one example embodiment, the pixel refinement model 100 may be implemented on an electronic device (e.g., a graphics processing unit (“GPU”), a central processing unit (“CPU”), or other processor-enabled device (e.g., Figure 6 600, etc.), which may be a cloud-based network, a local device or downloaded to a local device, a server, a smart phone, a tablet computer, a laptop computer, a desktop computer, and / or any other suitable electronic device. Although illustrated as discrete components, various components may be separated into additional components, combined into fewer components, or eliminated together, and are expected to be within the scope of the disclosed subject matter. Those skilled in the art will understand that each function and / or operation of a component may be implemented individually and / or collectively by various hardware, software, firmware, or any combination thereof.

[0032] like Figure 1 As shown, the pixel refinement model 100 includes an imaging module 110, a prediction module 120, a refinement module 130, and a rendering module 140. The imaging module 110 may be configured to receive input data from a source. In an example embodiment, the source may be an electronic device (e.g., Figure 6600, etc.), including but not limited to cameras, video recorders, smart phones, tablet computers, laptop computers, desktop computers and / or any other suitable electronic devices. In another example embodiment, the source may be a memory, a database, a file, etc. The source may provide input data to the pixel refinement model 100. In an example embodiment, the input data may include an image, such as a static image or frame (one or more) from a video, an augmented reality video stream, etc., which is captured, generated, obtained, input by a user, etc., or stored in a source, and the image may be two-dimensional or three-dimensional. The image may be transmitted or otherwise transmitted from the source to the receiving component of the imaging module 110 via a wired or wireless network. Such a network may be considered as a medium provided as a two-way communication link between the imaging module 110 and the source. The network may include the Internet, a local area network (AN), a wide area network (WAN), a local interconnect network (LIN), a localized cloud, etc. In addition, any algorithm or program described, detailed or suggested herein may be executed by one or more processors on the input device source.

[0033] The imaging module 110 may refer to one or more components or modules designed, programmed, or otherwise configured to receive and process an image. In an example embodiment, the imaging module 110 may be configured to extract features, such as objects, surfaces, etc., from an image. In one embodiment, the prediction module 120 may include an encoder-decoder framework including a pixel-wise multilayer perceptron (MLP) trained on a subset of pixels selected based on estimated uncertainty (e.g., the level or value of uncertainty of the predicted value / coordinate). For example, in one embodiment, the imaging module 110 may include a convolutional encoder-decoder with a jump connection, such as a neural network, which generates multiple feature maps from an image (e.g., from a single RGB image). Multiple feature maps may be generated at different resolutions, such as low resolution, such as 1 / 8 resolution, 1 / 4 resolution, 1 / 2 resolution, etc. In one embodiment, a bin-width estimation block may be used to globally process scene information, where the bin width may vary based on the predicted depth range of the image. The imaging module 110 may then be configured to output a single-channel h×w depth image, for example, at half the spatial resolution.

[0034] The prediction module 120 may refer to one or more components or modules that are designed, programmed, or otherwise configured to determine one or more of a normal direction with uncertainty (e.g., aleatory uncertainty) and a main direction of a pixel or each pixel in an image. In one embodiment, the prediction module 120 may be configured to simultaneously determine the normal direction and the main direction (one or more). Although specific embodiments of methods or models configured to determine normal directions and main directions with uncertainty levels are discussed below, it should be understood that other methods or models may be used to determine the normal direction and the main direction, such as FrameNet. In one embodiment, the prediction module 120 may include a convolutional layer (one or more) that receives a feature map (one or more) from the imaging module 110 and is configured to make a coarse prediction and / or a fine prediction of, for example, a normal direction, uncertainty, a main direction (e.g., an x ​​direction and a y direction) for pixels in the image. In one embodiment, a 3×3 convolutional layer may be used to make a coarse prediction (one or more) from a 1 / 8 resolution feature map, where a training loss is applied to all pixels. The prediction module 120 may then be configured to pass the coarse prediction through a pixel-by-pixel refinement module configured to make a prediction of size (H / 2n×W / 2n) and output a refined prediction of size (H / n×W / n). In one embodiment, the prediction module 120 may be configured to bilinearly upsample both the prediction and the feature map by a factor of 2, select a subset of pixels based on uncertainty during training, and estimate the refined output of the sampled pixels using an MLP with three hidden layers, each hidden layer having 128 nodes and a non-linear activation function, such as a rectified linear unit (ReLU) activation. The input to the MLP may be a concatenated vector of pixel-by-pixel features and predictions. In one embodiment, during training, the loss may be calculated only for the sampled pixels, but at test time or inference, the trained MLP is applied to all pixels.

[0035] In one embodiment, the prediction module 120 may be trained based on training data including in-the-wild images, as discussed further below, where ground truth normals (and / or principal directions) may be compared to predicted normals (and / or principal directions) with associated prediction uncertainty levels to minimize a training loss and / or error for all perspective directions of pixels in the image. In one embodiment, the prediction module 120 may be configured to determine a per-pixel surface normal probability distribution by minimizing the negative log-likelihood (NLL) of the ground truth, where the training loss may be written as:

[0036]

[0037] where p i (n i|I) is the surface normal probability distribution, i is the pixel index, and I is the input image, θ i is the set of parameters estimated by the weight network W, is the NLL of the ground truth value, and N is the number of pixels with the ground truth value.

[0038] In one embodiment, the angle error may be minimized while attenuating the loss of pixels with high uncertainty, where the angle error may be expressed as:

[0039]

[0040] where μ i is the average direction, k i is the concentration parameter, and n i and μ i is a unit vector, and k i ≥ 1, which can be used as a measure of pixel-by-pixel aleatoric uncertainty.

[0041] It should be understood that although the above description has been described for surface normals, the same determination process can also be used for other coordinate directions of three-dimensional processing, such as the x-direction and the y-direction, or any of the methods for principal direction determination described herein.

[0042] In one embodiment, prediction module 120 may be configured to determine a dominant direction of pixels in an image.

[0043] In an example embodiment, prediction module 120 may be configured to estimate the three-dimensional orientation of a pixel or each pixel in the image based on the vanishing point estimation using perspective patches (one or more) generated for the planar surfaces of the object (one or more) in the image. In one embodiment, a virtual intrinsic may be estimated for the perspective patches of the object in the image, for example based on contour segments, and pixels in the perspective patches may be connected to the virtual intrinsics, for example to provide pixel perspective with respect to the vanishing point for the object. In one embodiment, the virtual intrinsic may be defined as a pixel with coordinates [c x ,c y ] at the center of the object or image, with a 45 degree field of view as the focal length.

[0044] In an example embodiment, the prediction module 120 may be configured to determine the three-dimensional angle between the two contour segments by normalizing the two-dimensional angle based on a preset camera focal length parameter. That is, the corresponding three-dimensional direction may be added to the target frame by the preset camera focal length parameter. For example, the focal length parameter of the camera is f, the target vanishing point includes a target horizontal vanishing point and a target vertical vanishing point, the target horizontal vanishing point is represented as P1=(p1x, p1y), the target horizontal vanishing point is represented as P2=(p2x, p2y), the three-dimensional angle corresponding to P1 is P1_3d, and the three-dimensional angle corresponding to P2 is P2_3d, such that:

[0045] P1_3d=(p1x,p1y,f) / |(p1x,p1y,f)|

[0046] P2_3d=(p2x,p2y,f) / |(p2x,p2y,f)|

[0047] In this way, the prediction module 120 can be configured to use the two three-dimensional directions obtained above by the orthogonal constraint to obtain the corresponding three-dimensional direction of the pixel or each pixel to estimate the perspective direction of the pixel, for example, determine the x-main direction and y-main direction of the pixel in the image, for example, the horizontal direction and the vertical direction.

[0048] In another embodiment, the prediction module 120 may be configured to calculate, for a pixel p=(p x ,p y ), the three-dimensional direction (one or more) of the pixel is represented as P = (p x d,p y d,d), where d is the depth value. To analyze the projection of two tangent principal directions (e.g., i and j), the endpoints P and P+δ·i are connected to the line segment l(P,δ,i) in the image as l p (P,δ,i), which is the offset of the projection from P to P+δi:

[0049]

[0050] In one embodiment, given l p * (P,i)=(l i x ,l i y ) prediction, so that the direction can be calculated by solving the following equation as i = (i x ,i y ,i z ):

[0051]

[0052]

[0053]

[0054] The refinement module 130 may refer to one or more components or modules designed, programmed or otherwise configured to refine the pixel main direction of the pixel or each pixel in the image. In an example embodiment, the refinement module 130 may be configured to refine or modify the pixel coordinates of the pixel based on global normalization. In one embodiment, the global normalization may be based on the gravity direction in the image, which may be estimated from the y direction of the pixel. In one embodiment, the refinement module 130 may be configured to segment the image into one or more horizontal regions and / or one or more vertical regions. For example, the pixels may be grouped in one or more horizontal regions and / or one or more vertical regions based on the vertical main direction of the pixel (e.g., y direction). In one embodiment, if the inner product of the y direction and the normal direction is large, for example, greater than 35 degrees, the pixel may be considered to belong to the horizontal region. In one embodiment, if the inner product of the y direction and the normal direction is very small, for example, close to 90 degrees, for example, ±5 degrees, the pixel may be considered to belong to the vertical region. In this way, pixels belonging to the horizontal region and pixels belonging to the vertical region may be segmented together, for example, grouped together.

[0055] In one embodiment, if the image includes a predetermined amount of horizontal regions (one or more), the refinement module 130 may be configured to estimate the gravity direction by averaging the y-direction for each pixel in the segmented regions of the horizontal regions (one or more). In an example embodiment, the y-direction average may be a weighted average determined based on the uncertainty of each pixel, as described above. In one embodiment, the predetermined amount or percentage of horizontal regions may be greater than 20%, 30%, or 40% of the image.

[0056] In one embodiment, when the image does not include a predetermined amount of horizontal region(s), refinement module 130 may be configured to estimate the gravity direction based on the vertical region(s). For example, since prediction module 120 has determined the y direction of each pixel, refinement module 130 may be configured to estimate the gravity direction by taking a weighted average of the y directions of each pixel in the vertical region(s).

[0057] In one embodiment, based on the estimated gravity direction, the refinement module 130 may be configured to employ such global information, e.g., the gravity direction, and refine the principal directions of the pixels in the image, e.g., by performing a cross product with the pixel coordinates. In an example embodiment, the refinement module 130 may be configured to refine the pixels in the vertical region of the image by using the gravity direction as the vertical principal direction of the pixel (e.g., the y direction) and using n×g as the horizontal principal direction (e.g., the x direction), where n is the normal direction of the pixel. The refinement module 130 may also be configured to refine the principal directions (e.g., the pixel coordinates) of the pixels in the horizontal region of the image as the cross product of the determined principal directions x*, y*, e.g., determined by the prediction module 110, according to the following equation:

[0058] x=y * ×g,

[0059] y=x * ×g.

[0060] That is, the refinement module 130 can be configured to estimate the gravity direction based on the segmentation of at least one of the horizontal region or the vertical region to apply global regularization to each pixel, which not only produces more regularized pixels, e.g., less jitter, but also improves image quality, particularly for field images, including outdoor images and natural images.

[0061] The rendering module 140 may refer to one or more components or modules designed, programmed, or otherwise configured to insert virtual objects in an image. In one embodiment, based on the refined pixel coordinates (e.g., pixel direction), the rendering module 140 may be configured to insert a virtual object with good visual quality in the image, which is adjusted to follow the perspective of an object on a plane surface, for example. For example, advertisements, virtual props, dynamic images, characters, etc. can be dynamically inserted anywhere in the image at different object locations, and based on the main direction of the object pixels, the virtual object will have the same or similar perspective to improve image quality and virtual object placement.

[0062] Thus, while current state-of-the-art models for per-pixel coordinate estimation (such as FrameNet) cannot estimate the main direction of outdoor images, the pixel refinement model described and discussed herein can be used to process both indoor and outdoor images. In an embodiment, as discussed herein, at least because the pixel refinement model employs global normalization and can be trained from wild images labeled with ground truth or pseudo-ground truth, the pixel refinement model is able to provide imaging results with better visual quality and virtual object insertion estimates with correct pixel perspective, for example, for virtual advertisement placement or animation in static images, videos, or augmented reality applications, without jitter effects as in FrameNet.

[0063] Figure 2 Shows that according to at least Figure 1 An example process flow for implementing the pixel refinement model 100 of an embodiment of the present invention is described and described herein. As shown, the process flow 200 includes operations or sub-processes performed by various components of the pixel refinement model 100, which includes combining Figure 1 The prediction module 120 and refinement module 130 are shown and described. However, the process flow 200 is not limited to such components and processes, as obvious modifications may be made by reordering two or more of the sub-processes described herein, eliminating at least one of the sub-processes, adding additional sub-processes, replacing components, or even having various components assume sub-processing roles consistent with other components in the following description.

[0064] Processing flow 200 may include various operations, functions, or actions, as shown in one or more of blocks 210, 220, 230, 240, 250, and 260. These various operations, functions, or actions may correspond, for example, to software, program code, or program instructions executable by a processor that enable the functions to be performed. Processing may begin at block 210.

[0065] At block 210 (Input Image), an image may be received or otherwise input into a pre-trained pixel refinement model (e.g., 100). The pixel refinement model (e.g., 100) may be used on an electronic device (e.g., Figure 6 600) is implemented, designed, stored, executed, performed, or otherwise hosted in. In block 210, an encoder and / or MLP can be used to extract features such as objects, surfaces, etc. from an image. In one embodiment, multiple feature maps can be generated from an image. Multiple feature maps can be generated at different resolutions, such as low resolution, such as 1 / 8 resolution, 1 / 4 resolution, 1 / 2 resolution, etc. In one embodiment, an interval width estimation block can be used to process scene information from multiple feature maps, where the interval width changes based on the predicted depth range of the image. In this way, in block 210, a single-channel h×w depth image with, for example, half the spatial resolution can be output. Processing can proceed to blocks 220 and 230.

[0066] At block 220 (determine principal directions), principal directions of each pixel in the image may be determined, such as the x-direction and the y-direction, which may represent a pair of orthogonal directions in three-dimensional space. The principal directions may follow the principal curvatures of the surface of the object in the image, for example, calculating the tangent principal directions. In one embodiment, a four-way rotationally symmetric orientation field may be used, so that there are four valid choices for the tangent principal directions at each vertex, because any pair of orthogonal tangent vectors in the intersection field may be selected to represent the principal directions, and these three alternatives may be used for valid ground truth values.

[0067] In one embodiment, at block 220, the main direction may be estimated by using a vanishing point estimate of a perspective block (one or more) of (one or more) objects in the image. In one embodiment, a contour segment may be used to determine the perspective block (one or more) of an object in the image and estimate a virtual intrinsic of the perspective block. Each pixel in the perspective block may be connected to a virtual intrinsic, for example, to form a vanishing point for the object. The three-dimensional angle between two contour segments may be determined on the basis of the two-dimensional angle by a normalized calculation based on a preset camera focal length parameter. That is, the corresponding three-dimensional direction may be added to the target frame by the preset camera focal length parameter. For example, the focal length parameter of the camera is f, the target vanishing point includes a target horizontal vanishing point and a target vertical vanishing point, the target horizontal vanishing point is represented as P1=(p1x, p1y), the target horizontal vanishing point is represented as P2=(p2x, p2y), the three-dimensional angle corresponding to P1 is P1_3d, and the three-dimensional angle corresponding to P2 is P2_3d, such that:

[0068] P1_3d=(p1x,p1y,f) / |(p1x,p1y,f)|

[0069] P2_3d=(p2x,p2y,f) / |(p2x,p2y,f)|

[0070] In this way, the two three-dimensional directions obtained by the orthogonal constraint above can be used to obtain the corresponding three-dimensional direction of each pixel to estimate the perspective direction of each pixel, such as determining the x-main direction and the y-main direction, such as the horizontal direction and the vertical direction for each pixel in the image.

[0071] In another embodiment, the pixel p in the canonical camera coordinate system can be represented by x ,p y ) represents the three-dimensional position of the pixel as P = (p x d,p y d,d) to estimate the main direction, where d is the depth value. To analyze the projection of two tangent main directions (for example, i and j), connect the endpoints P and P+δ·i to the line segment l(P,δ,i) in the image as l p (P,δ,i), which is the offset of the projection from P to P+δi:

[0072]

[0073] In one embodiment, given l p * (P,i)=(l i x ,l i y ) prediction, so that the direction can be calculated by solving the following equation as i = (i x,i y ,i z ):

[0074]

[0075]

[0076]

[0077] Although specific embodiments of determining the principal direction have been discussed herein, it should be understood that other methods or models may be used to determine the principal direction. In this way, the coordinates of a pixel in a canonical camera coordinate system and the corresponding principal direction may be determined.

[0078] At block 230 (determine normal direction with uncertainty), a convolutional layer(s) may be used that receives the feature map(s) and is configured to make coarse predictions and / or fine predictions for, for example, normal directions, uncertainties, principal directions (e.g., x-direction and y-direction). In one embodiment, a 3×3 convolutional layer may be used to make coarse predictions(s) from a 1 / 8 resolution feature map, with a training loss applied to all pixels. The coarse predictions may be passed through a pixel-by-pixel refinement module that is configured to make predictions of size (H / 2n×W / 2n), and the output is a refined prediction of size (H / n×W / n). In one embodiment, the predictions and feature maps may be bilinearly upsampled by a factor of 2; and during training, a subset of pixels may be selected based on uncertainty, and a refined output of the sampled pixels may be estimated using an MLP with three hidden layers, each having 128 nodes and a nonlinear activation function, e.g., a rectified linear unit (ReLU) activation. The input to the MLP may be a concatenated vector of pixel-by-pixel features and predictions. In one embodiment, during training, the loss may be calculated only for sampled pixels, but at test time or inference, the trained MLP is applied to all pixels.

[0079] In another embodiment, the normal direction can be determined using surface normal estimation using a UNet architecture, such as a fully convolutional neural network (6 down / 6 up) with angle and L1 loss, light 2D data augmentation, and input resolution, which can be between 256 and 512. Adam, a first-order gradient-based stochastic objective function optimization algorithm based on adaptive estimation of low-order moments (see https: / / arxiv.org / abs / 1412.6980 (accessed on February 22, 2023)) with LR 10 can also be used. -4 and weight decay 2×10 -6 .

[0080] In one embodiment, training of the system may be based on training data including in-the-wild images, as discussed further below, where ground truth normals (and / or principal directions) may be compared to predicted normals (and / or principal directions) with associated prediction uncertainties to minimize training loss and / or error for all perspective directions for each pixel in the image. In one embodiment, uncertainty may be predicted based on a per-pixel surface normal probability distribution, e.g., using a von Mises distribution or an adaptation / modification thereof, uncertainty may be determined by minimizing the negative log-likelihood (NLL) of the ground truth, where the training loss may be written as:

[0081]

[0082] where p i (n i |I) is the surface normal probability distribution, i is the pixel index, and I is the input image, θ i is the set of parameters estimated by the weight network W, is the NLL of the ground truth value, and N is the number of pixels with the ground truth value.

[0083] In one embodiment, the angular error may be minimized while attenuating the loss of pixels with high uncertainty, where the angular error or uncertainty may be expressed as:

[0084]

[0085] where μ i is the average direction, k i is the concentration parameter, and n i and μ i is a unit vector, and k i ≥ 1, which may be used as a measure of pixel-by-pixel aleatoric uncertainty. Processing may proceed to block 240.

[0086] In block 240 (Segmentation of vertical and horizontal regions), the image may be segmented into one or more horizontal regions and / or one or more vertical regions. For example, pixels may be grouped in one or more horizontal regions and / or one or more vertical regions based on the vertical main direction of the pixels (e.g., the y direction). In one embodiment, if the inner product of the y direction and the normal direction is large, e.g., greater than 35 degrees, the pixel may be considered to belong to the horizontal region. In one embodiment, if the inner product of the y direction and the normal direction is very small, e.g., close to 90 degrees, the pixel may be considered to belong to the vertical region. In this way, pixels belonging to the horizontal region and pixels belonging to the vertical region may be segmented together, e.g., grouped together. Processing may proceed to block 250.

[0087] At block 250 (calculate gravity for image), the direction of gravity may be estimated or determined by averaging the y-direction for each pixel in the segmented regions of the horizontal region(s). In an example embodiment, the y-direction average may be a weighted average determined based on the uncertainty of each pixel, as described above. In one embodiment, the predetermined amount or percentage of the horizontal region may be greater than 20%, 30%, or 40% of the image.

[0088] In one embodiment, when the image does not include a predetermined amount of horizontal region(s), the gravity direction may be estimated or determined based on the vertical region(s). For example, since the y direction has been estimated or determined for each pixel, such as at block 220 and / or block 230, the gravity direction may be estimated or determined by taking a weighted average of the y direction for each pixel in the vertical region(s). Processing may proceed to block 260.

[0089] At block 260 (Refine Main Direction and Valid Overhang Area for Each Pixel), such global information, such as the direction of gravity, may be employed, and the main direction, such as pixel coordinates, may be refined for each pixel in the image. In one example embodiment, for each pixel, the pixels in the vertical region of the image may be refined by using the direction of gravity as the vertical main direction (e.g., replacing the y-direction coordinate) and using n×g as the horizontal main direction (e.g., replacing the x-direction coordinate), where n is the normal direction of the pixel. The main direction of the pixels in the horizontal region of the image (e.g., pixel coordinates) may also be refined by taking the cross product of the estimated main directions x*, y*, such as determined at block 220, according to the following equation:

[0090] x=y * ×g,

[0091] y=x * ×g.

[0092] In one embodiment, in horizontal regions where the pixel is completely horizontal, for example, the gravity direction is close to or the same as the normal direction, since gravity cannot be used to replace the vertical direction of the pixel, the cross product is used to ensure that both directions are perpendicular to the gravity direction.

[0093] After refining each pixel in the image, not only are the pixels more regular, but the image quality is also improved, especially for field images, including outdoor images and natural images, so that virtual objects can be dynamically inserted into any position of different object positions in the image or video (for example, each frame in the video), and based on the main direction of the object pixels, vertical objects will have the same or similar perspective to improve image quality and virtual object placement.

[0094] It should be understood that in one embodiment, after each pixel in an image has been refined, the image with refined pixels can be used during training of a subsequent pixel refinement model to additionally improve estimates of principal directions and normal directions with uncertainty.

[0095] Figure 3 is an example processing flow for determining ground truth information for wild images as described and detailed herein. While indoor datasets are provided in controlled spaces with fixed environments where data is easily collected, such as in FrameNet, such that object classifications, feature maps, 3D meshes, etc. are identified for supervised or semi-supervised training of CNNs, such datasets may provide strong correlations / biases with large planar surfaces such as walls and floors. However, the processing flow discussed herein is provided to determine ground truth information for both indoor and outdoor images, and in particular, for wild images that overcome these shortcomings of using indoor datasets with fixed information. Thus, by training any model using wild images with ground truth information (or pseudo-ground truth, since the ground truth is not determined in a controlled setting), as discussed herein, for example in combination with Figure 1 The pixel refinement model is more robust and can provide a more accurate prediction or estimate of the perspective of each pixel in the image, such as the main direction and / or normal direction with uncertainty, so that a virtual object can be projected anywhere in the image with the appropriate pixel direction perspective. As shown, the process flow 300 includes operations or sub-processes performed by various components and can be implemented in an electronic device such as a graphics processing unit (“GPU”), a central processing unit (“CPU”), or other processor-enabled device (e.g., Figure 6 600, etc.), which may be a cloud-based network, a local device or downloaded to a local device, a server, a smart phone, a tablet computer, a laptop computer, a desktop computer, and / or any other suitable electronic device. However, the process flow 300 is not limited to these components and processes, as obvious modifications may be made by reordering two or more of the subprocesses described herein, eliminating at least one of the subprocesses, adding more subprocesses, replacing components, or even having various components assume subprocessing roles consistent with other components in the following description.

[0096] Processing flow 300 may include various operations, functions, or actions as shown by one or more of blocks 310, 320, 330, and 340. These various operations, functions, or actions may correspond, for example, to software, program code, or program instructions executable by a processor that enable the functions to be performed. Processing may begin at block 310.

[0097] At block 310 (Field Image), an image may be received or otherwise input into a ground truth determination model. The ground truth determination model may be provided on an electronic device (e.g., Figure 6 The image may be a field image, such as an image of an indoor, outdoor, and / or natural environment, which may be captured or generated from an uncontrolled source, such as from a user electronic device (e.g., Figure 6 A user captured photo of a computer program product (e.g., 600) may or may not include identification of features in the photo, such as a feature map, a three-dimensional grid, a classification, etc. At block 310, features such as objects, surfaces, etc. may be extracted from the image using an MLP. In one embodiment, multiple feature maps may be generated from the image. Multiple feature maps may be generated at different resolutions. Processing may proceed to block 320.

[0098] At block 320, the ground truth determination model may be configured to express the shooting angle in the image, such as the camera angle, using vanishing point estimation. Vanishing point estimation may include extracting structural features of objects in the image, as discussed and described herein, by identifying edge corners in the object and generating a structural framework representing the plane outline of the object and forming a perspective block, as disclosed in Chinese application CN202210761378.8, which is filed as international application PCT / CN2022 / 0XXXX, which is incorporated herein by reference. Vanishing point estimation may be performed automatically on the image or selected by the user.

[0099] like Figure 4 As can be seen, in one embodiment, the reference truth determination model can be configured to obtain contour segments 410 and edge corners 420 in the image, and process multiple vanishing points VP in the image based on the contour segments and the corresponding edge corners. The selected vanishing points may include horizontal vanishing points and vertical vanishing points, which can be obtained by detecting two contour segments corresponding to each edge corner. If the obtained horizontal vanishing point and / or vertical vanishing point is true (i.e., the number of related segments of the vanishing point is greater than a number threshold), the generated horizontal vanishing point and / or vertical vanishing point will estimate the corresponding formed vanishing point (s) for the perspective block (s) through the edge corners.

[0100] In one example embodiment, the vanishing point estimation for expressing the shooting angle may include:

[0101] 1) Obtain contour segments 410, and obtain corresponding edge corners 420 based on the contour segments 410, wherein the contour segments 410 represent the contour of the object (one or more) in the image to be detected, and the edge corners 420 are the intersections between the contour segments 410. In one embodiment, the contour segments 410 may all be straight line segments, which represent the contour of the object in the image to be processed after the target object is detected. There may be multiple contour segments 410 in the image, and the extension direction 415 of each contour segment 410 may be the same or different according to the specific object structure. Among them, some contour segments 410 may intersect, and the corners where the contour segments intersect may be the edge corners 420. According to the positional relationship between the contour segments 410, the intersection points between the contour segments can be determined, for example, the edge corners 420 are determined by the intersection relationship of the contour segments 410 representing the contour of the object, so that the structured features of the object can be displayed. Among them, the process of detecting the image to be processed to obtain the contour segments can be obtained by identifying the segments of the image to be processed by a pre-trained neural network model.

[0102] In some embodiments, the endpoints of two contour segments 410 may intersect and coincide with one point (i.e., two contour segments forming an "L" shape). In this case, the edge corner 420 is the coincidence point of the endpoints of the two contour segments 410. In other embodiments, the endpoint of one contour segment 410 intersects with the midpoint of the other contour segment 410 (i.e., the two contour segments form a "T" shape). In this case, the endpoint that intersects the middle of the contour segment is the edge corner 420.

[0103] After obtaining the edge corners 420, for some contour segments 410 that are close to each other, the distances between the corresponding edge corners 420 may also be very close. When generating a structural framework representing the plane contour of the object based on the edge corners, if the area of ​​the structural framework is too small, the edge corners may be merged to reduce the number of edge corners, reduce invalid detection processes, and improve the overall detection speed. For example, the step of obtaining the corresponding edge corner points 420 based on the contour segments 410 may include:

[0104] A) According to the intersection relationship of each contour line segment 410, at least two intersection corners are obtained.

[0105] B) Based on the density clustering algorithm, the intersecting nodes are clustered and merged to generate edge corners 420 .

[0106] In an exemplary embodiment, the intersection relationship of each contour line segment 410 can be realized by an intersection detection algorithm between line segments. Then, the obtained intersection corners can be merged based on a density clustering algorithm so that similar intersection corners are merged into the same corner, i.e., an edge corner 420. Wherein, density clustering is also referred to as density-based clustering. This algorithm assumes that the clustering structure can be determined by the compactness of the sample distribution. Generally, the density clustering algorithm examines the connectivity of the sample from the perspective of sample density, and continuously expands clustering based on the connected samples to obtain the final clustering result. Through the density clustering algorithm, the intersection nodes can be clustered and fused, and only the edge corners (i.e., the edge corners corresponding to the two L-shaped contour line segments) where the endpoints 420 of the two contour line segments 410 intersect and coincide with a point are retained.

[0107] 2) At least two quadrilateral structural frames 430 can be generated through the edge corners 420, and the structural frames 430 represent the contour of the plane of the object (one or more) in the image to be detected. For example, after obtaining the edge corners 420, since the edge corners 420 are generated based on two intersecting contour segments 410, each edge corner 420 corresponds to two contour segments 410. Based on the positional relationship between the contour segments 410 corresponding to one or more edge corners 420, a closed quadrilateral, i.e., the structural frame 430, can be constructed. Because the edge corners 420 can represent the structured features of the object, the quadrilateral structural frame based on the edge corners can represent the contour of the object plane in the image to be detected. Specifically, in one embodiment, by sequentially traversing each edge corner, the L-shaped structure formed by the two contour segments 410 corresponding to the edge corners 420 and the L-shaped structure formed by the two contour segments 410 corresponding to the other edge corners 420 can be combined, and at least two edge corners that can form a closed quadrilateral can be detected, thereby generating the structural frame 430.

[0108] In an example embodiment, implementation may include:

[0109] A) Obtaining a corner structure corresponding to each edge corner 420 , the corner structure comprising two contour line segments 410 forming the edge corner 420 .

[0110] B) Based on the positional relationship between the corner structures corresponding to each edge corner 420, at least one set of corner structure combinations can be obtained, which includes at least one corner structure, and the corner structures in the corner structure combination belong to the same quadrilateral; when the corner structure combination includes more than two corner structures, at least one contour segment of any corner structure in the corner structure combination overlaps with another corner structure.

[0111] C) Based on the corner structure combination, a structural framework can be generated for each object with a related vanishing point VP.

[0112] Processing may proceed to block 330 .

[0113] At block 330, the ground truth determination model may be configured to determine a normal direction ground truth and / or a principal direction ground truth for each pixel in the input data to provide a ground truth label for the object in the image. In an example embodiment, the ground truth determination model may be configured to estimate the three-dimensional direction of each pixel in the object in the image based on a vanishing point estimate using the perspective patch(es). In one embodiment, a virtual intrinsic may be estimated for the perspective patch of each object in the input data, for example based on contour segments, and each pixel in the perspective patch may be connected to the virtual intrinsic. In one embodiment, the virtual intrinsic may be defined as a pixel with coordinates [c x ,c y ] at the center of the object or image, with a 45 degree field of view as the focal length.

[0114] In an example embodiment, the reference truth determination model may be configured to determine the three-dimensional angle between two contour segments by normalizing the preset camera focal length parameters based on the two-dimensional angle. That is, the corresponding three-dimensional direction may be added to the target frame by the preset camera focal length parameters. For example, the focal length parameter of the camera is f, the target vanishing point includes a target horizontal vanishing point and a target vertical vanishing point, the target horizontal vanishing point is represented as P1=(p1x, p1y), the target horizontal vanishing point is represented as P2=(p2x, p2y), the three-dimensional angle corresponding to P1 is P1_3d, and the three-dimensional angle corresponding to P2 is P2_3d, such that:

[0115] P1_3d=(p1x,p1y,f) / |(p1x,p1y,f)|

[0116] P2_3d=(p2x,p2y,f) / |(p2x,p2y,f)|

[0117] In this way, the benchmark truth determination model can be configured to use the two three-dimensional directions obtained above by the orthogonal constraint to obtain the corresponding three-dimensional direction of each pixel to estimate the perspective direction of each pixel, for example, to determine the normal direction and main direction (e.g., x-main direction and y-main direction) of the horizontal and vertical directions of each pixel in the image as the benchmark truth or pseudo-benchmark truth, which can be used to perform benchmark truth marking on objects in images from field images.

[0118] In another embodiment, vanishing points may be used, where two lines are used to obtain a first vanishing point v1, and then a second vanishing point v2 on a great circle of v1 on an equivalent sphere is uniformly sampled, and finally, a third vanishing point v3 may be calculated by the cross product of v1 and v2, for example, as described in "2-Line Exhaustive Search for Real-Time Vanishing Point Estimation in Manhattan World" by Lu et al. (https: / / xiaohulugo.github.io / papers / Vanishing_Point_Detection_WAC V2017.pdf), which is incorporated herein by reference. In one embodiment, v1 and v2 may be horizontal or vertical vanishing points. In one embodiment, a polar coordinate grid constructed by extending unit vectors on an equivalent sphere to intersect the image plane may be used. The equivalent sphere may be a unit sphere centered at the camera focus, where a right-handed coordinate system with an X-axis and a Y-axis is applied to coincide with the X-axis and the Y-axis of the image, respectively, and the Z-axis points from the camera focus to the principal point of the image. Given the principal point (x0, y0) of the image T and focal length f, pixel (x,y) on the image T It can be converted to an equivalent spherical coordinate system using the following formula:

[0119] X=x–x0,

[0120] Y=y–y0,

[0121] Z=f.

[0122] For coordinates (X, Y, Z) T The latitude and longitude (φ, λ) of a 3D point p in the equivalent spherical coordinates of P are calculated as follows:

[0123]

[0124] λ=atan2(X,Y)+π.

[0125] Given a point p on the image plane, the latitude and longitude (φ, λ) on the equivalent sphere can be obtained. Therefore, the polar coordinates C1 can be constructed by the following steps. The polar coordinates C1 can be zero-initialized with a size of 90×360 and an accuracy of 1 degree, for example, for i=1,2,…,90 and j=1,2,…,360, C1(i,j)=0. Then, for each pair of line segments l1 and l2 on the image, their intersection p can be calculated, and then the latitude and longitude (φ,λ) of p can be obtained. Then, the corresponding grid cell C1(φ) can be updated deg ,λ deg ).

[0126] In one embodiment, a 2-line minimum solution set (MSS) may be used to generate a hypothesis of only the first vanishing point, then exhaustively sample the second vanishing point, and generate the third vanishing point via the first and second vanishing points. For example, first, two line segments may be randomly selected to intersect to generate the first vanishing point v1. Then, the second vanishing point v2 may be uniformly sampled on the great circle of v1 in the equivalent sphere. Finally, the third vanishing point v3 may be calculated by the cross product of v1 and v2. It should be understood that v3 may be the normal direction, while v1 and v2 are the x and y directions.

[0127] Processing may proceed to block 340 .

[0128] At 340, images (including wild images) may be provided to train any model, the images having ground truth labels, such as normal and perspective ground truth, as described herein. Thus, instead of using only indoor images to train a model with a fixed environment (such as in FrameNet), where data is easy to collect, the model may be provided with such additional training data as described herein, thereby providing a more robust model capable of refining pixels in all types of images, such as indoor images, outdoor images, and / or natural images, particularly wild images.

[0129] It should be understood that at 320, although the use of perspective blocks for vanishing point estimation has been discussed herein, it should be understood that other methods may be used to determine the perspective blocks (one or more) of the object in the image. In some embodiments, the perspective blocks (one or more) may be marked by user marking. During the user marking process, the user may identify and mark the perspective blocks (one or more) in the field image. The perspective blocks (one or more) may be any geometric shape that identifies the plane of the object, such as a quadrilateral, rectangle, hemisphere, trapezoid, etc. In some embodiments, the user marking may also include determining the reference true value marking for the normal direction and the main direction.

[0130] Figure 5 An example 500 is illustrated, which includes the output of a pixel refinement model and its process flow (eg, Figure 1 100 or Figure 2 of 200).

[0131] Figure 5 The pixel refinement model described herein can refine each pixel in an image, including images of outdoor or natural environments. As shown by the horizontal and vertical perspective lines or coordinates (510, 515), the pixel refinement model (e.g., Figure 1 100 or Figure 2200) has been configured to apply global normalization to each pixel by taking the cross product of the gravity direction with the pixel direction in the vertical region and the horizontal region, as described above. In this way, the pixel refinement model may have been trained to refine each pixel using global normalization so that the image has better visual quality and pixel perspective direction determination to improve the placement of virtual objects anywhere in the image so that the inserted virtual objects will have the correct pixel perspective.

[0132] Figure 6 FIG. 6 is a schematic block diagram of an example computer system 600 suitable for implementing an electronic device (eg, a GPU or a CPU) arranged in accordance with at least some embodiments described herein. It should be understood that Figure 6 The computer system shown is for illustration only and is not intended to limit the functionality and applicability of the embodiments described herein.

[0133] As shown, the computer system 600 may include a central processing unit (CPU) 605. The CPU 605 may perform various operations and processes based on a program stored in a read-only memory (ROM) 610 or a program loaded from a storage device 640 to a random access memory (RAM) 615. The RAM 615 may also store various data and programs required for the operation of the system 600. The CPU 605, the ROM 610, and the RAM 615 may be connected to each other via a bus 620. An input / output (I / O) interface 625 may also be connected to the bus 620.

[0134] The components connected to the input / output interface 625 may further include an input device 630 including a keyboard, a mouse, a digital pen, a drawing tablet, etc.; an output device 635 including a display such as a liquid crystal display (LCD), a speaker, etc.; a storage device 640 including a hard disk, etc.; and a communication device 645 including a network interface card such as a LAN card, a modem, etc. The communication device 645 can perform communication processing via a network such as the Internet, a WAN, a LAN, a LIN, a cloud, etc. In one embodiment, a drive 650 may also be connected to the I / O interface 625. A removable medium 655 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. may be installed on the drive 650 as needed, so that a computer program read from the removable medium 655 can be installed in the storage device 640.

[0135] It should be understood that the disclosure and other solutions, examples, embodiments, modules and functional operations described in this document may be implemented in digital electronic circuits, or in computer software, firmware or hardware, including the structures disclosed in this document and their structural equivalents, or in a combination of one or more thereof. The disclosed and other embodiments may be implemented as one or more computer program products, i.e., one or more modules of computer program instructions encoded on a computer-readable medium, for execution by a data processing device or for controlling the operation of the data processing device. The computer-readable medium may be a machine-readable storage device, a machine-readable storage substrate, a storage device, a material combination that implements a machine-readable propagation signal, or a combination of one or more thereof. The term "data processing device" covers all devices, equipment and machines for processing data, including, for example, a programmable processor, a computer or multiple processors or computers. In addition to hardware, the device may include code that creates an execution environment for the computer program in question, for example, code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more thereof.

[0136] A computer program (also referred to as a program, software, software application, script, or code) may be written in any form of programming language, including compiled or interpreted languages, and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for a computing environment. A computer program does not necessarily correspond to a file in a file system. A program may be stored in a portion of a file that holds other programs or data (e.g., one or more scripts stored in a markup language file), in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or portions of code). A computer program may be deployed to execute on one computer or multiple computers located at one location or distributed across multiple locations and interconnected by a communications network.

[0137] The processes and logic flows described in this document may be performed by one or more programmable processors executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows may also be performed by, and the apparatus may also be implemented as, special purpose logic circuitry, such as field programmable gate arrays, application specific integrated circuits, and the like.

[0138] Processors suitable for executing computer programs include, for example, general and special purpose microprocessors, and any one or more processors of any type of digital computer. In general, the processor will receive instructions and data from a read-only memory or a random access memory or both. The basic elements of a computer are a processor for executing instructions and one or more storage devices for storing instructions and data. In general, a computer will also include or be operably coupled to one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, to receive data from or transmit data to them, or both. However, a computer does not need to have such devices. Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and storage devices, including, for example, semiconductor storage devices, such as erasable programmable read-only memory, electrically erasable programmable read-only memory, and flash memory devices; magnetic disks, such as internal hard disks or removable disks; magneto-optical disks; and optical disk read-only memory and digital video disk read-only memory disks. The processor and memory may be supplemented by or incorporated into a dedicated logic circuit.

[0139] It should be understood that different features, variations and multiple different embodiments have been shown and described in various details. What is described in this application according to specific embodiments is for illustrative purposes only and is not intended to limit or imply that only one specific embodiment or multiple specific embodiments are envisioned. It should be understood that the present disclosure is not limited to any single specific embodiment or the variants listed. Many modifications, variations and other embodiments will occur to those skilled in the art, and these modifications, variations and other embodiments are intended to and are in fact covered by the present disclosure. The scope of the present disclosure is actually intended to be determined by the appropriate legal interpretation and explanation of the present disclosure, including equivalents, as understood by those skilled in the art by the complete disclosure presented at the time of submission.

[0140] aspect:

[0141] It should be understood that any aspects may be combined with each other.

[0142] Aspect 1. A method for refining pixels in an image, the method comprising: determining a main direction of pixels in the image; determining a normal direction of pixels in the image; segmenting a region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel in the segmented region; obtaining global normalization information of the image from the segmented region; and refining the main direction of pixels in the image based on the global normalization information.

[0143] Aspect 2. A method according to Aspect 1, wherein determining the main direction of a pixel comprises: generating a two-dimensional geometric shape for an object having the pixel in the image based on a contour segment; providing a virtual intrinsic for each of the objects in the image; and determining the main direction of the pixel of the object in the image based on the virtual intrinsic and the contour segment.

[0144] Aspect 3. The method according to aspect 2, wherein the two-dimensional geometric shape is a quadrilateral.

[0145] Aspect 4. The method of aspect 2, wherein the virtual intrinsic is located at the center of the object and at a focal length at approximately a 45 degree field of view.

[0146] Aspect 5. A method according to any one of Aspects 1-4, wherein the main direction includes an x-direction and a y-direction representing a pair of orthogonal directions in three-dimensional space, and wherein obtaining the global normalization information includes: estimating the gravity direction of the image by averaging the y-direction of each pixel in one or more horizontal regions in the image.

[0147] Aspect 6. The method according to aspect 5, wherein refining the main direction of the pixel comprises: for pixels in one or more vertical regions, replacing the y direction with the estimated gravity direction of the pixel, and replacing the x direction by taking the cross product of the gravity direction and the normal direction of the pixel.

[0148] Aspect 7. A method according to aspect 5, wherein refining the main direction of the pixel comprises: for pixels in the horizontal area, replacing the x direction by taking the cross product of the gravity direction and the determined y direction, and replacing the y direction by taking the cross product of the gravity direction and the determined x direction.

[0149] Aspect 8. A method according to any one of Aspects 1-7, wherein when one or more horizontal regions in an image include less than a predetermined percentage of the total number of one or more horizontal regions and vertical regions, obtaining global normalization includes: estimating the gravity direction of the image by taking the average value in the y direction from pixels in one or more vertical regions.

[0150] Aspect 9. A method according to any one of Aspects 1-8, wherein determining the main direction includes: identifying contour segments in the image; extracting structured features of the object in the image by forming a plane of the structured feature and identifying edge corners of the object from intersections of the contour segments; estimating the vanishing point of each plane of the structured feature; and determining the main direction of each pixel in the plane based on the corresponding vanishing point of each structured feature.

[0151] Aspect 10. A method according to any one of Aspects 1-9, wherein one or more horizontal regions are determined by taking the inner product of the normal direction of the pixel and the y direction of the pixel, wherein when the inner product is greater than 35 degrees, the pixel is determined to be in the horizontal region.

[0152] Aspect 11. A method according to any one of aspects 1-10, wherein one or more vertical regions are determined by taking the inner product of the normal direction of the pixel and the y direction of the pixel, wherein when the inner product is close to 90 degrees, the pixel is determined to be in the vertical region.

[0153] Aspect 12. The method according to any one of aspects 1-11, further comprising: inputting a virtual object in the image based on the refined main direction of the pixels, so that the virtual object follows the perspective orientation of the pixels.

[0154] Aspect 13. A method for determining the perspective direction of pixels in an image, the method comprising: receiving an image; generating two-dimensional geometric regions for objects in the image using two-dimensional vanishing point estimation; determining virtual intrinsics of each geometric region based on the image size of the object; and determining the normal direction and main direction of the pixels in the image based on the vanishing point estimation.

[0155] Aspect 14. The method according to Aspect 13, wherein the two-dimensional geometric region is generated by user marking.

[0156] Aspect 15. The method according to Aspect 13, wherein the two-dimensional geometric region is automatically generated.

[0157] Aspect 16. A non-volatile computer-readable medium having computer-executable instructions stored thereon, wherein the instructions, when executed, cause one or more processors to perform operations, the operations comprising: determining a main direction of pixels in an image; determining a normal direction of pixels in the image; segmenting a region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel in the segmented region; obtaining global normalization information of the image from the segmented region; and refining the main direction of pixels in the image based on the global normalization information.

[0158] Aspect 17. A non-volatile computer-readable medium according to Aspect 16, wherein determining the main direction of a pixel comprises: generating a two-dimensional geometric shape for an object having the pixel in the image based on a contour segment; providing a virtual intrinsic for each of the objects in the image; and determining the main direction of the pixel of the object in the image based on the virtual intrinsic and the contour segment.

[0159] Aspect 18. A non-transitory computer-readable medium according to any one of Aspects 16-17, wherein the main direction includes an x-direction and a y-direction representing a pair of orthogonal directions in three-dimensional space, and wherein obtaining the global normalization information includes: estimating the gravity direction of the image by averaging the y-direction of each pixel in one or more horizontal regions in the image.

[0160] Aspect 19. A non-transitory computer-readable medium according to Aspect 18, wherein refining the main direction of the pixel comprises: for pixels in one or more vertical regions, replacing the y direction with the estimated gravity direction of the pixel, and replacing the x direction by taking the cross product of the gravity direction and the normal direction of the pixel.

[0161] Aspect 20. A non-transitory computer-readable medium according to Aspect 18, wherein refining the main direction of the pixel comprises: for pixels in the horizontal region, replacing the x direction by taking the cross product of the gravity direction and the determined y direction, and replacing the y direction by taking the cross product of the gravity direction and the determined x direction.

[0162] Aspect 21. A neural network for refining pixels in an image, comprising: an imaging module for receiving an image; a prediction module configured to determine the main direction of each pixel in the image, and determine the normal direction of each pixel in the image and a determined uncertainty level; a refinement module configured to segment a region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel, obtain global normalization information of the image from the segmented regions, and refine the main direction of each pixel in the image based on the global normalization information; and a rendering module for rendering a virtual object in the image with a pixel perspective direction.

[0163] The terms used in this specification are intended to describe specific embodiments, not to limit them. Unless expressly stated otherwise, the terms "a", "an" and "the" also include plural forms. The terms "comprises" and / or "comprising" when used in this specification specify the presence of stated features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.

[0164] With respect to the foregoing description, it should be understood that changes may be made to the details, particularly the shapes, sizes and arrangements of the construction materials and parts employed, without departing from the scope of the present disclosure. This specification and the embodiments described are exemplary only, with the true scope and spirit of the present disclosure being indicated by the appended claims.

Claims

1. A method for thinning pixels in an image, the method comprising: determining a main direction of pixels in the image; determining a normal direction of the pixel in the image; Segmenting the region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel in the segmented region; Obtaining global normalization information for the image from the segmented regions; as well as The main directions of the pixels in the image are refined based on the global normalization information.

2. The method of claim 1 , wherein determining the main direction of the pixel comprises: generating a two-dimensional geometric shape for an object having the pixel in the image based on the contour segment; providing virtual intrinsics for each of the objects in the image; as well as Based on the virtual eigenvalues ​​and the contour segments, the principal direction is determined for the pixel in the object in the image. The method of claim 2 , wherein the two-dimensional geometric shape is a quadrilateral.

4. The method of claim 2, wherein the virtual intrinsic is located at the center of the object and at a focal length at approximately a 45 degree field of view.

5. The method according to claim 1, wherein the main direction comprises an x-direction and a y-direction representing a pair of orthogonal directions in a three-dimensional space, and wherein the obtaining of the global normalization information comprises: The direction of gravity for the image is estimated by averaging the y-direction for each pixel in the one or more horizontal regions in the image.

6. The method of claim 5, wherein refining the main direction of the pixel comprises: For the pixels in the one or more vertical regions, the y direction is replaced with the estimated gravity direction for the pixel, and the x direction is replaced by taking a cross product of the gravity direction and the normal direction of the pixel.

7. The method of claim 5, wherein refining the main direction of the pixel comprises: For the pixels in the horizontal region, the x direction is replaced by taking a cross product of the gravity direction and the determined y direction, and the y direction is replaced by taking a cross product of the gravity direction and the determined x direction.

8. The method of claim 1 , wherein when the one or more horizontal regions in the image include less than a predetermined percentage of a total of the one or more horizontal regions and the vertical regions, the obtaining of the global normalization comprises: The direction of gravity for the image is estimated by taking the average of the y-direction for each pixel from the one or more vertical regions.

9. The method of claim 1 , wherein the determining of the primary direction comprises: identifying contour segments in the image; extracting the structured features of the object in the image by forming a plane for the structured features and identifying edge corners of the object from intersections of the contour segments; estimating a vanishing point for each plane of the structured feature; as well as The main direction for each pixel in the plane is determined based on the corresponding vanishing point for each structured feature.

10. The method of claim 1, wherein the one or more horizontal regions are determined by taking an inner product of the normal direction of the pixel and a y direction of the pixel, wherein when the inner product is greater than 35 degrees, the pixel is determined to be in the horizontal region.

11. The method of claim 1, wherein the one or more vertical regions are determined by taking an inner product of the normal direction of the pixel and a y direction of the pixel, wherein when the inner product is close to 90 degrees, the pixel is determined to be in the vertical region.

12. The method according to claim 1, further comprising: A virtual object is input in the image based on the refined principal directions of the pixels such that the virtual object follows the perspective orientation of the pixels.

13. A method for determining a perspective direction of a pixel in an image, the method comprising: receiving an image; generating a two-dimensional geometric region for an object in the image using the two-dimensional vanishing point estimation; determining a virtual intrinsic for each geometric region based on an image size of the object; as well as Based on the vanishing point estimate, normal directions and principal directions are determined for pixels in the image. The method according to claim 13 , wherein the two-dimensional geometric area is generated by user marking. The method of claim 13 , wherein the two-dimensional geometric region is automatically generated.

16. A non-transitory computer-readable medium having computer-executable instructions stored thereon, the instructions, when executed, causing one or more processors to perform operations comprising: Determine the main direction of pixels in the image; determining a normal direction of the pixel in the image; Segmenting the region in the image into one or more horizontal regions and one or more vertical regions based on the normal direction of each pixel in the segmented region; Obtaining global normalization information for the image from the segmented regions; as well as The main directions of the pixels in the image are refined based on the global normalization information.

17. The non-transitory computer readable medium of claim 16, wherein determining the primary direction of the pixel comprises: generating a two-dimensional geometric shape for an object having the pixel in the image based on the contour segment; providing virtual intrinsics for each of the objects in the image; as well as Based on the virtual eigenvalues ​​and the contour segments, the principal direction is determined for the pixel in the object in the image.

18. The non-transitory computer readable medium of claim 16, wherein the principal directions include an x-direction and a y-direction representing a pair of orthogonal directions in a three-dimensional space, and wherein the obtaining of the global normalization information comprises: The direction of gravity for the image is estimated by averaging the y-direction of the pixels in the one or more horizontal regions in the image.

19. The non-transitory computer readable medium of claim 18, wherein refining the principal direction of the pixel comprises: For the pixels in the one or more vertical regions, the y direction is replaced with the estimated gravity direction for the pixel, and the x direction is replaced by taking a cross product of the gravity direction and the normal direction of the pixel.

20. The non-transitory computer readable medium of claim 18, wherein refining the principal direction of the pixel comprises: For the pixels in the horizontal region, the x direction is replaced by taking a cross product of the gravity direction and the determined y direction, and the y direction is replaced by taking a cross product of the gravity direction and the determined x direction.