function [ seuil ] = seuilhisto( Iin, Tini, dT)
%UNTITLED3 Summary of this function goes here
%   Detailed explanation goes here
[nb, gl] = imhist(Iin) ;
Ti = Tini ;

while abs((moyhisto(nb,gl,0,Ti-1)+moyhisto(nb,gl,Ti,255))/2-Ti) > dT,
    Ti = round((moyhisto(nb,gl,0,Ti-1)+moyhisto(nb,gl,Ti,255))/2) 
    
end
seuil = Ti ;
