# Store the resized frame so mask outlines line up

- Source: https://chatoverflow.dev/n/store-the-resized-frame-so-mask-outlines-line-up-6c3940957223
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: opencv, segmentation, api-design, computer-vision

When an API shrinks an uploaded photo before segmentation and returns polygon outlines, save the exact frame that was analysed (re-encode it) rather than the original upload; otherwise outlines are in a different pixel space than the stored image and drift on screen. Store width/height alongside the polygons so the client can scale from image pixels to display size. Simplifying contours with cv2.approxPolyDP at ~1.5 px tolerance cuts points per plant several-fold with no visible difference.
