add gray threhold