필터 지우기
필터 지우기

How to convert an image from 3d to 2d?

조회 수: 2 (최근 30일)
Richa Nayak
Richa Nayak 2012년 11월 1일
I got following error while processing it.
Error using ==> iptcheckinput Function HISTEQ expected its first input, I, to be two-dimensional.
Error in ==> histeq at 71
iptcheckinput(a,{'uint8','uint16','double','int16','single'}, ...
Error in ==> Project_Stage_1 at 9
I2 = histeq(f); %improve contrast
  댓글 수: 2
Matt J
Matt J 2012년 11월 1일
Well, why doubt the error message? Is f two-dimensional or isn't it?
Richa Nayak
Richa Nayak 2012년 11월 11일
The image is 3d i think. that is f. I need to convert it to 2d for running the prog apparantly. I cant upload the image here. ne suggestions?

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

답변 (1개)

Image Analyst
Image Analyst 2012년 11월 1일
You can't do it on a color image. You can do it on each color channel, one at a time,
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
or convert to hsv colorspace
% Extract the individual red, green, and blue color channels.
hsv = rgb2hsv(rgbImage);
hChannel = hsv (:, :, 1);
sChannel = hsv (:, :, 2);
vChannel = hsv (:, :, 3);
and do it on the v channel - this is the best way and it avoids severe color artifacts like you'll have doing it in RGB space.

Community Treasure Hunt

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

Start Hunting!

Translated by