필터 지우기
필터 지우기

How to histogram equilize an image?

조회 수: 6 (최근 30일)
Manoj Murali
Manoj Murali 2012년 2월 24일
Suppose i have a set of face images I1,I2, ,IM ,size of each image being LxL,in the training set.Now how to histogram equalize all the images and represent them as row vectors of size L^2 (i mean L to the power 2)each...

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 2월 24일
doc histeq
doc reshape
  댓글 수: 2
Manoj Murali
Manoj Murali 2012년 2월 24일
Error:
??? 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 ==> histeq1 at 3
J = histeq(I);
the code I wrote is:
clc;
I = imread('C:\Users\Manoj\Documents\MATLAB\sorry.tif');
J = histeq(I);
imshow(I)
figure, imshow(J)
Jurgen
Jurgen 2012년 11월 15일
편집: Jurgen 2012년 11월 15일
Your error is because the matrix you want to equalize is not 2D. Im assuming its an RGB image. Either equalize all color channels separately (dangerous) or convert to a difference colorspace.
If you convert to e.g. L*a*b* or YCbCr you only need to equalize the luma channel, and then convert back again to RGB.
Note you can not represent an LxL RGB image as a vector of length L^2 without resorting to:
  1. throwing away data (e.g. color)
  2. indexing or some other form of encoding.This is because your RGB image contains LxLx3 elements.
Suppose you convert to grayscale then it is possible by using reshape or just J(:). To avoid columnwise dumping transpose first (permute for N-Dim.) e.g. (J = J').

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

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by