Page 1016 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 1016
or.height){
if(CanXP-CANSCALE<xpos&&xpos<CanXP+CANSCALE||CanYP-CANSCALE<ypos&&ypos<CanYP+CA
NSCALE){
CanX = xpos, CanY = ypos;
break;
}
e l s e
if((sensor.x<xpos&&xpos<sensor.x+sensor.width&&sensor.y<ypos&&ypos<insidesensor
.y)||(sensor.x<xpos&&xpos<insidesensor.x&&insidesensor.y<ypos&&ypos<insidesenso
r.y+insidesensor.height)||(insidesensor.x+insidesensor.width<xpos&&xpos<sensor.
x+sensor.width&&ypos<insidesensor.y+insidesensor.height)||(sensor.x<xpos&&xpos<
sensor.x+sensor.width&&insidesensor.y+insidesensor.height<ypos&&ypos<sensor.y+s
ensor.height)) {
CanX = xpos, CanY = ypos;
break;
}
}
}
}
if(onDebug)
imshow("Can",imgThresholded);
}
/*파란색을 통해 쓰레기통방향을 감지를 한다.
파란색 물체가 있으면 그것의 위치를 받아 쓰레기통의 방향을 업데이트한다.*/
void HeaderDetect(){//쓰레기통 방향 감지
Mat imgHSV;
cvtColor(MainMat, imgHSV, COLOR_BGR2HSV);
Mat imgThresholded;
inRange(imgHSV, Scalar(biLowH, biLowS, biLowV), Scalar(biHighH, biHighS,
biHighV), imgThresholded);
erode(imgThresholded, imgThresholded,
getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
dilate( imgThresholded, imgThresholded,
- 1009 -