From bug-octave-request at bevo dot che dot wisc dot edu Tue Feb 17 03:16:45 2004 Subject: imaging bugs From: Stefan van der Walt To: bug-octave at bevo dot che dot wisc dot edu Date: Tue, 17 Feb 2004 11:15:15 +0200 'imread' returns incorrect map: ------------------------------- octave:32> [I, map] = imread('../images/lenna256.jpg'); octave:33> min(min(map)) ans = -0.0078125 Map should be in [0, 1] 'histeq' not correct: --------------------- octave:68> a = histeq(I/256, 256); octave:69> max(max(a)) ans = 61 Also, the resulting image is incorrect. I have written comments for the case when running this function on a gray scale lena256: function J = histeq (I, n) [r,c] = size (I); [X,map] = gray2ind(I); % map is 64 scales of gray, thus X maximum 64 [nn,xx] = imhist(I); % intensity image: 256 bins [0, 255] Icdf = ceil (n * cumsum (1/prod(size(I)) * nn)); J = reshape(Icdf(X),r,c); % !! Incorrect -- Icdf is 1x256, % !! while X is maximum 64 plot(Icdf,'b;;'); endfunction Maybe this would provide a working solution? J = reshape(Icdf(X/length(map)*length(xx)),r,c); ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------