10 #include "hrpsys/util/VectorConvert.h" 17 "implementation_id",
"VideoCapture",
18 "type_name",
"VideoCapture",
19 "description",
"video capture component",
20 "version", HRPSYS_PACKAGE_VERSION,
22 "category",
"example",
23 "activity_type",
"DataFlowComponent",
26 "lang_type",
"compile",
28 "conf.default.initialMode",
"continuous",
29 "conf.default.devIds",
"0",
30 "conf.default.width",
"640",
31 "conf.default.height",
"480",
32 "conf.default.frameRate",
"1",
41 m_MultiCameraImagesOut (
"MultiCameraImages", m_MultiCameraImages),
42 m_CameraImageOut (
"CameraImage", m_CameraImage),
43 m_CameraCaptureServicePort(
"CameraCaptureService"),
44 m_CameraCaptureService(this),
47 m_needToReactivate(false)
59 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
118 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
127 std::cout <<
"** devId:" <<
m_devIds[0] << std::endl;
138 for (
unsigned int i = 0;
i <
m_devIds.size ();
i++)
140 std::cout <<
"** devId:" <<
m_devIds[
i] << std::endl;
156 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
173 std::cerr <<
m_profile.instance_name <<
": failed to capture." << std::endl;
180 double dt = (double)(tNew -
m_tOld);
204 uchar *imgFrom =
m_cameras[0]->capture();
205 if (!imgFrom)
return false;
206 memcpy(
m_CameraImage.data.image.raw_data.get_buffer(), imgFrom,
213 if (!imgFrom)
return false;
279 RTC::Create<VideoCapture>,
280 RTC::Delete<VideoCapture>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
virtual ~VideoCapture()
Destructor.
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
OutPort< Img::TimedCameraImage > m_CameraImageOut
bool addOutPort(const char *name, OutPortBase &outport)
Img::TimedMultiCameraImage m_MultiCameraImages
static const char * videocapture_spec[]
void VideoCaptureInit(RTC::Manager *manager)
int gettimeofday(struct timeval *tv, struct timezone *tz)
int init(size_t _width, size_t _height, unsigned int devId)
virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id)
ExecutionContextHandle_t UniqueId
OutPort< Img::TimedMultiCameraImage > m_MultiCameraImagesOut
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
virtual RTC::ReturnCode_t onInitialize()
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
bool addPort(PortBase &port)
virtual bool write(DataType &value)
Img::TimedCameraImage m_CameraImage
std::vector< int > m_devIds
std::vector< v4l_capture * > m_cameras
VideoCapture(RTC::Manager *manager)
Constructor.
RTC::CorbaPort m_CameraCaptureServicePort
CameraCaptureService_impl m_CameraCaptureService
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
std::string m_initialMode
bool registerProvider(const char *instance_name, const char *type_name, PortableServer::RefCountServantBase &provider)