Detects line segments with LSD (falling back to FLD when unavailable),
chains them into a single polyline, and truncates its DCT coefficients
to produce a smoothed/compressed curve, output as both an image and JSON.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>