scan through bwconncomp PixelIdxList in another image

Hello. I am working on an image processing project.I have generated a binary image from an image and used the bwconncomp to detect closed contours.
Next I would like to scan each Pixel group in another image and analyse the value that is in them.
gammabin = zeros(size(lens_mask)); % Creating a zero Matrix with image size
gammabin(gammafactor > 0.038) = 1; % Setting my binary limit value
CCgamma=bwconncomp(gammabin); % Generating Closed contour struct
% größte Region identifizieren - das ist die Linse
numPixels = cellfun(@numel,CCgamma.PixelIdxList); Generating %array with number of pixels for every cluster
% Looking for clusters bigger than 25
for i = 1:CCgamma.NumObjects
if numPixels(i) > 25
for j = 1 : numPixels(i)
% This is were I am kind of stuck
end
end
end

4 Comments

May be I can help you. Can you share more detail? It would be easier to understand the question with sample example. What does it means "Pixel group"? Some blockwise perration write or individual pixel.
numPixels(i)?? Is the numPixels is vector?
Please attach the lens_mask image. Please attach some screenshots.
See my Image Segmentation Tutorial:
First I would like to thank you all for responding on my question.
KALYAN ACHARJYA:
numPixels is a vector that holds the amount of pixels in a closed contour (White) whitin the binary image gammabin. I have attached the figure.
Image Analyst:
Lens_mask, This is a binary matrix that helps me masking the background around my object, please take a look at the attachment.
As you know the function bwconncomp returns a structere that holds the amount of closed contours within a binary image, and the coordinaates of these closed contours. I would like to be able to take these coordinates and scan through them on another image (That has the same size).
Thank you all for your support. I was able to find a solution using linear indexing. apperantly every cell in the object PixelIdxList is a vector that holds all linear indexes of a certain closed contour within a picture.

Sign in to comment.

Answers (0)

Products

Release

R2020b

Asked:

on 20 Nov 2020

Commented:

on 24 Nov 2020

Community Treasure Hunt

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

Start Hunting!