threshold_hsv Tcl_Obj* imageObj Tcl_Obj* thresholdHObj Tcl_Obj* thresholdSObj Tcl_Obj* thresholdVObj crimp_image* image; crimp_image* thresholdh; crimp_image* thresholds; crimp_image* thresholdv; crimp_image* result; int x, y; crimp_input (imageObj, image, hsv); crimp_input (thresholdHObj, thresholdh, grey8); crimp_input (thresholdSObj, thresholds, grey8); crimp_input (thresholdVObj, thresholdv, grey8); result = crimp_new_like (image); for (y = 0; y < image->h; y++) { for (x = 0; x < image->w; x++) { H (result, x, y) = H (image, x, y) >= GREY8 (thresholdh, x, y) ? BLACK : WHITE; S (result, x, y) = S (image, x, y) >= GREY8 (thresholds, x, y) ? BLACK : WHITE; V (result, x, y) = V (image, x, y) >= GREY8 (thresholdv, x, y) ? BLACK : WHITE; } } Tcl_SetObjResult(interp, crimp_new_image_obj (result)); return TCL_OK; /* vim: set sts=4 sw=4 tw=80 et ft=c: */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */