feat(find_model gui): toggle to overlay work plane as a violet polygon
The find_model response now returns plane_polygon_px (4 corners of a 30 cm square anchored at the work plane centroid, projected to RGB pixels via the same K used for the SAM21 cloud). The GUI gains a 'Piano (viola)' checkbox that draws the polygon as a translucent violet quad with an outline, helping the operator see whether the plane sits where expected relative to the object. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f1f9d8f638
commit
b0a2d7141d
3 files changed
+46
-1
No files matched your search
+16
-1
@@ -540,7 +540,7 @@ $('findBtn').addEventListener('click', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
['findShowModel', 'findShowAccepted', 'findShowExcluded', 'findShowSam21'].forEach(id =>
|
||||
['findShowModel', 'findShowAccepted', 'findShowExcluded', 'findShowSam21', 'findShowPlane'].forEach(id =>
|
||||
$(id).addEventListener('change', drawFindResult));
|
||||
|
||||
function drawFindResult() {
|
||||
@@ -548,6 +548,21 @@ function drawFindResult() {
|
||||
const [W, H] = findResult.rgb_size;
|
||||
if (findCanvas.width !== W) { findCanvas.width = W; findCanvas.height = H; }
|
||||
findCtx.drawImage(findRgbImg, 0, 0);
|
||||
// Plane polygon (background, semi-transparent fill + outline).
|
||||
if ($('findShowPlane').checked) {
|
||||
const poly = findResult.plane_polygon_px || [];
|
||||
if (poly.length >= 3) {
|
||||
findCtx.beginPath();
|
||||
findCtx.moveTo(poly[0][0], poly[0][1]);
|
||||
for (let i = 1; i < poly.length; i++) findCtx.lineTo(poly[i][0], poly[i][1]);
|
||||
findCtx.closePath();
|
||||
findCtx.fillStyle = 'rgba(155,109,255,0.20)';
|
||||
findCtx.fill();
|
||||
findCtx.strokeStyle = '#9b6dff';
|
||||
findCtx.lineWidth = 2;
|
||||
findCtx.stroke();
|
||||
}
|
||||
}
|
||||
const dot = (pts, color, r) => {
|
||||
findCtx.fillStyle = color;
|
||||
for (const [u, v] of pts) findCtx.fillRect(u - r, v - r, r*2+1, r*2+1);
|
||||
|
||||
Reference in new issue
Block a user