16 static const char*
spec[] =
18 "implementation_id",
"CameraImageSaver",
19 "type_name",
"CameraImageSaver",
20 "description",
"camera image saver",
21 "version", HRPSYS_PACKAGE_VERSION,
23 "category",
"example",
24 "activity_type",
"DataFlowComponent",
27 "lang_type",
"compile",
29 "conf.defalt.basename",
"image",
38 m_imageIn(
"image", m_image),
105 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
111 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
122 switch (
m_image.data.image.format){
124 cvImage = cvCreateImage(cvSize(
m_image.data.image.width,
129 cvImage = cvCreateImage(cvSize(
m_image.data.image.width,
134 std::cerr <<
"unsupported color format(" 135 <<
m_image.data.image.format <<
")" << std::endl;
136 return RTC::RTC_ERROR;
138 switch(
m_image.data.image.format){
142 char *dst = cvImage->imageData;
143 for (
unsigned int i=0;
i<
m_image.data.image.raw_data.length();
i+=3){
144 dst[
i ] =
m_image.data.image.raw_data[
i+2];
145 dst[
i+1] =
m_image.data.image.raw_data[
i+1];
146 dst[
i+2] =
m_image.data.image.raw_data[
i ];
151 memcpy(cvImage->imageData,
152 m_image.data.image.raw_data.get_buffer(),
153 m_image.data.image.raw_data.length());
161 cvSaveImage(fname, cvImage);
163 cvReleaseImage(&cvImage);
213 RTC::Create<CameraImageSaver>,
214 RTC::Delete<CameraImageSaver>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
virtual ~CameraImageSaver()
Destructor.
Img::TimedCameraImage m_image
void CameraImageSaverInit(RTC::Manager *manager)
coil::Properties & getProperties()
ExecutionContextHandle_t UniqueId
CameraImageSaver(RTC::Manager *manager)
Constructor.
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
static const char * spec[]
InPort< Img::TimedCameraImage > m_imageIn
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
std::string sprintf(char const *__restrict fmt,...)
virtual RTC::ReturnCode_t onInitialize()
bool addInPort(const char *name, InPortBase &inport)
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)