ind2gray problem
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2017-12-19
% 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 ?
回答(1 个)
Guillaume
2017-12-19
编辑:Guillaume
2017-12-19
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Filtering and Enhancement 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!