MATLAB: Could anyone please help me to implement the following equation in matlab

round up and round down to nearest integer are used

where p1=1/2 and p2=1/2 & n1=2, n2=3 and n=1 & [xi, xi+1]belongs to (0,255) pixel pair of an image

Best Answer

Try this:
function val=imageFunc(x_i,x_i1)
p1=0.5;p2=0.5;n1=2;n2=3;n=1;
val=(x_i+(p1*x_i1)*n1+(p2*x_i1)*n2)*mod(2*n1+n2+1,10);
end