Skip to content

allow texrecon of multi-channel images #229

@maurerle

Description

@maurerle

I had the following issue in texrecon when creating a texture for a multi-channel image within OpenDroneMap using stacked tiff images with 6 channels from a MicaSense RedEdge-P camera:

The images have the 6 channels RGB + NIR, REDEDGE, Panchro

[INFO]    running "/code/SuperBuild/install/bin/texrecon" "/datasets/images_proc/opensfm/undistorted/reconstruction.nvm" "/datasets/images_proc/odm_meshing/odm_mesh.ply" "/datasets/images_proc/odm_texturing/odm_textured_model_geo" -d gmi -o gauss_clamping -t none --no_intermediate_results     --num_threads=20 --max_texture_size=8192 
/code/SuperBuild/install/bin/texrecon (built on Jan 13 2026, 15:22:35)
Load and prepare mesh: 
Reading PLY: 195369 verts... 390760 faces... done.
Generating texture views: 
NVM: Loading file...
NVM: Number of views: 9
NVM: Number of features: 8485

                                                                                
	Loading 100%... done. (Took 0.084s)
Building adjacency graph: 

                                                                                
	Adding edges 100%... done. (Took 0.379s)
	586136 total edges.
View selection:
	Building BVH from 390760 faces... done. (Took: 148 ms)
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Image must be RGB or RGBA
Aborted

The Image must be RGB or RGBA comes from:
https://github.com/simonfuhrmann/mve/blob/48a69d02cada7223c4d7b9d7aea340f70526a7fd/libs/mve/image_tools.h#L1356

The issue here is that calculate_data_costs

tex::calculate_data_costs(mesh, &texture_views, conf.settings, &data_costs);

calls the desaturate function for any images here:

TextureView::generate_gradient_magnitude(void) {
assert(image != NULL);
mve::ByteImage::Ptr bw = mve::image::desaturate<std::uint8_t>(image, mve::image::DESATURATE_LUMINANCE);
gradient_magnitude = mve::image::sobel_edge<std::uint8_t>(bw);

Otherwise the calling methods (OpenDroneMap) should drop the additional channels earlier before calling texrecon..?

Thanks for this nice library!
If it helps, I can provide the stacked tiff images at some place.

related issue at the upstream MVE repository:
simonfuhrmann/mve#584

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions