Synopsis
HxImageRep HxSqrt (HxImageRep img)
Input
HxImageRep img
Return value
HxImageRep
Description
The function HxSqrt takes the square root of each pixel value. The square root of a vector is defined by taking the square root of the components of the vector.
Remarks
Examples
Taking the square root of an image.
#include "HxImageRepGlobalFuncs.h" #include "HxImageRep.h" HxImageRep HxSqrtExample1(HxImageRep img) { img = HxImageAsDouble(img); img = HxSqrt(img); img = HxContrastStretch(img, 255.0); img = HxImageAsByte(img); return img; } int main(int argc, char* argv[]) { HxImageRep img = HxMakeFromFile(argv[1]); img = HxSqrtExample1(img); HxWriteFile(img, argv[2]); return 0; }
Input image for the HxSqrt example.
Output image of the HxSqrt example.
In this example we first convert the input image to a double valued image. We take the square root, after which we stretch the image to let it contain values ranges from 0.0 to 255.0 for visualization purposes.
See also
Keywords
Unary, Arithmetic,