How to browse image in matlab and get error message if it is not grey scale image
    2 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Muhammad Danish
 il 6 Ott 2016
  
    
    
    
    
    Commentato: Walter Roberson
      
      
 il 7 Ott 2016
            Actually i need help in code as user to browse a grayscale image and displays the browsed image as well as its size. In case of RGB or binary image provided as input, the application must prompt the user to input grayscale image again.
0 Commenti
Risposta accettata
  Gopichandh Danala
      
 il 6 Ott 2016
        
      Modificato: Walter Roberson
      
      
 il 6 Ott 2016
  
      Try this,
file_name = uigetfile('*.*');
imgInfo = imfinfo(file_name);
if strcmp(imgInfo.ColorType,'grayscale')
    display('This is a gray scale image');
    img = imread(file_name);
    figure, imshow(img,[]), title('grayscale image');
elseif strcmp(imgInfo.ColorType,'truecolor')
    errordlg('This is a true color image choose grayscale image');
elseif strcmp(imgInfo.ColorType,'indexed')
    errordlg('This is a indexed image choose grayscale image');
else
    errordlg('Incorrect file type choose grayscale image');
end
Let me know if this is what you want..
Good Luck
5 Commenti
  Gopichandh Danala
      
 il 7 Ott 2016
				
      Modificato: Gopichandh Danala
      
 il 7 Ott 2016
  
			I think u should post a detailed question on GUI with ur work so I can see and understand better, write whatever code wrote fr GUI and make a new question
  Walter Roberson
      
      
 il 7 Ott 2016
				For uint8 images,
negativeImage = uint8(255) - YourImage;
For average intensity, rgb2gray() and then mean2()
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Convert Image Type 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!