Local histogram equalization - Using the function 'histeq' in nlfilter/colfilt
이전 댓글 표시
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.
채택된 답변
추가 답변 (1개)
Image Analyst
2012년 9월 7일
2 개 추천
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
Pradeep Kumar
2012년 9월 7일
Image Analyst
2012년 9월 7일
Yes, but the values in between the tiles are interpolated to give a smooth appearance, so it doesn't look like there are vastly different tiles in your output image. colfilt() is one of those weird, rarely-used functions - most people use blockproc() instead to do this kind of thing. Alternatively you can use nlfilter().
Pradeep Kumar
2012년 9월 7일
Eric
2012년 9월 10일
@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
카테고리
도움말 센터 및 File Exchange에서 Contrast Adjustment에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!