ismember with regionprops returning all zeros?
1 view (last 30 days)
Show older comments
I am trying to find the closest objects in a new frame with the same area as objects in a previous frame and then remove all extra objects from the new frame. I have generated a set of indicies for the area and centroid values I want to keep within the arrays created by the regionprops function. I attempted to use ismember to remove all other objects but the output is an all zero array. Based on the page for regionprops talking about using it with ismember, I expected giving ismember an image and indicies would return an image with the regions corresponding to the provided indicies, and as far as I can tell that is what I am inputting. I've attached the variable and an example of my use of ismember. Can anyone let me know what I am missing?
%Loading in files and converting type
currentFrame = load('New_Frame_Image.mat');
currentFrame = logical(cell2mat(struct2cell(currentFrame)));
matching_indicies = load('Indicies_of_Closest_Matching_Area_New_Frame.mat');
matching_indicies = cell2mat(struct2cell(matching_indicies));
%Using ismember
newImage = ismember(currentFrame,matching_indicies);
zero_entries = numel(newImage==0) %512x512 image
0 Comments
Answers (1)
Image Analyst
on 19 Mar 2023
If you still need help, attach the two segmented (binary) images (one for each frame) and I'll show you how to do it.
0 Comments
See Also
Categories
Find more on Computer Vision with Simulink 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!