Reputation: 337
I'm using these lines of code to convert an RGB image to grayscale.
% ===========================
% GRAYSCALE IMAGE
% ===========================
% --- Executes on button press in btnGrayscale.
function btnGrayscale_Callback(hObject, eventdata, handles)
global origImage;
imageGray = rgb2gray(origImage);
axes(handles.axesEdited);
image(imageGray);
The output doesn't show a grayscale image though.
What seems to be the problem? I'm running MATLAB 6.5 on Windows 7, by the way.
Upvotes: 0
Views: 503
Reputation: 63
Another way can call one band to show the gray image
imshow(rgb(:,:,2));
Upvotes: 0
Reputation: 337
Thank you for the answers! I thought the problem's with my graphics driver (lol), but when I've tried showing the output on a figure (not on the axis), I found the problem.
Here's a simple solution I've found.
Instead of using image(imageGray);
, I've used imshow(imageGray);
.
Upvotes: 1