I am trying to calculate the lengt of different lines in one image all labeled, i used the code below in order to obtain the figure below, but i want to know what amount of pixels are horizontal, vertical and diagonal (eg. in this picture 5 diagonal and 1 vertical).
Is there a way to get this data?
imagesc(bwmorph(I_temp,'skel'))

 採用された回答

KSSV
KSSV 2019 年 1 月 29 日
編集済み: KSSV 2019 年 1 月 29 日

1 投票

[a,b]=hist(I_temp(:),unique(I_temp(:)))

2 件のコメント

Bart Smulders
Bart Smulders 2019 年 1 月 29 日
this just gives me a value of a=1 and b=1, am i doing something wrong in my code?
clear all; clc;
cur_dir = 'C:\RESULTS';
I = double(imread([cur_dir '\proccesed\424.bmp']));
BW = logical(I);
L = bwlabel(BW,4);
Data = regionprops(L,'All');
stats = regionprops('table',L,'BoundingBox','area');
area_values = [stats.Area];
idx = find((10 <=area_values) & (area_values <= 2000));
h=ismember(L, idx);
I_temp = Data(1).Image;
imagesc(I_temp);
imagesc(bwmorph(I_temp,'skel'))
[a,b]=hist(I_temp,unique(I_temp))
KSSV
KSSV 2019 年 1 月 29 日
Use I_temp(:)..edited the code.

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

その他の回答 (0 件)

質問済み:

2019 年 1 月 29 日

コメント済み:

2019 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by