Add aspect-ratio measurement as a soft trimming signal, reported against every standard card size
This commit is contained in:
parent
b28305dd25
commit
f464faca43
5 changed files with 139 additions and 2 deletions
|
|
@ -140,6 +140,18 @@ function renderGradeBlock(g, opts = {}) {
|
|||
const centeringLine = cm
|
||||
? `measured — left/right ${cm.horizontal_label} · top/bottom ${cm.vertical_label}` : '';
|
||||
|
||||
// Only worth surfacing when it's away from noise — most cards sit within
|
||||
// a percent or two of standard and repeating that number on every card
|
||||
// would just be clutter, not information. Shown against its best-matching
|
||||
// standard; which standard is actually relevant is a judgment call the
|
||||
// model made with the photo in hand, not something this line re-derives.
|
||||
const am = g.aspect_measurement || null;
|
||||
const bestDev = am && am.against_standards && am.best_match
|
||||
? am.against_standards[am.best_match].deviation_percent : null;
|
||||
const aspectLine = (bestDev !== null && bestDev >= 3)
|
||||
? `ratio ${bestDev}% off standard (${am.best_match}) — ` +
|
||||
`verify this isn't just a rotated photo before reading it as trimming` : '';
|
||||
|
||||
const rows = ['centering', 'corners', 'edges', 'surface'].map((key) => {
|
||||
const cat = (g.categories || {})[key] || {};
|
||||
const sev = cat.severity || 'cannot_assess';
|
||||
|
|
@ -148,6 +160,8 @@ function renderGradeBlock(g, opts = {}) {
|
|||
extra = `<div class="hint">measured whitening — ${esc(measuredLine)}</div>`;
|
||||
} else if (key === 'centering' && centeringLine) {
|
||||
extra = `<div class="hint">${esc(centeringLine)}</div>`;
|
||||
} else if (key === 'corners' && aspectLine) {
|
||||
extra = `<div class="hint">${esc(aspectLine)}</div>`;
|
||||
}
|
||||
return `<tr>
|
||||
<td style="text-transform:capitalize">${key}</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue