Artifact 254e74510319e8f997283c530ff3534fc06cf198:
- File
operator/upsampley-hsv.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: 1708) [more...]
upsampley_hsv Tcl_Obj* imageObj int factor /* * The input image is upsampled in the y direction by inserting 'factor-1' * 0-pixels after every pixel of the input. Note that this method of expanding * an image introduces copies of the input to appear at higher frequencies. * * The output image has to be convolved with a low-pass filter after expansion * to avoid such artefacts. The integrated combination of upsampling and such * a filter is called 'interpolation'. This is but one step in the generation * of difference image pyramids. */ crimp_image* image; crimp_image* result; int x, yo, yi, dy; crimp_input (imageObj, image, hsv); 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; yi < crimp_h (image); yo += factor, yi ++) { for (x = 0; x < crimp_w (image); x ++) { /* Copy the pixel */ H (result, x, yo) = H (image, x, yi); S (result, x, yo) = S (image, x, yi); V (result, x, yo) = V (image, x, yi); } /* And insert factor black lines after the intput line*/ for (dy = 1; dy < factor; dy++) { for (x = 0; x < crimp_w (image); x++) { H (result, x, yo + dy) = BLACK; S (result, x, yo + dy) = BLACK; V (result, x, yo + dy) = BLACK; } } } 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: */