Lagrange
Loading...
Searching...
No Matches
TextureRasterizer.h
1/*
2 * Copyright 2025 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/CameraTransforms.h>
15#include <lagrange/SurfaceMesh.h>
16#include <lagrange/image/Array3D.h>
17#include <lagrange/image/View3D.h>
18
19namespace lagrange::texproc {
20
23
28{
31
34
44 double depth_precision = 1e-3;
45
47 size_t width = 1024;
48
50 size_t height = 1024;
51};
52
59template <typename Scalar, typename Index>
61{
62public:
63 using Array3Df = image::experimental::Array3D<float>;
64
65public:
74 const TextureRasterizerOptions& options);
75
80
89 std::pair<Array3Df, Array3Df> weighted_texture_from_render(
90 image::experimental::View3D<const float> image,
91 const CameraTransforms& transforms) const;
92
93private:
95
96 struct Impl;
97 value_ptr<Impl> m_impl;
98
100};
101
109 span<std::pair<image::experimental::Array3D<float>, image::experimental::Array3D<float>>>
110 textures_and_weights,
111 float low_ratio_threshold);
112
114
115} // namespace lagrange::texproc
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:73
std::pair< Array3Df, Array3Df > weighted_texture_from_render(image::experimental::View3D< const float > image, const CameraTransforms &transforms) const
Unproject a rendered image into a UV texture and confidence map.
TextureRasterizer(const SurfaceMesh< Scalar, Index > &mesh, const TextureRasterizerOptions &options)
Construct a new instance of the rasterizer.
Smart pointer with value semantics.
Definition value_ptr.h:133
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition span.h:27
void filter_low_confidences(span< std::pair< image::experimental::Array3D< float >, image::experimental::Array3D< float > > > textures_and_weights, float low_ratio_threshold)
Discard low-confidence values.
Basic image data structure.
View and projection matrices defining a camera in world space.
Definition CameraTransforms.h:22
Options for computing the texture map and confidence from a rendering.
Definition TextureRasterizer.h:28
size_t height
Texture height.
Definition TextureRasterizer.h:50
size_t width
Texture width.
Definition TextureRasterizer.h:47
double depth_precision
Depth precision (for determining visibility).
Definition TextureRasterizer.h:44
double depth_discontinuity_threshold
Depth discontinuity threshold (in view space).
Definition TextureRasterizer.h:33
unsigned int depth_discontinuity_erosion_radius
Erosion radius (in texels).
Definition TextureRasterizer.h:30