1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- %% CALLED BY par4Gbl_Main8c.m %%
- %{
- %Imaging ToolBox method
- r=14;
- A=zeros(70,70); %(fIntsc(refPtR:(refPtRExt),refPtC:(refPtCExt)))
- m={40,40};
- A(m{:})=1;
- B=imdilate(A,strel('disk',r,0) );
- imshow(B)
- area=pi*r^2
- clear all
- %}
- %without Image Proc. Toolbox
- %r=14;
- %A=zeros(70,70);
- %A=zeros(r,r);
- %P=[40,40];
- %center=[refPtR+ round(.5*width), refPtC+ round(.5*width)];
- %A=zeros(70,70);
- %---------------------------------------------------------------------
- %radius=14;
- diaExt=2*(radius+1);
- circBoxA=zeros(diaExt,diaExt);
- center=[radius+2, radius+2];
- [m,n]=size(circBoxA);
- X=bsxfun(@plus,(1:m)', zeros(1,n));
- Y=bsxfun(@plus,(1:n), zeros(m,1));
- cirMask=sqrt(sum(bsxfun(@minus,cat(3,X,Y),reshape(center,1,1,[])) .^2,3))<=radius;
- area=pi*radius^2;
- cirPixA=nnz(cirMask);
- optCirMask=double(cirMask);
- optCirMask(optCirMask==0)=0.8;
- % Foto Circle Fram(e)
- expansion=2;
- radExpan=radius+expansion;
- FdiaExt=2*(radExpan);
- circBoxA=zeros(FdiaExt,FdiaExt);
- center=[radExpan+1, radExpan+1];
- [m, n ]=size(circBoxA);
- X=bsxfun(@plus,(1:m)', zeros(1,n));
- Y=bsxfun(@plus,(1:n), zeros(m,1));
- FcirMask=sqrt(sum(bsxfun(@minus,cat(3,X,Y),reshape(center,1,1,[])) .^2,3))<=radExpan;
- %FcirPixA=nnz(cirMask);
- FoptCirMask=double(FcirMask);
- FoptCirMask(FoptCirMask==1)=2;
- %FoptCirMask(FoptCirMask==0)=1;
- %********Combine Masks to create circular boundry************
- padOptCirMask=padarray(optCirMask,[expansion-1 expansion-1],0.8);
- FoptCirMask=FoptCirMask .* padOptCirMask;
- FoptCirMask(FoptCirMask==1.6)=0.8;
- FoptCirMask(FoptCirMask==0)=1;
- FoptCirMask(FoptCirMask==2)=1;
- %---------------------------------------------------
- %imagesc(cirMask)
|