1

I have an image which i applied a mask to

Input_image = double(imread('re1.jpg')); % original image
mask = double(imread(/block_text.bmp')); % text mask
mask = mask ./ max(mask(:));        
X = Input_image.*mask;           % partially observed image. (matrix with missing elements)

This code gives this image

enter image description here

EDIT: what i mean is that i have the code below and i want to modify to use images in the code above instead of random data. i.e matrix M becomes my image X. but what i dont know is how to get omega in my case.

m=400, n=500; 
M =  rand(m,r) * rand(r,n); % randomly generated matrix
I = randi([0 1],m,n);
Omega = find(I);
A = M(Omega);
Rebecca20
  • 13
  • 3
  • 2
    How to perform linear indexing can be found [here](https://stackoverflow.com/q/32379805/5211833). Otherwise, I am uncertain what you attempt to do. – Adriaan Jul 08 '20 at 10:58
  • @Adriaan please see the edit. I want to modify the second code so that instead of just random data. i use an image. and instead of randomly removing entrix, i used a mask. – Rebecca20 Jul 08 '20 at 11:28
  • `Omega=find(I)` does literally that, get linear indices in `Omega` whenever your image `I` is equal to `1`, and then use that to index into `M`. I still don't understand where the problem is, sorry. – Adriaan Jul 08 '20 at 12:59
  • In that snippet of code, `M` is your `Input_image`, and `I` is your `mask`. – Cris Luengo Jul 08 '20 at 14:31

0 Answers0