[英]How I can generate a voxel mesh from a set of points with x, y, and z coordinates in matlab
[英]How can I extract x and y coordinates from a line in an image in MATLAB?
您可以通過編程方式執行此操作,因為您要處理的是簡單的線條和干凈的圖像而幾乎沒有噪聲(在這種情況下為灰度強度uint8
圖像 )。 這是提取線的方法:
img = imread('1ebO0.png'); % Load image
mask = (img < 128); % Threshold to get a matrix of 0 and 1 (ones where your
% line is, zeroes elsewhere)
[~, index] = max(flipud(mask), [], 1); % Gives you the index of the first row from
% the bottom of the image where a 1 occurs
x = find(any(mask, 1)); % Find indices of columns that have at least one 1 to get x
y = index(x); % Trim row indices based on the above to get y
plot(x, y);
和線:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.