apply filter to a *circular* image

조회 수: 10 (최근 30일)
Michael
Michael 2012년 5월 23일
hello
I'm trying to filter a circular image, the circle fits inside a square matrix, so for a 100x100 matrix the radius is 50 and there are some "blank" areas in the corners. When I try to filter this normally, the edges of my circular image become distorted because they attain a contribution from pixels outside the circumference.
I've had a look at "roifilt2" and the wording of the function implies it still uses values from pixels outside the circle to calculate filtered values of pixels inside the circle (the only different being it does not update the pixels outside the region of interest). So I'm not convinced this works either.
Does anyone have any ideas? My next step is to see if I can manually edit the filter2, but this will probably take a long time. Thanks for any help
Mike

채택된 답변

Image Analyst
Image Analyst 2012년 5월 23일
I think you're going to have to handle those boundary effects manually. Sliding window kinds of filters have the same shape as they slide along, no matter what's underneath them. If you need to modify your sliding kernel, depending on what (x,y) coordinate it's over then you'll have to put in special code for that. You might use nlfilter for that.
  댓글 수: 2
Michael
Michael 2012년 5월 31일
Thanks. It appears nlfilter only takes as an argument the value of the image elements, not the pixel indices themselves. Perhaps I can set all the "non-circle" elements to -1 and write a function which ignores contributions with that exact value. Thanks for the help again!
Michael
Michael 2012년 5월 31일
hmm, this is extremely slow.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by