I want to flatten the image of the QR code attached to a cylindrical object

・ OpenCV4

Shooting conditions
・ Image pasted on a cylinder
・ Install the camera diagonally below (look up from below)

What you want to achieve
・ Flatten curved distortion
・ I want to read the QR code

I’ve just started using opencv, and I’ve read a lot of literature, but I only have materials for enlargement, rotation, and projective transformation.
How to flatten a curved image?
Please teach the specific source code and processing method.

Hi @Red

As far as I know, QR are meant to be used on flat surfaces. Bar codes can be used on cylindrical surfaces.

I don’t know any automatic method to flatten that image.

If your structure is always the same, if your camera will be viewing the cone always from the same position, you can make a map to warp the image to get a flat view.

If images are taken from different positions, first you should make the warp map programmatically, for example starting by detecting qr squares, segmenting them with threshold and ROI, and analysing edge directions.



not sure what it does. give it a try.

1 Like

Thank you very much.
In the actual shooting environment, the camera is fixed (orientation / position).

Sure, the object is cylindrical, but I noticed that it looks like a cone when viewed from below.
I will try the processing procedure that you taught me.

If anything happens again, I would like to ask you a question.

Thank you very much.
I’ll look it up!