Changeset 147 in flair-src for trunk/demos/OpticalFlow/uav/src
- Timestamp:
- Feb 28, 2017, 12:45:08 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp
r143 r147 58 58 59 59 //optical flow stack 60 //opticalFlow= matrice de déplacements en pixels entre 2 images consécutives 61 opticalFlow=new OpticalFlow(greyCameraImage,uav->GetVerticalCamera()->GetLayout()->NewRow(),"flux optique"); 62 opticalFlowSpeedRaw=new OpticalFlowSpeed(opticalFlow,"vitesse du flux optique"); 63 //opticalFlowSpeed=vitesse de déplacement en pixel par seconde (moyenne sur tous les points et division par le delta T) 64 cvmatrix* twoByOneSpeed=new cvmatrix((const Thread*)this,2,1,floatType); 65 opticalFlowSpeed=new LowPassFilter(opticalFlowSpeedRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Speed lowPass",twoByOneSpeed); 66 cvmatrix* twoByOneAccelerationRaw=new cvmatrix((const Thread*)this,2,1,floatType); 67 opticalFlowAccelerationRaw=new EulerDerivative(opticalFlowSpeed,uav->GetVerticalCamera()->GetLayout()->NewRow(),"derivative",twoByOneAccelerationRaw); 68 cvmatrix* twoByOneAcceleration=new cvmatrix((const Thread*)this,2,1,floatType); 69 opticalFlowAcceleration=new LowPassFilter(opticalFlowAccelerationRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Acceleration lowPass",twoByOneAcceleration); 70 71 getFrameworkManager()->AddDeviceToLog(opticalFlowSpeedRaw); 60 //opticalFlow= matrice de déplacements en pixels entre 2 images consécutives 61 opticalFlow=new OpticalFlow(greyCameraImage,uav->GetVerticalCamera()->GetLayout()->NewRow(),"flux optique"); 62 opticalFlowSpeedRaw=new OpticalFlowSpeed(opticalFlow,"vitesse du flux optique"); 63 //opticalFlowSpeed=vitesse de déplacement en pixels par seconde (moyenne sur tous les points et division par le delta T) 64 cvmatrix* twoByOne=new cvmatrix((const Thread*)this,2,1,floatType); 65 opticalFlowSpeed=new LowPassFilter(opticalFlowSpeedRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Speed lowPass",twoByOne); 66 opticalFlowAccelerationRaw=new EulerDerivative(opticalFlowSpeed,uav->GetVerticalCamera()->GetLayout()->NewRow(),"derivative",twoByOne); 67 opticalFlowAcceleration=new LowPassFilter(opticalFlowAccelerationRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Acceleration lowPass",twoByOne); 68 delete twoByOne; 69 70 getFrameworkManager()->AddDeviceToLog(opticalFlowSpeedRaw); 72 71 73 72 Tab* opticalFlowTab=new Tab(getFrameworkManager()->GetTabWidget(),"flux optique"); 74 73 DataPlot1D* xVelocityPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x speed (px/s)",-250,250); 75 74 DataPlot1D* yVelocityPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y speed (px/s)",-250,250); 76 77 75 DataPlot1D* xAccelerationPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x_acceleration",-250,250); 76 DataPlot1D* yAccelerationPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y_acceleration",-250,250); 78 77 79 78 xVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(0,0)); … … 81 80 yVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(1,0)); 82 81 yVelocityPlot->AddCurve(opticalFlowSpeed->Matrix()->Element(1,0),DataPlot::Blue); 83 84 85 86 82 xAccelerationPlot->AddCurve(opticalFlowAccelerationRaw->Matrix()->Element(0,0)); 83 xAccelerationPlot->AddCurve(opticalFlowAcceleration->Matrix()->Element(0,0),DataPlot::Blue); 84 yAccelerationPlot->AddCurve(opticalFlowAccelerationRaw->Matrix()->Element(1,0)); 85 yAccelerationPlot->AddCurve(opticalFlowAcceleration->Matrix()->Element(1,0),DataPlot::Blue); 87 86 88 87 u_x=new Pid(setupLawTab->At(1,0),"u_x");
Note:
See TracChangeset
for help on using the changeset viewer.