How can i extract green rectangle area from the rgb image ?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
sufian ahmed
il 21 Set 2017
Risposto: Image Analyst
il 22 Set 2017
I have two image. one i take in night and another take in daylight. So i only mask the region where green pixels exists. but problem is that for every image i need to change the value. how can i fix it the same value for all images.
Im = imread('4.jpg');
figure,imshow(Im);
lab = rgb2lab(Im);
figure,imshow(Im);
% Im = imresize(Im, [512 512]);
% figure,imshow(lab(:,:,2));
I1=lab(:,:,2);
I2=lab(:,:,3);
I3=lab(:,:,1);
mask1=I1>-50 & I1<0 ;
mask2=I2>30 & I2<50;
mask =I3 & mask1 & mask2;
% mask=mask1 ;
figure,imshow(mask);
diff_im = im2bw(mask,0.18);
figure,imshow(diff_im);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167416/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167417/image.jpeg)
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!