I have a series of endoscopic images taken by two cameras at the same time.

A color image:

enter image description here

and a fluorescent image indicating cancerous cells

enter image description here

I now want to overlay the two images to indicate the cancer in the color image.

ImageCompose[img1, {img2, 0.35}]

enter image description here

you can see that it does not match exactly. I need a way to match both images. Another problem is, sometimes the color camera zoomed a little in while the fluorescent image does not.

In the fluorescent image everything but the bright area should be omitted.

The color image is the basis and the fluoro image should be fitted to it, preferably in some false coloring.

Here are two corresponding images: pair 1



  • $\begingroup$ @Pickett thanks, corrected. $\endgroup$
    – spore234
    May 29, 2014 at 10:23
  • $\begingroup$ What is the meaning of the axis ticks marks? If the images can be zoomed independently you'll need some scale hint to match the relative sizes $\endgroup$ May 29, 2014 at 12:13
  • $\begingroup$ @belisarius the axis are just arbitrary points and are only there because I converted the images from matlab files. An ideal solution would be an algorithm that could detect wheter the image is zoomed and scale the fluoro image accordingly. $\endgroup$
    – spore234
    May 29, 2014 at 13:57
  • $\begingroup$ I don't think that is possible. If it were, you should be able to detect the cancerous cells just from the color image $\endgroup$ May 29, 2014 at 14:20

1 Answer 1


I'm providing what I've done so far. I'm using Binarize to detect the yellow part of the fluorescent image which is not great, but I hope this answer can save someone who knows how to do that in a better way some grunt work.

im1col = Import["http://i.imgur.com/shzDETI.jpg"];
im1fluo = Import["http://i.imgur.com/Yh9iAXH.jpg"];
removeFrame[img_] := 
highlightCancerousCells[img_, fluo_] := HighlightImage[
   {{#, 0}, {#2, 0}} & @@ (ImageDimensions[ImageCrop@img] - 
highlightCancerousCells[im1col, im1fluo]

example image

The algorithm can be outlined thus:

  1. Take the fluorescent image and crop away everything but the fluorescent part
  2. Crop away the whitespace at the top and right side of the color image. This preserves the axes on the bottom left side.
  3. Check the difference in image dimensions between the new fluorescent image and the color image. Pad the fluorescent image accordingly on the bottom left side with black color.
  4. Use the binarized version of the fluorescent image, in which everything is black except for the yellow parts, to highlight the color image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.