Exclude from plotting some coordinates (born from blank .png images)
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Fifteen12
2022년 12월 19일
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?
채택된 답변
DGM
2022년 12월 19일
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
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!