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
39 double depth_precision = 1e-3;
40
42 size_t width = 1024;
43
45 size_t height = 1024;
46};
47
54template <typename Scalar, typename Index>
56{
57public:
58 using Array3Df = image::experimental::Array3D<float>;
59
60public:
69 const TextureRasterizerOptions& options);
70
75
84 std::pair<Array3Df, Array3Df> weighted_texture_from_render(
85 image::experimental::View3D<const float> image,
86 const CameraTransforms& transforms) const;
87
88private:
90
91 struct Impl;
92 value_ptr<Impl> m_impl;
93
95};
96
104 span<std::pair<image::experimental::Array3D<float>, image::experimental::Array3D<float>>>
105 textures_and_weights,
106 float low_ratio_threshold);
107
109
110} // 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:134
::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:45
size_t width
Texture width.
Definition TextureRasterizer.h:42
double depth_precision
Depth precision (for determining visibility).
Definition TextureRasterizer.h:39
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