function featureVector = makeJustinFeatureVector(img, scales)
% This code is copyrighted by Stanford University.
% Author: Ashutosh Saxena, Justin Drieymeyer
% Code cannot be used for commercial purposes.
% Use of the code, if used with permission from authors, must acknowledge:
% Learning to Grasp Novel Objects using Vision,
% Ashutosh Saxena, Justin Driemeyer, Justin Kearns, Chioma Osondu, Andrew Y. Ng. In 10th International Symposium on Experimental Robotics, ISER, 2006.
% Robotic Grasping of Novel Obects,
% Ashutosh Saxena, Justing Driemeyer, Justin Kearns, Andrew Y. Ng, In Neural Information Processing Systems (NIPS), 2006.
% More details at: http://ai.stanford.edu/~asaxena/learninggrasp/
% Version 0.1:   Aug 2006.

if nargin < 2
    scales = [1 2 5];
end
type = 'laws';


global nDim
global nGridCol nGridRow

numscales = length(scales);
% Fix the number of features to be a variable
featureVector = zeros(nGridRow, nGridCol, numscales*nDim);

for s=1:numscales
	scale = scales(s);
    dimensionIndex = ((s-1)*nDim + 1):(s*nDim);
	if scale == 1
		featureVector(:, :, dimensionIndex) = ...
			makeScaledFeatureTexture(img, type, scale);
	elseif scale > 1
		tmp = imresize(img, 1/(2*(scale-1)+1));
		featureVector(:, :, dimensionIndex) = ...
			makeScaledFeatureTexture(tmp, type, scale);
	elseif scale == -1
		tmp = imresize(img, 1/columnscale);
		featureVector(:, :, dimensionIndex) = ...
			makeColumnFeatureTexture(tmp, type, numcolumns);
	elseif scale == -2
		tmp = imresize(img, 1/wholescale);
		featureVector(:, :, dimensionIndex) = ...
			makeImageFeatureTexture(tmp, type);
	end
end

%featureVector = featureVector(:,:,12:17) + featureVector(:,:,17:-1:12);

return;
