Local histogram equalization - Using the function 'histeq' in nlfilter/colfilt
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi Guys,
I need to perform a neighbourhood sliding window operation, that calculates the local histogram of the window, and assigns it to the pixel.
When I use the below code,
g=colfilt(fp,[m n],'sliding',@histeq);
I receive the error as "??? Assignment has more non-singleton rhs dimensions than non-singleton subscripts".
Can someone please advise on this? Thank you for your time.
0 comentarios
Respuesta aceptada
Dishant Arora
el 7 de Sept. de 2012
g=colfilt(fp,[m n],'sliding',@fun);
here fun operates on individual columns(neighbourhood of a pixel) and must return a row vector. but in your case histeq doesnt return a row vector, So, i guess you cant use colfilt, you may use blkproc.
g=blkproc(fp,[m n], @histeq);
Más respuestas (1)
Image Analyst
el 7 de Sept. de 2012
You probably don't want that anyway. If you're doing a locally adaptive histogram equalization, you want to use adapthisteq(), which is the function meant for doing that.
4 comentarios
Eric
el 10 de Sept. de 2012
@Image Analyst: I disagree a bit with your statement that colfilt is "one of those weird, rarely-used functions", as I've used it on several occasions. I generally get much better performance with colfilt() as compared to nlfilter().
For example, I have written implementations of K-nearest-neighbor and bilateral filtering using colfilt(). I'd have to re-write my code to check, but I recall colfilt() working at least an order of magnitude faster. From the documentation:
" Note colfilt can perform operations similar to blockproc and nlfilter, but often executes much faster. "
It's considerably more difficult to write code for colfilt() as compared to the others and not all algorithms are amenable for use with colfilt(). However, there are times when it is quite useful for speeding up algorithms.
Also, thanks for the pointer to adapthisteq. Somehow I've missed this one. I'd actually gone to the trouble of writing my own version of Pizer's AHE algorithm (S. M. Pizer, E. P. Amburn, J. D. Austin, R. Cromartie, A. Geselowitz, T. Greer, B. Terhaarromeny, J. B. Zimmerman, and K. Zuiderveld, "Adaptive Histogram Equalization and Its Variations," Comput Vision Graph 39, 355-368 (1987)), which I believe is pretty much the same thing.
Thanks,
Eric
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!