Synopsis
HxImageRep HxCos (HxImageRep img)
Input
HxImageRep img
Return value
HxImageRep
Description
This function takes the cosine of every pixel value of the input image. For vector images, the cosine of every element of the vector is taken.
Remarks
Examples
Taking the cosine of an image.
#include "HxImageRepGlobalFuncs.h" #include "HxImageRep.h" HxImageRep HxCosExample1() { HxSizes sizes(256, 256, 0); double data[256*256]; for(int i=0; i<256; i++) for(int j=0; j<256; j++) { data[i+j*256]=(i/32.0)*(i/32.0); } HxImageRep img = HxMakeFromDoubleData(1, 2, sizes, data); img = HxCos(img); img = HxContrastStretch(img, 255.0); img = HxImageAsByte(img); return img; } int main(int argc, char* argv[]) { HxImageRep img = HxCosExample1(); HxWriteFile(img, argv[1]); return 0; }
Output image of the HxCos example.
This example generates an images with a number of stripes, using the cosine function.
See also
Keywords
Unary, Trigonometric,