Dongchul Kim / dongchul@gmail.com / http://opencv.t9t9.com OpenCV Tutorials Course 3 2009. 12. 24. Dongchul Kim / dongchul@gmail.com / http://opencv.t9t9.com
Contents Motion Detector Realtime Hough Transform openFrameworks X, Y축 투영 (X,Y Axis Projection)을 이용한 동작감지 프로토타입 Absolute Frame Difference XY Axis Projection Histogram Background Modeling Realtime Hough Transform 실시간 허프 변환 (Hough Transform) 프로토타입 Edge Detection Thresholding Noise Removal - Median Filter (is Good for Salt & Pepper Noise) Hough Transform openFrameworks 통합개발환경을 위한 오픈프레임웍스
Motion Detector Background Modeling + Blob Detection XY Projection Histogram
Motion Detector Camera Input Background Absolute Frame Difference Modeling Blob Detection Separate Background & Foreground Thresholding XY Projection Histogram Thresholding X,Y Axis Projection Histogram Boundary Following (Contour) Blob Detection Analysis Analysis
Motion Detector Camera Input Absolute Frame Difference Thresholding 영상 내의 움직임을 검출 하기 위한 영상 생성 cvAbsDiff() Absolute Frame Difference The Noise of Absolute Frame Difference Camera Input 영상내의 노이즈를 제거하고 일정 이상의 움직임을 필터링 cvThreshold() Absolute Frame Difference Thresholding Thresholding 움직임 모양을 그래프 탐색 & 분석을 위한 X Y 축 투영 // directly coding.. X,Y Axis Projection Histogram XY Projection Histogram Shape Analysis
Motion Detector B G R ... // X Y Axis Projection Histogram unsigned char* data = binaryImage.getPixels(); int w = binaryImage.getWidth(); int h = binaryImage.getHeight(); int v; for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ v = data[i * w + j]; if( v == 255) { histoX[j]++; histoY[i]++; } // Draw X Y Axis Projection Histogram for(int i=0; i<h; i+=histoThick){ //ofLine(670, 260+i, 670 + histoY[i], 260+i); ofRect(670, 260+i, histoY[i], histoThick); } for(int j=0; j<w; j+=histoThick){ //ofLine(340+j, 510, 340 + j, 510 + histoX[j]); ofRect(340+j, 510, histoThick, histoX[j]); histoY[i] B G R ... histoX[i]
Separate Background & Foreground Motion Detector Camera Input Background Modeling Separate Background & Foreground Thresholding Boundary Following (Contour) Blob Detection Analysis
Separate Background & Foreground Motion Detector // find contours which are between the size of 20 pixels // and 1/3 the w*h pixels. max holes is 10, and find // interior contours contourFinder.findContours(grayDiff, 20, (340*240)/3, 10, true); Separate Background & Foreground // take the abs value of the difference // between background and incoming and then threshold: grayDiff.absDiff(grayBg, grayImage); grayDiff.threshold(threshold); // we can draw each blob individually, // this is how to get access to them: for (int i = 0; i < contourFinder.nBlobs; i++){ contourFinder.blobs[i].draw(10,510); } Background Image Incoming Image blobs[i] min pixel size of hole max pixel size of hole Foreground & Thresholding interior hole
Realtime Hough Transform
Realtime Hough Transform Camera Input 에지 영상을 구함 cvLaplace() Edge Detection Noise Removal 노이즈 제거 cvSmooth() // median Thresholding Hough Transform 직선 선분을 구함 cvHoughLines2()
Realtime Hough Transform cvLaplace(gray, laplace, 3); cvSmooth( gray, gray, CV_MEDIAN, 3, 3 ); lines = cvHoughLines2( gray, storage, CV_HOUGH_STANDARD, 2, CV_PI/180, 150, 0, 0 );
openFrameworks 오픈프레임웍스 (openFrameworks) + OpenCV 애드온 (addon) 화면 띄움, 결과물 확인, 그래프 키보드/마우스 입력, 음성, 사운드 출력 영상처리, 네트웍 통신 등 OpenGL 기반 화면 렌더링 다양한 오픈소스 기반의 통합 개발 환경 http://cafe.naver.com/openframeworks
openFrameworks
Merry Christmas & Happy New Year !! Thank you Merry Christmas & Happy New Year !!