%
% f.m
%
% Function f for fmin to estimate camera gamma
%
% Hui Li
% 3/7/2000
%	

function y = f(x)

load GPval;
load sval;
P1 = GPval;
P2 = sval;

y= (abs(P1(1)^x-P2(1)) + abs(P1(2)^x-P2(2)) + abs(P1(3)^x-P2(3)) + abs(P1(4)^x-P2(4)) + abs(P1(5)^x-P2(5)) + abs(P1(6)^x-P2(6)) + abs(P1(7)^x-P2(7)) + abs(P1(8)^x-P2(8)) + abs(P1(9)^x-P2(9)))/9;
 
%x = fmin('f', 0, 3, sqrt(2));
