function [model] = learnDistribution(image,manual,method) model.h=[0 0]; model.center = [0 0]; width = 0; height = 0; sz = size(manual); if(sz(2)==1) figure(1); imshow(image); colormap(gray); drawnow; rectangle = ginput topLeft = rectangle(1,:); bottomRight = rectangle(2,:); dimensions = bottomRight - topLeft; width = round(dimensions(1,1)) height = round(dimensions(1,2)) xoffset = round(topLeft(1,1)) yoffset = round(topLeft(1,2)) model.h = [round(width/2) round(height/2)]; model.center = [(xoffset + model.h(1)) (yoffset + model.h(2))]; region = image(yoffset:yoffset+height-1,xoffset:xoffset+width-1); %figure(2); %imagesc(region); colormap(gray); drawnow; end if(sz(2) == 4) model.center = [manual(1) manual(2)]; model.h = [manual(3) manual(4)]; end region = image; %Set up the smoothing filter smooth = [.0625 .125 .0625; .125 .25 .125; .0625 .125 .0625]; %Set up the differentiator %Use simple difference if(method==0) fx=[1,-1]; fy=fx'; end %Use first derivative of the Gaussian - i.e. Canny Edge-Detector if(method==1) end imageDx = conv2(region,fx); imageDy = conv2(region,fy); model = defineModel(imageDx,imageDy,model,16); illustrateDist(image,model.h,model.center,model.modelDist) %figure(1); %imagesc(uint8(model.modelDist)); %figure(2); %imagesc(uint8(distribution/C));