function res = photometricStereo (testimage, imagemask)
% This is the main program for Project 3. Simply give it the filename
% holding all of the chrome image filenames, and the filename holding 
% all of the images, and the program takes care of everything.

% Overall we assume the center of the chrome is the coordinate center.


% Here we need to read images

%chrome = readimage(chromefile);
%testimage = readimage(testfile);


% We just load a matrix with have all the chrome image and test image.
load myimage;

%now get bright spot from the chrome image. The output should be the pixel
%value. 
brightSpot = getBrightSpotOnSphere(chrome, chromemask);

% Get the center and radius of the chrome. The output should be the pixel
% value for the center of chrome, and number of pixels for the radius.
[center, radius] = getCenterOfSphere(chromemask);

% Get light directioin
% Assume the chrome center is the cooridnate origin. The output is based on
% this assumption.
lightDir = getLightingDirection(brightSpot, center, radius);

% Get albedo and nromal vector (of the test image) on the surface, given a
% light direction.

[albedo, normVec] = getOneNorm(lightDir, eval(testimage), eval(imagemask));

% create the depth, given the normal and image.
depthMap = make3Dsurface(normVec, eval(testimage), eval(imagemask));

    



