1CONVERSIONS(3) Library Functions Manual CONVERSIONS(3)
2
3
4
6 im_c2amph, im_c2imag, im_c2ps, im_c2real, im_clip2fmt, im_ri2c - con‐
7 version between image types
8
10 #include <vips/vips.h>
11
12 int im_c2amph(in, out)
13 IMAGE *in, *out;
14
15 int im_c2rect(in, out)
16 IMAGE *in, *out;
17
18 int im_c2imag(in, out)
19 IMAGE *in, *out;
20
21 int im_c2ps(in, out)
22 IMAGE *in, *out;
23
24 int im_c2real(in, out)
25 IMAGE *in, *out;
26
27 int im_clip2fmt(in, out, ofmt)
28 IMAGE *in, *out;
29 int ofmt;
30
31 int im_ri2c(in1, in2, out)
32 IMAGE *in1, *in2, *out;
33
35 Each of the above functions converts the image held by the image
36 descriptor in to another type image and writes the result on the image
37 descriptor out. Sizes and the number of channels are identical to
38 those of input. Whenever required by the conversion, the element val‐
39 ues are rounded by calling floor().
40
41 im_c2amph() converts a complex (float or double) input to (amplitude,
42 phase), with phase in degrees. Output has the same format as input.
43
44 im_c2rect() converts a complex (float or double) input in (amplitude,
45 phase) form back to rectangular coordinates. Again, phase should be
46 expressed in degrees.
47
48 im_c2ps() convert a (float or double) complex image to amplitude (float
49 or double) image. Complex input (a,b) is mapped to sqrt( a*a+b*b ).
50
51 im_clip2fmt() converts the input image to 'ofmt', where ofmt is the new
52 value for BandFmt. For example, im_clip2fmt(in, out, FMTUSHORT) con‐
53 verts any image to unsigned short.
54
55 The number of clipped values (if any), are printed in the standard
56 error output. Before clipping rounding is carried out if necessary.
57 When converting between real and complex types with these functions,
58 the imaginary part of the output is set to zero. When converting from
59 complex to real types, the imaginary part is ignored. Use im_c2ps(),
60 im_c2real() etc. to get other behaviour.
61
62 Legacy functions are available, called im_clip(), im_clip2c(),
63 im_clip2d(), im_clip2f(), im_clip2i(), im_clip2s(), im_clip2ui(),
64 im_clip2us(), im_clip2cm() and im_clip2dcm() which convert the input
65 image to unsigned char, signed char, double, float, int, short,
66 unsigned int, unsigned short, complex and double complex respectively.
67
68 im_ri2c() takes as inputs two non-complex images of equal sizes and
69 number of channels. The output is a complex image with the real part
70 coming from in1 and the imaginary part coming from in2. Output is
71 float complex (FMTCOMPLEX) only if none of the inputs is double. If
72 one or both inputs are double the result is double complex (FMTDPCOM‐
73 PLEX).
74
75 im_c2real() and im_c2imag() extract the real or the imaginary part of a
76 complex image respectively. If input is be float complex or double
77 complex, then output is float or double respectively.
78
79
81 The functions returns 0 on success and -1 on error.
82
84 im_scale(3).
85
86
87
88 15 April 1991 CONVERSIONS(3)