Fix teeth band filling the whole mouth
Three causes, all of them mine: Otsu always returns a split, including on a homogeneous region - given a dark cavity with no teeth it invents a threshold and calls half the pixels bright. The gate is now the separation between the two class means, which is the only thing that says whether the split means anything. Coverage was the wrong signal: it is high both when the mouth is full of teeth and when the region is uniformly dark and Otsu has split noise. The row scan tracked the last qualifying row anywhere rather than where the run from the top stops, so one bright row near the bottom - a lit lower lip inside the ring - pushed the line to full height. It now breaks at the first failing row once the run has started. MediaPipe's inner lip landmarks sit slightly outside the real opening, so the sampled region included lip pixels, which are bright and sit exactly at the boundary where they do most damage. The ring is now eroded toward its centroid before sampling, with the amount exposed as a knob. Adds a diagnostic panel showing the sampled crop, pixels above threshold, and the resolved line, because tuning this from numbers alone does not tell you whether the region being measured is even the right region. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
941022b69f
commit
c6daf827d1
4 changed files with 164 additions and 33 deletions
19
index.html
19
index.html
|
|
@ -122,21 +122,30 @@
|
|||
<label class="ctl"><span>contour avg ±f</span><input type="range" id="contourSmooth" min="0" max="4" value="1"><output id="contourSmoothv"></output></label>
|
||||
<label class="ctl"><span>anchor avg ±f</span><input type="range" id="smoothWin" min="0" max="8" value="2"><output id="smoothWinv"></output></label>
|
||||
<label class="ctl"><span>closed-mouth cut</span><input type="range" id="apertureThresh" min="0" max="400" value="120"><output id="apertureThreshv"></output></label>
|
||||
<label class="ctl"><span>teeth threshold</span><input type="range" id="teethOn" min="1" max="60" value="14"><output id="teethOnv"></output></label>
|
||||
<label class="ctl"><span>teeth contrast</span><input type="range" id="teethOn" min="1" max="60" value="16"><output id="teethOnv"></output></label>
|
||||
<label class="ctl"><span>cavity erode</span><input type="range" id="teethErode" min="0" max="40" value="18"><output id="teethErodev"></output></label>
|
||||
<label class="ctl"><span>teeth dwell</span><input type="range" id="teethDwell" min="0" max="6" value="1"><output id="teethDwellv"></output></label>
|
||||
<label class="ctl"><span>suggest tolerance</span><input type="range" id="tol" min="2" max="60" value="14"><output id="tolv"></output></label>
|
||||
<div class="legend">
|
||||
<b>contour avg</b> 0 = off, 1 = ±1 frame. Removes per-frame landmark
|
||||
jitter. Push past 2 and it starts eating articulation.<br>
|
||||
<b>anchor avg</b> smooths the head transform only — never the contour.<br>
|
||||
<b>teeth threshold</b> bright fraction of the cavity needed before a teeth
|
||||
band appears; <b>dwell</b> is how many frames a change must persist, so it
|
||||
cannot blink on and off.<br>
|
||||
<b>teeth contrast</b> how far apart the dark and bright halves of the
|
||||
cavity must be before the split means anything — Otsu always returns
|
||||
<i>some</i> threshold, so this is what stops it inventing teeth in a dark
|
||||
mouth. <b>erode</b> shrinks the sampled region inward, away from the lip
|
||||
edge. <b>dwell</b> is how many frames a change must persist.<br>
|
||||
<b>suggest tolerance</b> only affects the Suggest button: max head movement
|
||||
allowed before a new drawing is required.
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel" style="flex:1 1 280px">
|
||||
<div class="panel" style="flex:0 1 190px">
|
||||
<h2>teeth measurement</h2>
|
||||
<div id="cv-teeth"></div>
|
||||
<div class="legend" id="teethinfo"></div>
|
||||
<div class="legend">green = above threshold · amber = resolved line</div>
|
||||
</div>
|
||||
<div class="panel" style="flex:1 1 240px">
|
||||
<h2>palette</h2>
|
||||
<div id="palette"></div>
|
||||
<div class="legend" style="margin-top:12px">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue