Why draw a line don't produce a line with exact line thickness?

don’t worry, these APIs aren’t “nailed down” in ways that would require inventing new names. they can just be fixed, and suddenly everybody gets to enjoy exact drawing.

they just need to be fixed. the drawing primitives at least. contours are another mess entirely.

there is a lot to discuss. one issue is subpixel behavior. 1-thick lines ought to sit on pixels, but 2-sized lines… should straddle a pixel boundary and span exactly 2 pixels… but that’s just for speed/crispness. for accuracy (let’s say LINE_AA), a 2-width line should sit precisely where commanded, and cause 3 pixels to be painted. the center one completely, the adjacent two at 50%. I’d also want an option for roughly alpha-correct blending with alpha 2.2 or 2.4 (or a built-in LUT).

I don’t currently care about cap/join styles. seems okay to handle that with flags.

you can be sure that the rectangle call also just draws lines, so any issue with cv::line will replicate in all other drawing calls, e.g. circle (because that’s drawn as segments) and putText too because that’s using vector fonts!

here’s the issue I made a while ago. ignore my confusion about 4/8-connectivity. perhaps that’s why I didn’t manage to be understood.

1 Like