Message Boards Message Boards

0
|
2477 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

ImageDifference and ImageAlign

Hello! I am getting some unexpected behavior from the ImageAlign command when used in conjunction with ImageDifference. Some background:

I want to subtract one image from another to reveal the differences between the two, however, the dimensions of the two images are slightly different. I need to perform image registration to align the two images, and make them uniform dimension. It’s my understanding that this is what the ImageAlign command does.

The attached notebook shows my attempt to implement this, and when it does not behave as anticipated, develop my understanding, I’d appreciate any feedback as to what is happening.

Thank you for your consideration.

POSTED BY: J. Leko
2 Replies
Posted 1 year ago

Here's what I think is going on. First, to do the ImageAlign Mathematica is automatically setting an alpha channel. Second, ImageDifference is designed to work with masks, and for an image with an alpha channel, everything that is non-transparent becomes the mask. So, I think what you need to do is explicitly remove the alpha channel:

ImageDifference[withPill, RemoveAlphaChannel[ImageAlign[withPill, withoutPill]]]

(I've changed the name of the images so that I could keep them straight in my head. Also, this is just my best guest, I'm not an expert on how all of the image processing functions are designed to work.)

POSTED BY: Eric Rimbey

Eric,

Thanks for your reply. Apologies for the response delay. This solved my immediate issue, and I was able to get (almost) the result I expected. I think I’m able to understand the results, now. Hope this is of benefit to others too.

Good call on the variable re-naming. Guess I’m too myopic on this issue…. :-)

POSTED BY: J. Leko
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract