열한번째강의카메라 1/43 1/16
Review 2/43 2/16 평균값 중간값
Review 3/43 3/16 캐니에지추출 void cvcanny(const CvArr* image, CvArr* edges, double threshold1, double threshold2, int aperture_size = 3); aperture_size = 3 aperture_size = 5
Review 4/43 4/16 void cvpyrdown(const CvArr* src, CvArr* dst, int filter = CV_GAUSSIAN_5x5); void cvpyrup(const CvArr* src, CvArr* dst, int filter = CV_GAUSSIAN_5x5);
Review 5/43 5/16 void cvflip(const CvArr* src, CvArr* dst = NULL, int flip_mode = 0); flip_mode: 0 ( 수평 ), 1 ( 수직 ), -1 ( 둘다 )
VFW 카메라처리 6/43 6/16 #include highgui.h CvCapture 비디오캡쳐관련데이터구조 CvCapture* cvcreatecameracapture(int index); index = camera index + domain offset domain offset CV_CAP_ANY 0 autodetect CV_CAP_MIL 100 MIL driver CA_CAP_VFW 200 platform native CV_CAP_IEEE1394 300 IEEE1394 driver
VFW 카메라처리 7/43 7/16 int cvgrabframe(cvcapture* capture); 반환값 : 1 ( 성공 ), 0 ( 실패 ) IplImage* cvretrieveframe(cvcapture* capture); 반환된이미지를 Release 하거나변경하면안됨 IplImage* cvqueryframe(cvcapture* capture); cvgrabframe + cvretrieveframe 반환된이미지를 Release하거나변경하면안됨 void cvreleasecapture(cvcapture** capture);
VFW 카메라처리 8/43 8/16 CvCapture* capture = 0; IplImage *frame, *frame_copy = 0; capture = cvcapturefromcam(0); if(capture) { for(;;) { if(!cvgrabframe( capture )) break; frame = cvretrieveframe( capture ); if(!frame) break; if(!frame_copy) frame_copy = cvcreateimage( cvsize(frame->width,frame->height), IPL_DEPTH_8U, frame- >nchannels ); if( frame->origin == IPL_ORIGIN_TL ) cvcopy( frame, frame_copy, 0 ); else cvflip( frame, frame_copy, 0 ); if( cvwaitkey( 10 ) >= 0 ) break; } cvreleaseimage( &frame_copy ); cvreleasecapture( &capture ); }
동영상처리 9/43 9/16 CvCapture* cvcreatefilecapture(const char* filename); CvVideoWriter 동영상저장과련데이터구조 CvVideoWriter* cvcreatevideowriter(const char* filename, int fourcc, double fps, CvSize frame_size, int is_color = 1); int cvwriteframe(cvvideowriter* writer, const IplImage* image); void cvreleasevideowriter(cvvideowriter** writer);
VFW 카메라 / 동영상처리 10/43 10/16 double cvgetcaptureproperty(cvcapture* capture, int property_id); int cvsetcaptureproperty(cvcapture* capture, int property_id, double value); property_id CV_CAP_PROP_POS_MSECCAP PROP POS CV_CAP_PROP_POS_FRAMES CV_CAP_PROP_POS_AVI_RATIO CV_CAP_PROP_FRAME_WIDTH CV_CAP_PROP_FRAME_HEIGHT CV_CAP_PROP_FPS CV_CAP_PROP_FOURCC CV_CAP_PROP_FRAME_COUNT
DirectX 카메라처리 11/43 11/16 int cvcamgetcamerascount(); 카메라개수반환 int cvcamselectcamera(int** out); 팝업창에서카메라선택 선택된카메라개수반환 out: 선택된카메라리스트 int cvcaminit(); int cvcamstart(); int cvcamstop(); int cvcampause(); int cvcamresume(); int cvcamexit();
DirectX 카메라처리 12/43 12/16 int cvcamgetproperty(int camera, const char* property, void* value); int cvcamsetproperty(int camera, const char* property, void* value); property CVCAM_PROP_ENABLE CVCAM_PROP_RENDER CVCAM_PROP_WINDOW CVCAM_RNDWIDTH CVCAM_RNDHEIGHT CVCAM_SRCWIDTH CVCAM_SRCHEIGHT CVCAM_PROP_CALLBACK CVCAM_STEREO_CALLBACK
DirectX 카메라처리 13/43 13/16 void callback(iplimage* image) { } int main() { int ncams = cvcamgetcamerascount( ); cvcamsetproperty(0, CVCAM_PROP_ENABLE, CVCAMTRUE); cvcamsetproperty(0, CVCAM_PROP_RENDER, CVCAMTRUE); cvcamsetproperty(0, CVCAM_PROP_WINDOW, &hwnd); cvcamsetproperty(0, CVCAM_PROP_CALLBACK, callback); cvcaminit( ); cvcamstart( ); cvcamstop( ); cvcamexit( ); return 0; }
DirectX 동영상처리 int cvcamplayavi(const char* file, void* window, int width, int height, void* callback); typedef unsigned int cvcamavifile; cvcamavifile cvcamaviopenfile(char* file); int cvcamaviclosefile(cvcamavifile file); int cvcamavisetwindow(cvcamavifile file, void* window); int cvcamavisetcallback(cvcamavifile file, void* callback); int cvcamavisetsize(cvcamavifile file, int width, int height); int cvcamavirun(cvcamavifile file); int cvcamavistop(cvcamavifile file); int cvcamavipause(cvcamavifile file); int cvcamaviresume(cvcamavifile file); int cvcamaviwaitcompletion(cvcamavifile file); int cvcamaviisrunning(cvcamavifile file); 14/43 14/16
숙제 #6 15/43 15/16 VFW 기반으로카메라영상을얻는다. 매프레임마다얻어진영상을첫번째윈도우창에보인다. 매프레임마다얻어진영상을미디언필터링하여두번째윈도우창에보인다. DirectX 기반으로카메라영상을얻는다. 매프레임마다얻어진영상에서캐니에지를추출하여세번째윈도우창에보인다. 반드시소스코드를제출하세요.
감사합니다 16/43 16/16 질문?