    Next: Region of Interest Functions Up: Image Handling Previous: Pointer Images   Contents

# Image Functions

```Imrect *im_alloc(int height, int width, Imregion * region, Vartype vtype)
```

Allocate imrect of vtype from image of size height times width to cover region. If region is NULL then whole image is created.

```void    im_free(Imrect * image)
```

Frees the image and its associated property list.

```Imrect *im_copy(Imrect * image)

Imrect *im_cast(Imrect * image, Vartype vtype)

Imrect *im_subim(Imrect * image, Imregion * region)

void    im_copy_inplace(Imrect * image2, Imrect * image1)
```
Functions to make new copies of images. These use the im_write functions above. In im_copy the argument vtype specifies the type of the new image (subject to the restrictions of

im_write_general_type). In im_subim the region covered by the returned imrect is given by the intersection of the region of image with that in the argument region. If region or its intersection with image-region is NULL, then the function returns NULL.

```void    im_put_pix(int pixval, Imrect * image, int i, int j)

void    im_put_pixf(double pixval, Imrect * image, int i, int j)

void    im_put_pixz(Complex pixval, Imrect * image, int i, int j)

void    im_put_ptr(void *ptr, Imrect * image, int i, int j)

void    im_pixf_inc(Imrect * image, int i, int j)
```

General functions for setting imrect pixel values; they deal with all images except those of type ptr_v. The image region is examined to ensure that the image pixel at (i, j) lies within it. Functions im_put_pix and im_put_pixf effect only the real part of pixels of type complex_v. Similarly, in im_put_pixz only the real part of pixval is used to update (suitably cast) image pixels of types other than complex_v.

```int     im_get_pix(Imrect * image, int i, int j)

void   *im_get_ptr(Imrect * image, int i, int j)

double  im_get_pixf(Imrect * image, int i, int j)

Complex im_get_pixz(Imrect * image, int i, int j)
```

General functions for retrieving imrect pixel values; they deal with all images except those of type ptr_v. The image region is examined to ensure that the image pixel at (i, j) lies within it. Functions im_get_pix and im_get_pixf obtain only the real part of pixels of type complex_v. Similarly only the real part of the Complex variable returned by im_get_pixz is set (the imaginary part is 0) for pixels of types other than complex_v.

```int     im_sub_pix(Imrect * image, double r, double c)

double  im_sub_pixf(Imrect * image, double r, double c)

double  im_sub_pixqf(Imrect *image, double y, double x)

double  im_get_quadinterpf(Imrect * image, float x, float y,
float *pdx, float *pdy)

double  im_get_quadmaxf(Imrect * image, float x, float y, float *px, float *py)
```

General functions to obtain approximate image values to at sub pixel image locations (not defined for ptr_v or complex_v image types). Sub pixel values are obtained by bilinear interpolation for im_sub_pixf and quadratic interpolation for im_sub_pixqf im_get_quadinterpf im_get_quadmaxf .

```void    im_put_row(int *line, Imrect * image, int i, int from, int to)

void    im_put_rowf(float *line, Imrect * image, int i, int from, int to)

void    im_put_rowz(Complex * line, Imrect * image, int i, int from, int to)
```
Funtions to write from line into part of row r of image. Arguments from and to specify the section of row r to be read from line (ie. line[c] : from = c to ). Relevant sections of line that lie outside the region of image are not written. Functions are undefined for images of type ptr_v.

```void    im_put_col(int *line, Imrect * image, int i, int from, int to)

void    im_put_colf(float *line, Imrect * image, int i, int from, int to)

void    im_put_colz(Complex * line, Imrect * image, int i, int from, int to)

Vector *im_col_vector(Imrect * im, int x, int ly, int uy, Vartype vtype)
```
Funtions to write from line into part of column c of image. Arguments from and to specify the section of column c to be read from line (ie. line[c] : from = c to ). Relevant sections of line that lie outside the region of image are not written. Functions are undefined for images of type ptr_v.

```void    im_get_row(int *line, Imrect * image, int i, int from, int to)

void    im_get_rowf(float *line, Imrect * image, int i, int from, int to)

void    im_get_rowz(Complex * line, Imrect * image, int i, int from, int to)

Vector *im_row_vector(Imrect * im, int y, int lx, int ux, Vartype vtype)
```
Funtions to read part of row r of image into data array line. Arguments from and to specify the section of row r to be copied into line (ie. line[c] : from = c to ). Relevant sections of line that lie outside the region of image are set to zero. Functions are undefined for images of type ptr_v.

```void    im_get_col(int *line, Imrect * image, int i, int from, int to)

void    im_get_colf(float *line, Imrect * image, int i, int from, int to)

void    im_get_colz(Complex * line, Imrect * image, int i, int from, int to)
```
Funtions to read part of column c of image into data array line. Arguments from and to specify the section of column c to be copied into line (ie. line[r] : from = r to ). Relevant sections of line that lie outside the region of image are set to zero. Functions are undefined for images of type ptr_v.

Subsections    Next: Region of Interest Functions Up: Image Handling Previous: Pointer Images   Contents
root 2020-01-18