X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FBilatTools_OpenCV%2Fsrc%2Fcore%2Fcapture%2Fcpp%2FCaptureCamera.cpp;fp=WCudaMSE%2FBilatTools_OpenCV%2Fsrc%2Fcore%2Fcapture%2Fcpp%2FCaptureCamera.cpp;h=3c11ccbb518769aa471bf08646c2d6c43e61ebce;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/BilatTools_OpenCV/src/core/capture/cpp/CaptureCamera.cpp b/WCudaMSE/BilatTools_OpenCV/src/core/capture/cpp/CaptureCamera.cpp new file mode 100755 index 0000000..3c11ccb --- /dev/null +++ b/WCudaMSE/BilatTools_OpenCV/src/core/capture/cpp/CaptureCamera.cpp @@ -0,0 +1,114 @@ +#include +#include "CaptureCamera.h" + +using std::cerr; +using std::cout; +using std::endl; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*------------------*\ + |* Constructeur *| + \*-----------------*/ + +/** + * see doc of Capture_A constructor for cuda use (ptrHostMemory) + */ +CaptureCamera::CaptureCamera(int idCamera, const string& title, int wAsk, int hAsk,uchar4* ptrHostMemory) : + Capture_A(createStream(idCamera), title,ptrHostMemory) + + { + this->idCamera = idCamera; + this->wAsk = wAsk; + this->hAsk = hAsk; + + configure(); + } + +CaptureCamera::~CaptureCamera(void) + { + // rien + // delete ptrCaptureStream; in constructor + } + +/*------------------*\ + |* Methode *| + \*-----------------*/ + +void CaptureCamera::printInfo(void) + { + Capture_A::printInfo(); + + cout << "\t(w,h) asked = (" << wAsk << "," << hAsk << ") " << endl; + + cout << endl; + } + +void CaptureCamera::readStream(VideoCapture* ptrCaptureStream, Mat* ptrMatCaptureSrc) + { + (*ptrCaptureStream) >> (*ptrMatCaptureSrc); + } + +/*------------------*\ + |* get *| + \*-----------------*/ + +int CaptureCamera::getIdCamera() + { + return idCamera; + } + +int CaptureCamera::dtOriginalMS() + { + return 0; // On doit attendre sur le port usb, mieux? + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +VideoCapture* CaptureCamera::createStream(int idCamera) + { + return new VideoCapture(idCamera); + } + +void CaptureCamera::configure() + { + // VideoCapture* ptrCaptureStream = getVideoCapture(); + + // cout << "(w,h) asked = (" << wAsk << "," << hAsk << ") asked" << endl; + + if (wAsk != -1) + { + ptrCaptureStream->set(CV_CAP_PROP_FRAME_WIDTH, wAsk); + } + + if (hAsk != -1) + { + ptrCaptureStream->set(CV_CAP_PROP_FRAME_HEIGHT, hAsk); + } + + } + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +