    Next: Complex Images Up: Image Processing Previous: Convolution and Filtering   Contents

# Pixel Processing

General pixel based manipulation including transendental functions is carried out by the following routines. For multiple image manipulation the image type returned is determined by the function im_sup_vtype

```Vartype im_sup_vtype(Vartype vtype1, Vartype vtype2)
```
which ensures no truncation of the result due to casting (truncation may still occur for numbers beyond the normal range of number representation).

```Imrect *im_add(double k,Imrect *im)
```
Add the constant k to all pixels in the specified image. For the case of complex images only the real component is modified.

```Imrect *im_diff(Imrect * im1, Imrect * im2)
```
Subtract the pixels contained in two images and return the difference image.

```Imrect *im_minus(Imrect * im)
```
Inverts the sign of all pixel values returning a new image.

```void    im_pixf_dec(Imrect * image, int i, int j)
```
Decrement pixel (i, j) in image. Pixels outside image are ignored.

```Imrect *im_sum(Imrect * im1, Imrect * im2)
```
Returns an image whose pixels are the sum of those in the input images within the common region of interest.

```Imrect *im_times(double k, Imrect * im)
```
Returns an image with pixels scaled by of their input values.

```Imrect *im_prod(Imrect * im1, Imrect * im2)
```
Returns an image with values given by the product of the pixels in the images im1 and im2.

```Imrect *im_div(Imrect * im1, Imrect * im2, double thresh, double val)
```
Divide the pixels contained in image im1 by those contained in image im2. Numerical stability is maintained by preventing the denominator reducing below a value of when it's absolute value is less than .

```Imrect *im_sqr(Imrect * im)
```
Compute the sqaure of each image pixel value, all values returned as float_v except complex_v, which is returned as complex_v.

```void    im_grad(Imrect * im, Imrect ** imx, Imrect ** imy)
```
Compute derivative images for both the x and y components using the functions imf_diffx(im) and imf_diffx(im).

```void    im_hessian(Imrect * im, Imrect ** imx, Imrect ** imy, Imrect ** imxx, Im
rect ** imxy, Imrect ** imyy)
```
Computes both x and y derivatives, and second derivatives. If the first derivatives are not required then pass null pointers for imx and imy.

```Imrect *im_log(Imrect * im)
```
Returns an image of natural logariths for all pixels while maintaining sign. The function is a direct inverse of im_exp(). All images are returned as type float_v except for type complex_v which is returned as complex_v.

```Imrect *im_quad(im)
```
Returns an image which has been vertically and horizontally doubled to produce boudary continuity. Intended for use before Fourier transform operations to remove Gibbs oscillations after deconvolution.

```Imrect *im_sin(Imrect * im)
```
Returns an image with each pixel given by the trigonometric sine of the initial grey level data.

```Imrect *im_sqrt(Imrect * im)
```
Returns an image with each pixel the square-root of the initial grey level value. The sign of the original pixel is preserved, for true complex treatment of negative values use imz_sqrt().

```Imrect *im_asin(Imrect * im)
```
Computes the trigonometric sine of all pixels in the image. All returned images are of type float_v except complex images which are returned as type complex_v.

```Imrect *im_exp(Imrect * im)
```
Compute the exponentiated value of each pixel with maintained sign. Returns images of type float_v for all cases except complex_v which are returned as complex_v. The function is the direct inverse of im_log().

```void im_scale_range_inplace(Imrect * im,
double oldlow, double oldhigh,
double newlow, double newhigh,
double threslow, double threshigh)
```
This routine scales the range oldlow, oldhigh in image im newlow, newhigh, thresholding at the upper and lower values given by threslow, threshigh.

```void im_gamma_scale_range_inplace(Imrect * im,
double gamma,
double oldlow, double oldhigh,
double newlow, double newhigh,
double threslow, double threshigh)
```
Gamma scale the range oldlow, oldhigh in image im using the specified parameters.

```Imrect *im_shading(Imrect *im,double slant,double tilt,double scale)
```
Produces a shaded image from a 3D image surface using a point light source and lambertian reflectance model at a distant location specified by and .

```Imrect *im_combine(Imrect * im1, Imrect * im2, void *(*func) (), void *data)
```
Returns an image with pixels computed from the specified input image pixels operated upon by the specified function.

```Imrect *im_fpp_combine(Imrect * im1, Imrect * im2, void *(*func) (), void *data)
```
General purpose routine for operating on two images of types float_v and ptr_v with the specified function.    Next: Complex Images Up: Image Processing Previous: Convolution and Filtering   Contents
root 2019-03-24