ismember with regionprops returning all zeros?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Image Analyst
2023-3-19
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!