Skip to content

Commit e920e22

Browse files
authored
Create albedo texture for a model from calibrated images (#6806)
Create an albedo for the triangle mesh using calibrated images. The triangle mesh must have texture coordinates (texture_uvs triangle attribute). This works by back projecting the images onto the texture surface. Overlapping images are blended together in the resulting albedo. For best results, use images captured with exposure and white balance lock to reduce the chance of seams in the output texture.
1 parent d251815 commit e920e22

File tree

21 files changed

+742
-57
lines changed

21 files changed

+742
-57
lines changed

cpp/open3d/core/TensorKey.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ class TensorKey {
8282
/// For TensorKeyMode::Slice only.
8383
int64_t GetStart() const;
8484

85-
/// Get stop index. Throws exception if start is None.
85+
/// Get stop index. Throws exception if stop is None.
8686
/// For TensorKeyMode::Slice only.
8787
int64_t GetStop() const;
8888

89-
/// Get step index. Throws exception if start is None.
89+
/// Get step index. Throws exception if step is None.
9090
/// For TensorKeyMode::Slice only.
9191
int64_t GetStep() const;
9292

cpp/open3d/io/ImageIO.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ bool WriteImage(const std::string &filename,
8181
auto map_itr = file_extension_to_image_write_function.find(filename_ext);
8282
if (map_itr == file_extension_to_image_write_function.end()) {
8383
utility::LogWarning(
84-
"Write geometry::Image failed: unknown file extension.");
84+
"Write geometry::Image failed: file extension {} unknown.",
85+
filename_ext);
8586
return false;
8687
}
8788
return map_itr->second(filename, image, quality);

cpp/open3d/t/geometry/Image.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ Image Image::Resize(float sampling_rate, InterpType interp_type) const {
156156
if (sampling_rate == 1.0f) {
157157
return *this;
158158
}
159+
if (GetDtype() == core::Bool) { // Resize via UInt8
160+
return Image(Image(data_.ReinterpretCast(core::UInt8))
161+
.Resize(sampling_rate, interp_type)
162+
.AsTensor()
163+
.ReinterpretCast(core::Bool));
164+
}
159165

160166
static const dtype_channels_pairs npp_supported{
161167
{core::UInt8, 1}, {core::UInt16, 1}, {core::Float32, 1},

cpp/open3d/t/geometry/RaycastingScene.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ uint32_t RaycastingScene::AddTriangles(const TriangleMesh& mesh) {
13131313
}
13141314

13151315
std::unordered_map<std::string, core::Tensor> RaycastingScene::CastRays(
1316-
const core::Tensor& rays, const int nthreads) {
1316+
const core::Tensor& rays, const int nthreads) const {
13171317
AssertTensorDtypeLastDimDeviceMinNDim<float>(rays, "rays", 6,
13181318
impl_->tensor_device_);
13191319
auto shape = rays.GetShape();
@@ -1723,7 +1723,6 @@ uint32_t RaycastingScene::INVALID_ID() { return RTC_INVALID_GEOMETRY_ID; }
17231723
} // namespace geometry
17241724
} // namespace t
17251725
} // namespace open3d
1726-
17271726
namespace fmt {
17281727
template <>
17291728
struct formatter<RTCError> {

cpp/open3d/t/geometry/RaycastingScene.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class RaycastingScene {
7272
/// - \b primitive_normals A tensor with the normals of the hit
7373
/// triangles. The shape is {.., 3}.
7474
std::unordered_map<std::string, core::Tensor> CastRays(
75-
const core::Tensor &rays, const int nthreads = 0);
75+
const core::Tensor &rays, const int nthreads = 0) const;
7676

7777
/// \brief Checks if the rays have any intersection with the scene.
7878
/// \param rays A tensor with >=2 dims, shape {.., 6}, and Dtype Float32

0 commit comments

Comments
 (0)