On MacOS X, use fink (or something else) to install libjpeg. Then uncomment the line
#define LB_MACOSX
in lb_stream_header.h and use "make -f Makefile.macos" to build the library using xcodebuild, "make -f Makefile.macos test" to build the test program and "make -f Makefile.macos install" to copy to /usr/local.
#include "lb_stream_file.h" using namespace GRASP::Ladybug; int main(int argc,char *argv[]) { // set frame number to extract uint32_t frame_number = 0; // set camera from which to image was taken (0-5) uint32_t camera_number = 0; // set bayer decoding quality BAYER_QUALITY quality=NEAREST_NEIGHBOR; // set file name std::string file_name = "ladybug0000.pgr"; // instantiate the main class const StreamFileDecoded stream(file_name); // instantiate an image header class ImageHeader image_header; // instantiate a vector for the image std::vector< uint8_t > RGB; // image size (output) uint32_t width=0,height=0; // retrieve an uncompressed image image_header = stream.GetUncompressedFrame (frame_number,camera_number,RGB,width,height,quality); // set output file quality uint32_t output_jpeg_quality = 90; // set output file name std::string image_file_name = "frame.jpg"; // write the same image to disk stream.WriteJpegFrame(frame_number,camera_number,output_jpeg_quality,image_file_name,quality); }
At this point, the image_header structure will contain the GRASP::Ladybug::ImageHeader for frame 0 (which can be queried for per-image settings), RGB will be of size width*height*3 and contain the packed, row-major array or pixels.
A jpeg file frame.jpg will be written to disk. It will be jpeg-encoded with quality value of output_jpeg_quality.
1.5.3