remove small blob by orientation

2 views (last 30 days)
michael scheinfeild
michael scheinfeild on 1 Oct 2014
Answered: Image Analyst on 1 Oct 2014
hi i have some square image and due to lighting condition i have some glare due to fluorescence so after some succes in binarization i remained some small blob i want to remove it if the shape in 0 so easily removed but i want to use the shape orientation for opening the small blob , i i use different strel like circle it will destroy the corners of the rectangle . as you see i added the reflctions in the table.
se=strel('line',200,0);
bwopenenedImage = imopen(bw,se);
the issue is the rectangle can be rotated a little , so i calculate the orientation of the shape
stats=regionprops(bw,'Area','Orientation');
Orientation: -2.8061
but if i doe strel line with this angle it is not good for me , maybe i need to quintize the angle to 4 : 0,45,90,135 ? anyway regionprops give the angle from -90 to 90 but strel line 0-360 ?
so the line wont be good for image opening

Answers (1)

Image Analyst
Image Analyst on 1 Oct 2014
The best thing is to just avoid the specular reflections in the first place. It looks like you can use crossed polarizers for that. It's a very very common trick in photography to remove shine and reflections. Can you do that?
The main axis of a rectangle, according to regionprops which fits an ellipse to it, is not along the long edge. Of course going along the diagonal is longer so the major axis is along that and that is what your orientation angle will reflect. I did give some rotation demo here: http://www.mathworks.com/matlabcentral/answers/154523-calculate-and-crop-image-based-on-coordinates#answer_151500. But it looks like if you have a rectangle with some little bumps/protrusions out of it, then morphological methods will smooth out or eliminate all bumps, even corners. If you need a perfect rectangle you may have to find the corners and create a perfect rectangle from those.
See attached demo to find the furthest points in a binary blob.

Community Treasure Hunt

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

Start Hunting!