15 static const char*
spec[] =
17 "implementation_id",
"RotateImage",
18 "type_name",
"RotateImage",
19 "description",
"rotate image component",
20 "version", HRPSYS_PACKAGE_VERSION,
22 "category",
"example",
23 "activity_type",
"DataFlowComponent",
26 "lang_type",
"compile",
28 "conf.default.angle",
"0.0",
37 m_originalIn(
"original", m_original),
38 m_rotatedOut(
"rotated", m_rotated),
40 m_angle(1.0), m_src(NULL), m_dst(NULL),
56 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
109 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
115 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
127 int nchannels = idat.format == Img::CF_GRAY ? 1 : 3;
130 ||
m_src->height != idat.height)){
131 cvReleaseImage(&
m_src);
132 cvReleaseImage(&
m_dst);
136 m_src = cvCreateImage(cvSize(idat.width, idat.height),
137 IPL_DEPTH_8U, nchannels);
138 m_dst = cvCreateImage(cvSize(idat.width, idat.height),
139 IPL_DEPTH_8U, nchannels);
141 m_rotated.data.image.height = idat.height;
142 m_rotated.data.image.format = idat.format;
143 m_rotated.data.image.raw_data.length(idat.width*idat.height*nchannels);
146 memcpy(
m_src->imageData, idat.raw_data.get_buffer(),
147 idat.raw_data.length());
149 CvMat *rotationMat = cvCreateMat(2,3, CV_32FC1);
150 cv2DRotationMatrix(cvPoint2D32f(idat.width/2, idat.height/2),
153 cvReleaseMat(&rotationMat);
155 memcpy(
m_rotated.data.image.raw_data.get_buffer(),
207 RTC::Create<RotateImage>,
208 RTC::Delete<RotateImage>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
RotateImage(RTC::Manager *manager)
Constructor.
InPort< Img::TimedCameraImage > m_originalIn
virtual RTC::ReturnCode_t onInitialize()
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
Img::TimedCameraImage m_original
bool addOutPort(const char *name, OutPortBase &outport)
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
static const char * spec[]
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
virtual ~RotateImage()
Destructor.
OutPort< Img::TimedCameraImage > m_rotatedOut
Img::TimedCameraImage m_rotated
void RotateImageInit(RTC::Manager *manager)
virtual bool write(DataType &value)
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)