Search code examples
imagematlabimage-processingkriging

Applying an image as a mask in matlab


I am a new user on image processing via Matlab. My first aim is applying the article and comparing my results and authors' results.
The article can be found here: http://arxiv.org/ftp/arxiv/papers/1306/1306.0139.pdf

First problem, Image Quality: In Figure 7, masks are defined but I couldn't reach the mask data set, and I use the screenshot so image quality is low. In my view, it can effect the results. Is there any suggestions?

Second problem, Merging images: I want to apply mask 1 on the Lena. But I don't want to use paint =) On the other hand, is it possible merging the images and keeping the lena?


Solution

  • You need to create the mask array. The first step is probably to turn your captured image from Figure 7 into a black and white image:

    Mask = im2bw(Figure7, 0.5);
    

    Now the background (white) is all 1 and the black line (or text) is 0. Let's make sure your image of Lena that you got from imread is actually grayscale:

    LenaGray = rgb2gray(Lena);
    

    Finally, apply your mask on Lena:

    LenaAndMask = LenaGray.*Mask;
    

    Of course, this last line won't work if Lena and Figure7 don't have the same size, but this should be an easy fix.