a | b/combinedDeepLearningActiveContour/functions/png2contour.m | ||
---|---|---|---|
1 | |||
2 | function [contour,I1]=png2contour(I) |
||
3 | |||
4 | A=rgb2gray(I); |
||
5 | [x1,y1]=size(A); |
||
6 | I1=A(:,501:end-502); |
||
7 | |||
8 | [x,y]=size(I1); |
||
9 | count=0; |
||
10 | for i=1:x |
||
11 | for j=1:y |
||
12 | if I1(i,j)==150 |
||
13 | count=count+1; |
||
14 | new_x(count)=j; |
||
15 | new_y(count)=i; |
||
16 | end |
||
17 | end |
||
18 | end |
||
19 | |||
20 | contour(:,1)=new_x*256/x1; |
||
21 | contour(:,2)=new_y*256/x1; |
||
22 | |||
23 | end |