Skip to content
Snippets Groups Projects
Commit 1a0af0b7 authored by Andrew Cohen's avatar Andrew Cohen
Browse files

new project

parents
No related branches found
No related tags found
No related merge requests found
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
function DrawPrincipalEllipse(c,r)
x = c-mean(c);
y = r-mean(r);
[U,S,V] = svd([x,y],'econ');
xyp = [x y]*V;
% plot(xyp(:,1),xyp(:,2),'.g')
r1 = max(abs(xyp(:,1)));
r2 = max(abs(xyp(:,2)));
theta=linspace(0,2*pi,1000);
cX = r1*sin(theta) ;
cY= r2*cos(theta);
plot(cX,cY,'.k');
function DrawPrincipalEllipse(c,r)
x = c-mean(c);
y = r-mean(r);
[U,S,V] = svd([x,y],'econ');
xyp = [x y]*V;
% plot(xyp(:,1),xyp(:,2),'.g')
r1 = max(abs(xyp(:,1)));
r2 = max(abs(xyp(:,2)));
theta=linspace(0,2*pi,1000);
cXp = r1*sin(theta)' ;
cYp= r2*cos(theta)';
cXY = [cXp cYp]/V;
cXY = [cXY(:,1)+mean(c) cXY(:,2)+mean(r)];
plot(cXY(:,1),cXY(:,2),'.k');
File added
File added
File added
im = imread('Ellipse2.tif');
imagesc(im)
[r c]=find(im);
obj=gmdistribution.fit([c,r],2);
idx = obj.cluster([c,r]);
idx1=find(1==idx);
idx2=find(2==idx);
hold on
plot(c(idx1),r(idx1),'.r');
plot(c(idx2),r(idx2),'.g');
DrawPrincipalEllipse(c(idx1),r(idx1));
DrawPrincipalEllipse(c(idx2),r(idx2));
\ No newline at end of file
load('Experiment\SWgeo\2.mat')
[mm idx]=max([rgExperiment.scoreGMM]);
Experiment=rgExperiment(idx);
save('Best2GM.mat','Experiment')
ptsCombined=vertcat(Experiment.pts{:});
idxCombined=sub2ind(size(im),1000-ptsCombined(:,2),ptsCombined(:,1));
bw=zeros(1000,1000);
bw(idxCombined)=1;
bw=bw(470:550,450:540);
figure;imshow(bw)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment