本文整理汇总了C++中ARDrone::getCameraMode方法的典型用法代码示例。如果您正苦于以下问题:C++ ARDrone::getCameraMode方法的具体用法?C++ ARDrone::getCameraMode怎么用?C++ ARDrone::getCameraMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARDrone
的用法示例。
在下文中一共展示了ARDrone::getCameraMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: goMousePoint
void goMousePoint(int x, int y, int MouseCtrlMode)
{
//printf("cmode:%02d vx:%02d vy:%02d \n",ardrone.getCameraMode(),vx,vy);
if(!mNonDronRDebug)
{
double vx=0.0, vy=0.0, vr=0.0, vz=0.0;
if (!ardrone.onGround())
{
//CameraMode 0:正面カメラ
// 1:下面カメラ
// 2:正面カメラ + 小 下面カメラ
// 3:下面カメラ + 小 正面カメラ
int threshValue = 300;
//正面カメラ
if((ardrone.getCameraMode() == 0)||(ardrone.getCameraMode() == 2))
{
//printf("cmode:%02d \n",ardrone.getCameraMode());
if((x>0)&&(x<800)&&(y>0)&&(y<600))
{
if((!MouseCtrlMode))
{
if((x>0)&&(x < 300)){
//vy = -1.5;
}
if((x>500)&&(x < 800)){
//vy = 1.5;
}
if((y>0)&&(y < 150)){
vz = 1.0;
}
if((y>450)&&(y < 600)){
vz = -1.0;
}
/*
if(((x - preX) > 5)&&((x - preX) < threshValue)){
vy = -1;
}
if(((x - preX) < -5)&&((x - preX) > (-1 * threshValue))){
vy = 1;
}
if(((y - preY) < 10)&&((y - preY) > -10)){
if((y>0)&&(y < 150)){
vz = 1;
}
if((y>450)&&(y < 600)){
vz = -1;
}
}
if(((y - preY) > 5)&&((y - preY) < threshValue/2)){
//画面下へドラッグ
//vz = -1;
}
if(((y - preY) < -5)&&((y - preY) > (-1 * threshValue/2))){
//vz = 1;
}
*/
}else{
//マルチタッチモード
//前後飛行
if(((x - preX) > 5)&&((x - preX) < threshValue)){
vz = 1.0;
}
if(((x - preX) < -5)&&((x - preX) > (-1 * threshValue))){
vz = -1.0;
}
}
}
}
//下面カメラ
if((ardrone.getCameraMode() == 1)||(ardrone.getCameraMode() == 3))
{
//printf("cmode:%02d \n",ardrone.getCameraMode());
if((x>0)&&(x<800)&&(y>0)&&(y<600))
{
if((!MouseCtrlMode))
{
if((x>0)&&(x < 300)){
vy = 1.5;
}
if((x>500)&&(x < 800)){
vy = -1.5;
}
if((y>0)&&(y < 200)){
vx = 1.5;
}
if((y>400)&&(y < 600)){
vx = -1.5;
}
/*
if(((x - preX) > 5)&&((x - preX) < threshValue)){
vy = -1;
}
if(((x - preX) < -5)&&((x - preX) > (-1 * threshValue))){
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
if (!ardrone.update())
break;
// Get an image
image = ardrone.getImage();
if((mbatValue = ardrone.getBatteryPercentage()) < 30){
printf("Battery = %d%%\n",mbatValue );
if(mArDroneCommandFlag == false)
ardrone.move3D(0.0, 0.0, 0.0, 0.0);
msleep(80);
ardrone.landing();
printf("Landing\n");
msleep(180);
}
//}
#ifndef FACEDETECT
try{
//2014.02.15 FaceDetection追加
// (3)メモリを確保し,読み込んだ画像のグレースケール化,ヒストグラムの均一化を行う
CvMemStorage *storage = 0;
storage = cvCreateMemStorage (0);
cvClearMemStorage (storage);
//Mat captureFrame;
//Mat grayscaleFrame;
Mat captureFrameMat = cvarrToMat(image);
cvtColor(captureFrameMat, grayscaleFrame, CV_BGR2GRAY);
equalizeHist(grayscaleFrame, grayscaleFrame);
// mFaceDetectMode:Fキーにてスイッチ
if((mFaceDetectMode == true)
&&((ardrone.getCameraMode() == 0)||(ardrone.getCameraMode() == 2)))//正面カメラの場合に有効
{
// (4)物体(顔)検出
//create a vector array to store the face found
std::vector<Rect> faces;
face_cascade.detectMultiScale(grayscaleFrame, faces, 1.2, 4, CV_HAAR_FIND_BIGGEST_OBJECT|CV_HAAR_SCALE_IMAGE, Size(30,30));
//printf("FaceNum:%02d\n",faces.size());
// (5)検出された全ての顔位置に,四角を描画する
Point pt1;
Point pt2;
Point cPt1;//Center Mark
int mFaceHeight=0;
int mFaceWidth=0;
//複数検出の場合は、最大のものをTrackingする。
for(int i = 0; i < (signed)faces.size(); i++)
{
if(i==0)
{
pt1.x = faces[i].x + faces[i].width;
pt1.y = faces[i].y + faces[i].height;
mFaceHeight = faces[i].height;
mFaceWidth = faces[i].width;
pt2.x = faces[i].x ;
pt2.y = faces[i].y ;
cPt1.x = faces[i].x + faces[i].width/2;
cPt1.y = faces[i].y + faces[i].height/2;
}else
{
//最大の検出対象の値をキープ
if(faces[i-1].height < faces[i].height)
{
pt1.x = faces[i].x + faces[i].width;