Image load problem (HELP)

조회 수: 13 (최근 30일)
zhixuan hong
zhixuan hong 2018년 3월 19일
댓글: zhixuan hong 2018년 3월 19일
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.
  댓글 수: 1
zhixuan hong
zhixuan hong 2018년 3월 19일
thank you so much !!

댓글을 달려면 로그인하십시오.

추가 답변 (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