%makeControl

clf
clear
close all


cd /Users/cmhamiltonian/Documents/Matlab


height =1900;
width  = 1800;
H = 980;
K = 1000;
Radius = 940;

cd /Volumes/CFE/001-CFE001-82/20120531/001-CFE001-82-LED
bmpImages = dir('*.bmp')


i = 2

LEDcontrol = bmpImages(i).name;
control = imread(LEDcontrol);
%figure, imshow(control) 

level = .4                     %graythresh(IsSelect)
        bwControl = im2bw(control,level);
        figure, imshow(bwControl)
q=imtool(bwControl)



for y = 1:height
    for x = 1:width
        r = sqrt(((y-K)^2)+((x-H)^2));
        if (r > Radius)
            bwControl(y,x) = 0;
        end
        if (r<Radius)
            bwControl(y,x) = 1;
        end
    end
end
figure, imshow(bwControl)
% s = imtool(bwControl)
controlName = strcat('control_',int2str(i));
% saveas(gcf,[controlName,'.bmp']);

