 function y = simple_objective(s,im_edge,im_angle,hz)
%   model krajnice
    
[rr cc]=find(im_edge);
suma=0;
nt=0;
a_width=50.0;
a_prox=0.01;
a_orient=1.13;


for i=1:size(rr,1)
    
    row=rr(i);
    col=cc(i);
    
     EL = s(1)/ (row - hz) + s(2) * (row - hz) + s(3);
     ER = s(1)/ (row - hz) + s(4) * (row - hz) + s(3);
     Del = s(2)-s(1)/((row-hz)^2);
     Der = s(4)-s(1)/((row-hz)^2);
     
        if(col==ceil(EL))
            nt=nt+1;
        end
        if(col==ceil(ER))
            nt=nt+1;
        end
         
         tmp1=im_edge(row,col)*f_ax(a_prox,col-EL);
         
         tmp2=f_ax(a_orient,cos(im_angle(row,col)-atan(Del)));
         
         tmp3=im_edge(row,col)*f_ax(a_prox,col-ER);
         
         tmp4=f_ax(a_orient,cos(im_angle(row,col)-atan(Der)));

         tmp5=tmp1*tmp2+tmp3*tmp4;
         
         
         if((~isnan(tmp5) && tmp5 ~= Inf))
             suma=suma+(tmp5);
         end   

end


 

     P=(2/pi) * atan( a_width * ( (s(4)) - (s(2))) );

 
L= ((P*suma))*nt;
if(L<0 || nt==0)
    y=0;
else
    y=-L;
end




end

