1

I was trying to follow along with four-point-transform blog post with slight modifications using Python-3.6. First I obtained four_point_transform of the given image. After getting the warped image, I plotted bounding box around text "Hello" using cv2.rectangle.

cv2.rectangle(warped, (37, 20), (222, 97), (255, 0, 0), 2)

Now, I want to plot the bounding box of text "Hello" in warped image on the original image. I referred to this similar question. But I do not have the coordinates on the source image so could not follow along. Any help would be very much appreciated.

Himansingh
  • 36
  • 3
  • 2
    if the image was warped with transformation matrix M, transform your pixel coordinates with M^-1 (inverse) to get pixel coordinates of the unwarped image. – Micka May 28 '18 at 15:25
  • @Micka, I actually want to know the original coordinates of (37, 20) and (222, 97) on the original image and later use those values alone for further processing. – Himansingh May 28 '18 at 17:05
  • 1
    compute inverse-M * (37,20,1) and divide the result by its z coordinate to get the original point and same for the other point. Read about homography transformations in 2D space. – Micka May 28 '18 at 17:20

0 Answers0