I have a binary image which I used bwconncomp and regionprops on to divide into regions of interest. I have a line of pixels which I want to lay across the binary image...and find which region of interest/connected component has the most line pixels in it. So in the attached image I use bwconncomp on bwimage, I get components 1,2,3. Then I have a list of pixels corresponding to the blue line. I want to find which connected component has the most of the blue line in it (#1).
I imagine its something like...
line=(some pixel values);
cc=bwconncomps(bwimage);
tempvar=[];
for i=1:length(bwconncomps)
tempvar=find(cc.PixelIdxList{i}==line);
end
[~ answer]=max(tempvar);
