/** * CvBase implementation. * * See cvbase.hpp for details. * * @author vona **/ #include "cvbase.hpp" #include using namespace std; /** * Format ITEMS as a string. * * ITEMS is a standard cout-style << sequence, e.g. * * std::string s = FMT(19< (ostringstream()<= 2) ? argv[1] : DEF_INPUT; if (argc >= 2) ate++; int index = -2; if (!((istringstream(input)>>index).fail())) { //either no args or first arg parsed as an int; open a camera int w = DEF_CAM_W, h = DEF_CAM_H; if (argc >= 4) { if (!(istringstream(argv[2])>>w).fail()) { ate++; if (!(istringstream(argv[3])>>h).fail()) ate++; } } cap = cvCaptureFromCAM(index); if (!cap) { cerr<<"error opening camera "<= 0) ? FMT("camera "<width<<"x"<height<< " frame ("<<(nowMS()-startMS)<<"ms)"<width<<"x"<height <<", "<nChannels<<" channels" <<", "<<((capImage->depth)&(~IPL_DEPTH_SIGN))<<" bits" <<", "<<(((capImage->depth)&IPL_DEPTH_SIGN)?"signed":"unsigned") <width<<"x"<height <<" image ("<<(nowMS()-startMS)<<"ms)"<width<<"x"<height <<" image ("<<(nowMS()-startMS)<<"ms)"< 0; w = waitUntilMS-nowMS()) { if (dbg) cout<<"waiting "<depth != IPL_DEPTH_8U) || ((image->nChannels != 1) && (image->nChannels != 3))) { int w = image->width, h = image->height; int nc = (image->nChannels > 1) ? 3 : 1; if ((saveImage == 0) || (saveImage->width != w) || (saveImage->height != h) || (saveImage->nChannels != nc)) { if (saveImage != 0) cvReleaseImage(&saveImage); saveImage = cvCreateImage(cvSize(w, h), IPL_DEPTH_8U, nc); } } if (saveImage != 0) { cvConvertImage(image, saveImage); image = saveImage; } return cvSaveImage(filename, image); }