10 #include <opencv2/highgui/highgui_c.h> 11 #include <opencv2/imgproc/imgproc_c.h> 18 "implementation_id",
"ResizeImage",
19 "type_name",
"ResizeImage",
20 "description",
"resize image component",
21 "version", HRPSYS_PACKAGE_VERSION,
23 "category",
"example",
24 "activity_type",
"DataFlowComponent",
27 "lang_type",
"compile",
29 "conf.default.scale",
"1.0",
38 m_originalIn(
"original", m_original),
39 m_resizedOut(
"resized", m_resized),
41 m_scale(1.0), m_src(NULL), m_dst(NULL),
57 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
110 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
116 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
128 int nchannels = idat.format == Img::CF_GRAY ? 1 : 3;
132 ||
m_src->height != idat.height)){
133 cvReleaseImage(&
m_src);
134 cvReleaseImage(&
m_dst);
138 m_src = cvCreateImage(cvSize(idat.width, idat.height),
139 IPL_DEPTH_8U, nchannels);
140 m_dst = cvCreateImage(cvSize(w,h), IPL_DEPTH_8U, nchannels);
143 m_resized.data.image.format = idat.format;
144 m_resized.data.image.raw_data.length(w*h*nchannels);
147 memcpy(
m_src->imageData, idat.raw_data.get_buffer(),
148 idat.raw_data.length());
152 memcpy(
m_resized.data.image.raw_data.get_buffer(),
204 RTC::Create<ResizeImage>,
205 RTC::Delete<ResizeImage>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
Img::TimedCameraImage m_resized
void ResizeImageInit(RTC::Manager *manager)
ResizeImage(RTC::Manager *manager)
Constructor.
bool addOutPort(const char *name, OutPortBase &outport)
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
InPort< Img::TimedCameraImage > m_originalIn
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
virtual ~ResizeImage()
Destructor.
OutPort< Img::TimedCameraImage > m_resizedOut
virtual RTC::ReturnCode_t onInitialize()
virtual bool write(DataType &value)
static const char * jpegdecoder_spec[]
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
Img::TimedCameraImage m_original
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)