[image, depth, graspMaskImage, graspOutImage, graspUpImage] = getCorrectedValuesStanfordData(imageFilenumber, objectType);    
% This file assumes that all the data files are in same directory from where the function is called.
%imageFilenumber = 1, 2, 3, ...,10, 20, ..., 1200, etc.
%objectType = 'stapler', 'thickpencil', 'mug', 'twoMug', 'tea', 'twoTeaCups', 'martini', 'cerealbowl', or 'eraser'.

baseImageName = [ objectType sprintf('%04d', imageFileNumber) ];
image = double(imread(baseImageName, 'png')) / 255;
graspMaskImage = double(imread(['graspPriorityWidth_' baseImageName], 'png')) / 255;
graspOutImage = double(imread(['graspOutVec_' baseImageName], 'png')) / 255;
graspUpImage = double(imread(['graspUpVec_' baseImageName], 'png')) / 255;

if (strncmp(objectType, 'stapler') || strncmp(objectType, 'twoMug') || strncmp(objectType, 'twoTeaCups'))
  depth = 0; 
else
  depth = double(imread(['depth_' baseImageName], 'png')) / 255;
  gammaVal = 2.19
  image = image .^ gammaVal;
  depth = depth .^ gammaVal;
  graspMaskImage = graspMaskImage .^ gammaVal;
  graspOutImage = graspOutImage .^ gammaVal;
  graspUpImage = graspUpImage .^ gammaVal;

  minDepth = 0;
  maxDepth = 40;
  if strcmp(objectType, 'cerealbowl')
    maxDepth = 40;
  elseif strcmp(objectType, 'thickpencil')
    maxDepth = 50;
  elseif strcmp(objectType, 'martini')
    maxDepth = 80;
  elseif strcmp(objectType, 'teaTwo')
    maxDepth = 55;
  elseif strcmp(objectType, 'mug')
    maxDepth = 90;
  elseif strcmp(objectType, 'eraser')
    maxDepth = 40;
  end

  depth = (depth(:, :, 1) + depth(:, :, 2) + depth(:, :, 3)) / 3;
  depth = (maxDepth - minDepth) * depth + minDepth;
end
graspOutImage = 2*graspOutImage - 1;
graspUpImage = 2*graspUpImage - 1;
