I believe it's related to the format specific vil_save implementation and not vil_crop.  I had similar problems saving using TIFF.  Switching to PNG solved the problem.  For what it's worth, you should find corresponding pixels in your two cropped vil_image_views to be identical (i.e., vil_crop works correctly).  It looks like the TIFF adaptor ignores any offset on the top left pointer.


On 16/05/2008, at 7:48 AM, Brooksby, Glen W (GE, Research) wrote:

Has anyone noticed odd behaviour with vil_crop()?

I'm noticing that in a very simple program the followning lines of code produce the same output image:

  vil_image_view<PixelType> cropped_image = vil_crop(img_in, 0, 128, 0, 128);
  vil_save(cropped_image, ofname().c_str() );


  vil_image_view<PixelType> cropped_image = vil_crop(img_in, 56, 128, 136, 128);
  vil_save(cropped_image, ofname().c_str() );

The result for either pair of lines give the same output image.  The output image begins at i0=j0=0 in the original image and is 128x128.  It's as if i0 and j0 are ignored.  Has anyone else seen this behavior?

Glen Brooksby