I'm trying to write a simple application that takes a vil_image_view and writes it to a buffer in a given encoding, png for example. The method in which I'm trying to do this seems logical, but doesn't yield the correct data into the buffer (code below):
vil_image_view<vxl_byte> frame = vil_load( "test.png" );
vil_stream_fstream* pngStream = new vil_stream_fstream( "tmp", "r" ); // I've tried this with 'w' as well
vil_image_resource_sptr pngImageRes = png.make_output_image(
pngImageRes->put_view( frame );
char* buf = new char[ pngStream->file_size() ];
pngStream->read( buf, pngStream->file_size() );
I've also tried this using a simple sub-class of vil_stream_core that simply makes its destructor public, but I get the same or similar results. Hopefully, I'm missing something simple.
Also, sorry if this is a question that's been asked before, sourceforge's mailing list search seems to be broken... Anyone know of another way to search it?
R & D Engineer