Presentation is loading. Please wait.

Presentation is loading. Please wait.

Red Color Detection Course ChanYoung Kim

Similar presentations


Presentation on theme: "Red Color Detection Course ChanYoung Kim"— Presentation transcript:

1 Red Color Detection Course 3 2011. 9. 30. ChanYoung Kim

2 Contents 카메라 입력받기 Red Detection Red 값 찾기 Red 표시 - cvRectangle - 조건

3 Absolute Frame Difference
Red color Detect Camera Input Red Detect Function Absolute Frame Difference Red 표시 Thresholding Red Tracking & Detection Traking

4 카메라 입력받기 t t+1 T

5 Image structure IplImage (Image Processing Library)
typedef struct _IplImage { int nSize; /* size of iplImage struct */ int ID; /* image header version */ int nChannels; int alphaChannel; int depth; /* pixel depth in bits */ char colorModel[4]; char channelSeq[4]; int dataOrder; int origin; int align; /* 4- or 8-byte align */ int width; int height; struct _IplROI *roi; /* pointer to ROI if any */ struct _IplImage *maskROI; /*pointer to mask ROI if any */ void *imageId; /* use of the application */ struct _IplTileInfo *tileInfo; /* contains information on tiling*/ int imageSize; /* useful size in bytes */ char *imageData; /* pointer to aligned image */ int widthStep; /* size of aligned line in bytes */ int BorderMode[4]; /* the top, bottom, left, and right border mode */ int BorderConst[4]; /* constants for the top, bottom,left, and right border */ char *imageDataOrigin; /* ptr to full, nonaligned image */ } IplImage;

6 R G B – Detect code B G R ...

7 Pixel의 값 = (위치, 색) x y 위치 : 각 픽셀의 2D 좌표 (Image Coordinate System)
색 : CvScalar (색을 저장하는 구조체) x y (0,0) (8,2)

8 이미지에서 Pixel값으로의 접근 주의: 반드시 x,y는 이미지 범위 내부에 있어야함!
CvScalar cvGet2D (IplImage*, y, x) (x,y)에서의 칼라 값 얻기. Example) CvScalar s; s = cvGet2D(img, 30, 40); void cvSet2D (IplImage*, y, x, CvScalar) (x,y)에서의 칼라 값 변경 Example) CvScalar s = cvScalar(100,0,0); cvSet2D(img, 30, 40, s); 또는 cvSet2D(img, 30, 40, cvScalar(100,0,0)); 주의: 반드시 x,y는 이미지 범위 내부에 있어야함! (image의 width와 height를 정보를 참조할것)

9 R G B – Red 값 찾기

10 Labeling 그리기 함수 cvLine cvRectangle cvCircle
- pt1과 pt2를 thickness 굵기의 color색으로 직선을 그림 cvRectangle - pt1과 pt2를 thickness 굵기의 color색으로 사각형을 그림 cvCircle - Center에서 radius크기의 원을 thickness 굵기, color색으로 그림

11 Labeling X = 12 Y = 3 X = 12 Y = 6 X = 8 Y = 2
typedef struct CvPoint { int x; Int y; } CvPoint; CvPoint min, max X = i Y = j X = 12 Y = 3 X = 12 Y = 6 X = 8 Y = 2 top = MIN(top, y); bottom = MAX(bottom, y); left = MIN(left, x); right = MAX(right, x); X = 8 Y = 3 X = 9 Y = 2

12 움직이는 방향 구하기 RIGHT MOVE Time sequence X = 11 Y = 5
(left + right )/ 2 = x (top + bottom) / 2 = y X = 3 Y = 5

13 movement recognition code
(x2, y2) (11, 3) (x1, y1) (1, 1) dx = 10 dy = 2 dy > dx dx > dy

14 Thank you


Download ppt "Red Color Detection Course ChanYoung Kim"

Similar presentations


Ads by Google