next up previous 231
Next: Getting images as workspace
Up: Examples of using IMG from C
Previous: Modifying an image

Modifying a copy of an image

This example (add.c) copies the input image and then modifies the copy.
  /*  Access an existing image */
  imgIn( "in", &nx, &ny, &ptrIn, status );

  /*  Copy this to an output image */
  imgOut( "in", "out", &ptrOut, status );

  /*  Get the value to add. */
  printf("Value to add to image: ");
  scanf( "%f", &value );

  /*  And do the work. */
  for( i=0; i <nx*ny; i++ ) {
    ptrOut[i] = value + ptrIn[i];
  }

  /*  Free the input and output images. */
  imgFree( "*", status );



next up previous 231
Next: Getting images as workspace
Up: Examples of using IMG from C
Previous: Modifying an image

IMG Simple Image Data Access
Starlink User Note 160
P.W. Draper
R.F. Warren-Smith
3 March 2003
E-mail:P.W.Draper@durham.ac.uk

Copyright © 2000-2003 Council for the Central Laboratory of the Research Councils