Exclude from plotting some coordinates (born from blank .png images)

1 vue (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 19 Déc 2022
Réponse apportée : DGM le 19 Déc 2022
Hello! Maybe the title will not be well clear but I hope I am clear in my goal.
I have the attached code along with some .png figures.
What I want to achieve is the figure below though with the exclusion of those nodes that are created when a "white" .png image is read (.png image with no black curve).
I also want to keep the position of the white .png image with that Y coordinate (z in the code).
I had thought about the "isempty" command but I am not clear where and how to use it in my code (and also if it is suitable to use it).
I hope I have been clear. I thank to those who can help me.
  1 commentaire
Fifteen12
Fifteen12 le 19 Déc 2022
Hi Alberto, I'm not sure I know what you're trying to do--are you trying to parse PNGs? How are these nodes arising? Can you share more information about what is causing these nodes to occur?

Connectez-vous pour commenter.

Réponse acceptée

DGM
DGM le 19 Déc 2022
One simple way to skip plotting those cases would be to just do this modification:
for k = 1:length(imageFiles)
baseFileName = imageFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf('Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
binaryImage = imageArray;
binaryImage = ~binaryImage;
M1 = function_verification_code(binaryImage);
% only plot if there's more than one point
if size(M1,1)>1
% Switch to the figure for the 3-D plotting:
figure(hFig3);
current_z = z(k) * ones(size(M1, 1), 1);
plot3(M1(:, 2), current_z, M1(:, 1), 'b.');
hold on
drawnow;
end
end

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by