Skip to content

[fuseCut] Mesher: read the neighbour-inversion iteration count as int - #2179

Merged
servantftransperfect merged 1 commit into
alicevision:developfrom
dspl1236:fix/mesher-invert-iterations-int
Oct 6, 2026
Merged

servantftransperfect merged 1 commit into
alicevision:developfrom
dspl1236:fix/mesher-invert-iterations-int

Conversation

@dspl1236

Copy link
Copy Markdown
Contributor

Fixes #2178.

Mesher::graphCutPostProcessing reads an iteration count with get<bool>:

int invertTetrahedronBasedOnNeighborsNbIterations =
  _mp.userParams.get<bool>("hallucinationsFiltering.invertTetrahedronBasedOnNeighborsNbIterations", 10);

and uses it as a loop bound at line 317. The result is 1 either way:

  • with the option set, boost::property_tree's bool translator does not accept a value like "10", so the get falls back to its default;
  • the default supplied here is 10, which converts to bool true, which converts back to int as 1.

So the 4-neighbour inversion pass runs once, whatever is configured — neither the configured value nor the intended default of 10 ever reaches the loop.

The second hunk changes nbSolidAngleFilteringIterations from get<double> to get<int>. That one is not a defect — the double translator parses "10" and the narrowing gives 10 — but it is the same mistake on an int count, two lines below, so it seemed worth correcting while the file is open.

Effect

The later rounds remove the isolated spikes and pits that the first round exposes. Measured with only these calls changed:

data set faces, as shipped faces, reading it as int
6-view monstree 500,572 500,057
107-photo engine bay 2,364,995 2,361,583

About 0.8 s more on the larger job. Small in face count, but it is the difference between the pass doing what the parameter asks and doing one round regardless.

Found while porting the meshing stage to HIP for AMD GPUs, but this is CPU code and is not platform specific; both measurements above are from CPU runs.

🤖 Generated with Claude Code

@cbentejac
cbentejac force-pushed the fix/mesher-invert-iterations-int branch 2 times, most recently from c950115 to 7e9e059 Compare October 1, 2026 10:20
@cbentejac cbentejac added this to the 3.4.0 milestone Oct 1, 2026
graphCutPostProcessing reads invertTetrahedronBasedOnNeighborsNbIterations with
get<bool> and uses it as a loop bound, so the bound is 1 whatever is configured:
property_tree's bool translator does not accept a value like "10" and falls back
to the default, and the default supplied here is 10, which converts to bool true
and back to int 1. The 4-neighbour inversion pass therefore runs once rather than
the ten times the parameter asks for.

nbSolidAngleFilteringIterations two lines below reads an int count as a double.
That one does work, since the double translator parses "10" and the narrowing
gives 10, but it is the same mistake and the value is an int count.

Fixes alicevision#2178

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@servantftransperfect servantftransperfect left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you !

@servantftransperfect
servantftransperfect merged commit f2447d4 into alicevision:develop Oct 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mesher: neighbour-inversion iteration count is read with get<bool>, so the pass always runs once

3 participants