need help

Chakravarthy Terlapu cterlapu at cse.unl.edu
Tue Feb 20 10:31:56 PST 2001


Hi,

I have a image called street.tif and 2 boxes whose coordinates are for
example as follows;

//Box1
frc[i].lx = x1;   //left x-coordinate        
frc[i].ly = y1;   //left y-coordinate   
frc[i].tx = x2;   //top x-coordinate   
frc[i].ty = y2;   //top y-coordinate   
frc[i].rx = x3;   //right x-coordinate   
frc[i].ry = y3;   //right y-coordinate 
frc[i].bx = x4;   //bottom x-coordinate 
frc[i].by = y4;   //bottom y-coordinate 

//Box2
frc[i].lx = x11; 
frc[i].ly = y11; 
frc[i].tx = x22; 
frc[i].ty = y22; 
frc[i].rx = x33; 
frc[i].ry = y33; 
frc[i].bx = x44;
frc[i].by = y44;   

I need to create a new image say street1.tif which contains 
street.tif minus boxes (street.tif-boxes) i.e I have to erase all pixels
within the box1 and box2.

It would be great if anyone could help me. 

THanks
Chakravarthy Terlapu



 #include "tiffio.h"
 #include <stdio.h>

main()
{ 
  int i,j,k;
  unsigned short t;
  int linebytes, outbytes;
  uint32 w,h;
  uint32 row;
  unsigned char *inbuf,*outbuf;
 
  TIFF* in;
  TIFF* out;
 
  in=TIFFOpen("street.tif","r");
  out=TIFFOpen("street1.tif","w");
 
  TIFFGetField(in, TIFFTAG_IMAGELENGTH, &h);
  TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);

  TIFFSetField(out, TIFFTAG_IMAGELENGTH, h);
  TIFFSetField(out, TIFFTAG_IMAGEWIDTH, w);
  TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);
  TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);
  TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
  TIFFSetField(out, TIFFTAG_ORIENTATION, 1);

  linebytes=TIFFScanlineSize(in);
  outbytes=TIFFScanlineSize(out);

  inbuf=_TIFFmalloc(linebytes);
  outbuf=_TIFFmalloc(outbytes);

   for(row=0; row<h; i++)
   {
     TIFFReadScanline(in, inbuf, row, 0);

     //Here how can I do the processing of removing the pixels within the box




     TIFFWriteScanline(out, inbuf, row, 0 ); 
   }
  TIFFClose(in);
  TIFFClose(out);

  free(inbuf);
  free(outbuf);
}



-------------
The compgeom mailing lists: see
http://netlib.bell-labs.com/netlib/compgeom/readme.html
or send mail to compgeom-request at research.bell-labs.com with the line:
send readme
Now archived at http://www.uiuc.edu/~sariel/CG/compgeom/maillist.html.



More information about the Compgeom-announce mailing list