Smooth region contour by taking local average (ROI)

2 views (last 30 days)
Hi guys!
I have created a program in matlab that detects edges by using adapthisteq and im2bw, working actually quite well. I thereby obtain a (binary mask) contour that is quite zigzag.
Now I want to replace the almost rectangular shapes in the image by smoother versions by taking local average of 30 or something px and replace the segment by a straight line with the average x-value (all lines are perpendicular to the x-axis).
I thought it might be possible to select a local region using imrect() and perform the operation therein, then calculate the line separation distance (= the value I actually need).
Can someone point me into the right direction or help me out with a code snipplet (especially how to create the average on the mask matrix in x-direction)?
I don't want to smooth the image too much first (which I tried) as it gives me a bad alignment with the original edge.
  1 Comment
Christoph
Christoph on 17 Jan 2013
I just want to add that even if this is not the best way t do it, it would be quite important to process the image in this way so the results can be compared with results we obtained with a proprietary product (that we try to 'emulate' for a lab exercise).

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!