%   getposfromgraph

%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION. 

a=imread('F:\users\Peter\C++\plot2d\channelcfg.bmp','bmp');
a=double(a);
pos=find(a(:,:,1)+a(:,:,2)+a(:,:,3)<730);

groesse=size(a);
                                                                     
groesse(3)=[];
[x,y]=ind2sub(groesse,pos);
limit=length(x);
indices=zeros(limit,1);
m=1;
n=1;
for k=1:limit-1
for j=k+1:limit
    m=m+1;
    if m==1000
        fprintf('.');
        m=1;
        n=n+1;
    end
    if n==50;
        fprintf('\n');
        n=1;
    end    
    
    dist=((x(k)-x(j))^2+(y(k)-y(j))^2)^0.5;
    if (((x(k)-x(j))^2+(y(k)-y(j))^2)^0.5)<3
        indices(j)=1;
    end
end
end
x(find(indices==1))=[];
y(find(indices==1))=[];
plot(x,y,'o')
fclose all

