ind2gray problem
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello eveyone, I have a small problem using the function ind2gray. Here is the code I wrote :
figure(4);
hen = line(x(3:end-1),y(3:end-1),'linestyle','none','marker','.','markersize',0.001,'color','k');
pbaspect([1 1 1])
set(gca,'xtick',[],'ytick',[])
saveas(gcf,'henon.tif');
[henon,map] = imread('henon.tif');
henon2 = ind2gray(henon,map);
I get this error :
Undefined function 'ind2gray' for input arguments of type 'uint8'.
But in the matlab documentation for ind2gray it is written :
X can be of class uint8, uint16, single, or double. map is double. I is of the same class as X.
further more, when I type whos henon I get :
whos henon
Name Size Bytes Class Attributes
henon 656x875x3 1722000 uint8
Is there something I am doing wrong ? I would like to simply create a grayscale picture from a figure. If anyone have a more simple way, please tell me ! Thank you.
2 Kommentare
Stephen23
am 19 Dez. 2017
% Has no license available
Didn't knew that i needed image processinf toolbox ! Thank you for your anwser.
Do you know if there is another way for me to create a grayscale picture ?
Antworten (1)
Guillaume
am 19 Dez. 2017
Bearbeitet: Guillaume
am 19 Dez. 2017
Do you know if there is another way for me to create a grayscale picture ?
This can be achieved any number of ways. An easy one is to convert your image to RGB (which doesn't require the image processing toolbox) then to greyscale
greyimage = rgb2gray(ind2rgb(yourindexedimage, yourmap));
This may or may not produce the same results as ind2gray (haven't tested) since there is no unique way to convert from colour to grey scale.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!