Image load problem (HELP)

13 次查看(过去 30 天)
Hi , my question is How to load different type of image into program.
I have two type of image which are 8bit depth (grayscale) and 24bit depth (RGB).
However, the wiener2 noise filter function only can read image with 8 bit depth .
The following code is my idea ,but I don't know how to define the bit depth of a /chosenfile .It is possible to work ? or any idea?
[file path] = uigetfile('*.jpg','Select any image');
chosenfile = [path file];
a = imread(chosenfile);
if BitDepth(a) == 24 ;
b=rgb2gray(a);
c=wiener2(b,[2,2]);
axes(handles.axes1)
imshow(c)
handles.c=c;
guidata(hObject, handles)
else
b=wiener2(a,[2,2]);
axes(handles.axes1)
imshow(b)
handles.b=b;
guidata(hObject, handles)
end

采纳的回答

Walter Roberson
Walter Roberson 2018-3-19
if ndims(a) > 2 then a is not grayscale.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by