combine matrices of images in which different matlab filter was used

1

I had a problem with an image, in the binarization when increasing the threshold one zone gained definition while another gained noise and so on; so I separated what needs bigger threshold like this:

I=imread('img.jpg') 

I2=imcrop(I;[coordenadas])

Bin1=binarización I1(umbral l);

Bin2=binarización i2(umbral l+1);

Now my question is:

How to replace Bin2 (small image) in Bin1 (large image)?

    
asked by JVidal 19.10.2016 в 00:18
source

1 answer

1

As you mentioned, the idea is to replace a region of the large image that has been filtered using a different threshold, so all you need to do is replace elements in a matrix you use indexing:

Matriz(i1:i2, j1:j2) = matriz_reemplazo

Where matriz_reemplazo will be a matrix of dimensions (i2-i1) x (j2-j1) , that is, of the same dimensions as the sub-matrix you are referring to with indexing.

To make the above clearer, an example:

IG = imread('cameraman.tif');
I2 = imcrop(IG,[50 50 100 100]);
BWG = im2bw(IG, 0.3);
BW2 = im2bw(I2, 0.6);
% Sin sustituir la región recortada
subplot(1,2,1);
imshow(BWG);
% Sustituyendo la región recortada
subplot(1,2,2);
BWG(50:150,50:150) = BW2;
imshow(BWG);

That produces the following images:

Without replacing the cropped region

Substituting the cropped region

    
answered by 19.10.2016 / 01:38
source