开发者

Overlay two images

I am trying to compare two images to assess their registration. I would like to overlay the two images using a checkerboard type pattern, where (say) the top left 20 x 20 pixel patch displays the first image, and then alternates between image one and two.

I have written a similar script in Matlab which involved displaying one image on top of the ot开发者_JAVA技巧her, and then applying a checkerboard transparency to the top image. Is this possible in OpenCV?


The fastest way for you:

  1. Create checkers board on matlab.
  2. Save it as png/bmp image (no compression)
  3. Load this image in opencv and use it as mask
  4. Use cvAdd on the images using the loaded mask

P.S. You can write the chessboard mask creator in openCV but if you need it only for debug then save yourself this task and use matlab


You can certainly mess with the alpha channel manually in a double for loop over the images.

I'd actually like to propose an alternative for testing registration which may be even more sensitive. You can take gray scale representations of each image (convert to gray if they are originally color) and put them into different color channels of a new image. Say img1 in R and G while img2 goes into B. Then, you can display the new image. Any mis-registered region would show up in color while correctly registered parts are gray.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜