简体   繁体   中英

How to find the maximum of opening in all orientations at a point in an image?

I need a bit of help. I am trying to segment out sort of zig-zag patterns in an image. I've an algorithm for this. For that I'm opening the image with a line structuring element. I want to perform repeated opening of the image using the line strel at various angles and find maximum of them at each pixel.

Following is a code snippet:

    while(i<360)
         se=strel('line',17,i);
         i=i+15;
         img=imopen(img,se);
    end;

Any help with the implementation will be appreciated.

From what I understand, you want to get maximum for each pixel from a stack of "opened" images?

% I assume the img is a 2D image (e.g. gray-scale one)
stack = [];

while(i<360)
         se=strel('line',17,i);
         i=i+15;
         stack(:,:, end+1) =imopen(img,se);
end;

The opened images will stack up in the stack matrix. Then to find maximum at each pixel, you can just search for maximum in 3th dimension:

max_pixels = max(stack, 3);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM