anyKode Marilou
|
Cameras and images properties.
class DeviceCamera : public Device;
ModaCpp.h
The DeviceCamera class cannot be created directly by user : it must be obtained by QueryDeviceCamera of the class RobotPHX.
The DeviceCamera object allows to get images from a simulated camera device. Also, the device's working parameters can be changed dynamically.
The various parameters given to the functions can be interpreted and modified if necessary by the device in order to respect the constraints imposed in modeling.
//Sample from samples/devices/camera #include "stdafx.h" #include "Modacpp.h" #include "conio.h" #define MODASERVER "localhost" int main(int argc, char* argv[]) { ModaCPP::Connection *connection=new ModaCPP::Connection(true); //Try connect to MODA server if(connection->Connect(MODASERVER)) { _cprintf("Connection ok to moda server\r\n"); //Find the robot ModaCPP::RobotPHX *phx=connection->QueryRobotPHX("/"); if(phx) { _cprintf("phx found\r\n"); ModaCPP::DeviceCamera *pCamera=phx->QueryDeviceCamera("viewpoint0/camera"); if(pCamera) { _cprintf("camera found\r\n"); ModaCPP::Image theimage; while(!_kbhit()) { pCamera->GetNextImage(&theimage); if(theimage.IsValid()) { theimage.DoHorizontalFlip(); theimage.Display(0,0); } connection->Sleep(20); } } } else { _cprintf("robot not found\r\n"); } } else { _cprintf("Unable to connect to moda server\r\n"); } //Disconnect & delete connection->Disconnect(); delete connection; _getch(); return 0; }
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
|
What do you think about this topic? Send feedback!
|