Exporting coordinates from a binary image

8 ビュー (過去 30 日間)
LUIS MARIA ROSETY BERNAL
LUIS MARIA ROSETY BERNAL 2022 年 2 月 17 日
コメント済み: Image Analyst 2022 年 2 月 18 日
I would like to extract the necessary coordinates of these structures in order to introduce them in a software that will use them as input to reproduce the image for mechanical simulation purposes. I have never used a matlab-based image analysis approach, would you know how proceed?

採用された回答

yanqi liu
yanqi liu 2022 年 2 月 18 日
yes,sir,may be use image label to get every block,such as
clc; clear all; close all;
[img,map] = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/898115/image.png');
if ~isempty(map)
img = ind2rgb(img,map);
end
bw = im2bw(img,0.2);
bw2 = imclose(bw,strel('line',100,0));
bw2 = imclose(bw2,strel('line',50,90));
bw2 = imfill(bw2, 'holes');
bt = logical(bw2-bw);
[L,num] = bwlabel(bt);
% choose block
figure; imshow(img, []); hold on;
h = imshow(label2rgb(L));
set(h,'AlphaData',0.6)

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 2 月 17 日
Not sure what that software wants, but it looks like those are outlines of labeled regions, so you could extract each region one at a time with ismember() and then use bwboundaries() to get the (x,y) coordinates of the single region and write it out. Then just repeat for every region.
  2 件のコメント
LUIS MARIA ROSETY BERNAL
LUIS MARIA ROSETY BERNAL 2022 年 2 月 18 日
So i have to clarify that I am a newbie with matlab. this is a CAD software where i need to provide coordinates ( (x,y) values ) in order to reproduce this same image. what I need is to export the coordinates of the cells that have a value different from 0.
Image Analyst
Image Analyst 2022 年 2 月 18 日
It looks like that is just the binary image you posted. Is that what your program wants?

サインインしてコメントする。

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by