Artifact 5eb6c030647e52f047fe5f48ea54fe9223437250:
- File
operator/downsampley-float.crimp
— part of check-in
[122bdc7d78]
at
2011-12-14 21:53:28
on branch infinite-plane
— Continued from previous commit.
Left to check/modify are
unary: ahe, convolve, region_sum, rof
binary: atan2, hypot, pow, cannyinternal, complex div/multiply, join, joint-bilateral, threshold
other: warp-field, cut (*)
(*) Currently done via 'crop', semantic mismatch. Better as their own operator. (user: andreask size: 1365) [more...]
downsampley_float Tcl_Obj* imageObj int factor /* * The input image is downsampled in the y direction by storing only every * 'factor' pixel into the result. Note that this method of shrinking an image * causes image frequencies above the nyquist threshold of the result to be * aliased into the range. * * The input image has to be convolved with a low-pass filter first, to avoid * such artefacts. The integrated combination of such a filter with * downsampling is called 'decimation'. This is but one step in the generation * of image pyramids. */ crimp_image* image; crimp_image* result; int x, yo, yi; crimp_input (imageObj, image, float); if (factor < 1) { Tcl_SetResult(interp, "bad sampling factor, expected integer > 0", TCL_STATIC); return TCL_ERROR; } if (factor == 1) { Tcl_SetObjResult(interp, imageObj); return TCL_OK; } result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor); for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) { for (x = 0; x < crimp_w (result); x++) { FLOATP (result, x, yo) = FLOATP (image, x, yi); } } 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: */