Why is image colored instead of white?
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    mark palmer
      
 il 2 Lug 2020
  
    
    
    
    
    Commentato: mark palmer
      
 il 3 Lug 2020
            Why does obj not show white in the colored areas? The numbers read 255 but they come out colored in the image...
pic1 = imread('Testcircls.tif');
obj = uint8(ones(size(pic1)));
mask = pic1 > 0;
pic1(mask) = 255;
obj = pic1;
imagesc(obj)
0 Commenti
Risposta accettata
  Walter Roberson
      
      
 il 3 Lug 2020
        You are comparing component by component. You are not testing whether any of the RGB components for a pixel are greater than zero: you are testing whether the individual components are greater than 0. When you have pure colors like you have,  one or two of the RGB components are 0, and those stay 0 with your code.
pic1 = imread('Testcircls.tif');
obj = uint8(ones(size(pic1)));
mask = repmat(any(pic1 > 0, 3), [1 1 size(pic1,3)]);
pic1(mask) = 255;
obj = pic1;
image(obj)
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Image Filtering and Enhancement in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

