/** @file test_vetVideo4Linux.cpp * * @brief Testing code for class vetVideo4Linux. * * Connect to first capture device (/dev/video0), print * size, colour depth and palette, capture a frame, print * processing time (milliseconds) and store image to file. * * @warning requires VETLib with V4L support * requires a valid capture device, Video4Linux library. * * @see vetVideo4Linux * @see test_vetVideo4LinuxPlayer.cpp * * @version 1.0 * @date 5/08/2005 * @author Alessandro Polo * * **************************************************************************** * VETLib Framework 1.02 * Copyright (C) Alessandro Polo 2005 * http://www.ewgate.net/vetlib * ****************************************************************************/ //--------------------------------------------------------------------------- #pragma hdrstop //--------------------------------------------------------------------------- #include "../source/vetFrameRGB96.h" #include "../source/vetFrameRGB24.h" #include "../source/codecs/vetCodec_BMP.h" #include "../source/inputs/vetVideo4Linux.h" #include "../source/outputs/vetDoctor.h" #include #pragma argsused int main(int argc, char* argv[]) { printf("Testing vetVideo4Linux Development...\n"); printf("\nCreating Instances and Connecting to /dev/video0...\n"); vetFrameRGB96 img; vetFrameRGB24 img24; vetDoctor doc; vetVideo4Linux cap("/dev/video0"); printf("Device INFO:\n"); printf(" Device Width: %d\n", cap.getWidth() ); printf(" Device Height: %d\n", cap.getHeight() ); printf(" Device Color Depth: %d\n", cap.getColorDepth() ); printf(" Device Palette: %d\n", cap.getPalette() ); printf("\nStarting frame redirection loop...\n"); int i = 0; long time = 0; doc.reset(true); while (i++ < 100)// 100 frames { cap >> img24; } time = doc.getElapsedTime(); float fps = (float)100000/(float)doc.getElapsedTime(); printf("Elapsed milliseconds : %ld\n", time ); printf("Average Frame Rate : %f fps\n", fps ); printf("\nSaving last capture frame...\n"); vetCodec_BMP::save(img24, "v4l_captured_frame", vetCodec_BMP::FORMAT_BMP_24); printf("Test Completed. Type something to continue...\n"); getchar(); return 0; } //---------------------------------------------------------------------------