Date: Dec 28, 2012 2:33 PM
Author: sudesh
Subject: Minimize a function

I need to minimize the following function for edge preservation in image restoration -

F(u)=summation of (abs(u(i,j)-y(i,j)) + 5/2(S1+S2)) ..... summation over all (i,j) belongs to Noisy set N
here S1=Summation of(2*abs(u(i,j)-u(m,n))^1.3) summation over all (m,n) belongs to some set N1
and
S2=Summation of(abs(u(i,j)-u(m,n))^1.3) summation over all (m,n) belongs to some set N2

Given: y is noisy image, amy as image obtained by adaptive median filter is given.

I have been trying to code this problem in following way, but not able to understand this correctly.

----------------------------
for i=1:numel(N)
V=[i-1 i+1 i-row i+row];
V(V<=0)=[];
NcV=intersect(V,Nc);
NV=intersect(V,N);
S1=0;S2=0;
for nm=1:numel(NcV)
S1=S1+(2*(abs(amy(N(i))-y(NcV(nm))))^1.3);
end

for nm=1:numel(NV)
S2=S2+(abs(amy(N(i))-y(NV(nm))))^1.3;
end
sum=sum+abs(amy(N(i))-y(N(i)))+(5/2)*(S1+S2);
end
-----------------------------

I think I need to include some function from optimization toolbox but dont know how in this situation. Please suggest!!!!