Connected components for periodic image
9 views (last 30 days)
Show older comments
I'm trying to test for the connectivity of pixels in a square 2D binary image, but the catch is the image repeats itself periodically.
I'm wondering if I can do this using something like bwconncomp, but I'm having trouble implementing the periodic boundary condition.
For example, say I enter
B = [1 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 1];
CC = bwconncomp(B,8) % I'm considering 8 connectivity
I get
CC =
Connectivity: 8
ImageSize: [4 4]
NumObjects: 2
PixelIdxList: {[1] [16]}
With the new code, I would get 1 object with PixelIdxList returning {[1; 16]}
Your help would be greatly appreciated...
0 Comments
Answers (1)
Image Analyst
on 10 Apr 2014
I think you'll have to "manually" relabel the blobs on the other side based on their location. Scan the border and if there's a blob there, see if there is a blob on the other side that would be touching it. If there is, reassign it's label to the blob that you're working on.
1 Comment
Geoff Stanley
on 15 Feb 2018
I had the same problem. I've written a function that does this task, called CC2periodic, available at https://uk.mathworks.com/matlabcentral/fileexchange/66079-cc2periodic
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!