[artoolkit-commits] artoolkit/lib/SRC/VideoLinuxV4L video.c,1.2,1.3
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
From: Philip L. <phi...@us...> - 2005-07-27 21:21:40
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxV4L In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11718 Modified Files: video.c Log Message: Apply patch by Wayne Piekarski to auto-adjust video resolution. Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxV4L/video.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** video.c 22 Nov 2004 02:32:40 -0000 1.2 --- video.c 27 Jul 2005 21:21:24 -0000 1.3 *************** *** 1,6 **** /* * Video capture subrutine for Linux/Video4Linux devices * author: Nakazawa,Atsushi ( nak...@in... ) ! Hirokazu Kato ( ka...@sy... ) * * Revision: 5.3 Date: 2004/11/18 --- 1,10 ---- /* + * Revision: 5.2 Date: 2000/08/25 * Video capture subrutine for Linux/Video4Linux devices * author: Nakazawa,Atsushi ( nak...@in... ) ! * Hirokazu Kato ( ka...@sy... ) ! * ! * Modified by Wayne Piekarski (wa...@ti...) - 2005/03/29 ! * Added support to automatically adjust camera parameters if needed * * Revision: 5.3 Date: 2004/11/18 *************** *** 111,114 **** --- 115,120 ---- printf(" -channel=N\n"); printf(" specifies source channel.\n"); + printf(" -noadjust\n"); + printf(" prevent adjusting the width/height/channel if not suitable.\n"); printf(" -width=N\n"); printf(" specifies expected width of image.\n"); *************** *** 146,150 **** char *a, line[256]; int i; ! arMalloc( vid, AR2VideoParamT, 1 ); strcpy( vid->dev, DEFAULT_VIDEO_DEVICE ); --- 152,157 ---- char *a, line[256]; int i; ! int adjust = 1; ! arMalloc( vid, AR2VideoParamT, 1 ); strcpy( vid->dev, DEFAULT_VIDEO_DEVICE ); *************** *** 215,218 **** --- 222,228 ---- } } + else if( strncmp ( a, "-noadjust", 9 ) == 0 ) { + adjust = 0; + } else if( strncmp( a, "-contrast=", 10 ) == 0 ) { sscanf( a, "%s", line ); *************** *** 309,312 **** --- 319,333 ---- } + /* adjust capture size if needed */ + if (adjust) + { + if (vid->width >= vd.maxwidth) + vid->width = vd.maxwidth; + if (vid->height >= vd.maxheight) + vid->height = vd.maxheight; + if (vid->debug) + printf ("arVideoOpen: width/height adjusted to (%d, %d)\n", vid->width, vid->height); + } + /* check capture size */ if(vd.maxwidth < vid->width || vid->width < vd.minwidth || *************** *** 316,320 **** return 0; } ! /* check channel */ if(vid->channel < 0 || vid->channel >= vd.channels){ --- 337,350 ---- return 0; } ! ! /* adjust channel if needed */ ! if (adjust) ! { ! if (vid->channel >= vd.channels) ! vid->channel = 0; ! if (vid->debug) ! printf ("arVideoOpen: channel adjusted to 0\n"); ! } ! /* check channel */ if(vid->channel < 0 || vid->channel >= vd.channels){ |