1

I teach OpenCV, and I want to write a small test app. And have a question. What algorithm would you advise to fill the contour (close to a rectangle) with image?

Thanks a lot!

Medlay
  • 67
  • 1
  • 6

2 Answers2

2

A combination of warp to deform the src image to match the shape of the contour and addWeighted to replace destination image pixels with the source in the new shape

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
1

Assuming you know the location of the rectangle you would like to fill, you could simply set a ROI (region of interest) and perform some processing on that region (maybe a grayscale conversion), or even copy another image to that location. I've already demonstrated how to set a ROI and perform some processing on that area.

If you want to add 2 images I suggest you check the official tutorial, this post, and this demo: the magic happens through cvSetImageROI() and cvAddWeighted().

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426