12 #include "hrpsys/util/VectorConvert.h" 16 static const char*
spec[] =
18 "implementation_id",
"ColorExtractor",
19 "type_name",
"ColorExtractor",
20 "description",
"rotate image component",
21 "version", HRPSYS_PACKAGE_VERSION,
23 "category",
"example",
24 "activity_type",
"DataFlowComponent",
27 "lang_type",
"compile",
29 "conf.default.minPixels",
"0",
30 "conf.default.rgbRegion",
"0,0,0,0,0,0",
39 m_originalIn(
"original", m_original),
40 m_resultOut(
"result", m_result),
41 m_posOut(
"pos", m_pos),
58 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
112 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
118 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
131 ||
m_img->height != idat.height)){
132 cvReleaseImage(&
m_img);
136 m_img = cvCreateImage(cvSize(idat.width, idat.height),
138 m_result.data.image.width = idat.width;
139 m_result.data.image.height = idat.height;
140 m_result.data.image.format = idat.format;
141 m_result.data.image.raw_data.length(idat.width*idat.height*3);
145 unsigned char *
rtm=idat.raw_data.get_buffer();
147 for (
int i=0;
i<idat.height;
i++){
148 for (
int j=0;
j<idat.width;
j++){
158 int npixel=0, cx=0, cy=0;
160 for (
int i=0;
i<idat.height;
i++){
161 for (
int j=0;
j<idat.width;
j++){
163 b = cv[0]; g = cv[1]; r = cv[2];
177 cvCircle(
m_img, cvPoint(cx, cy), sqrt(npixel), CV_RGB(0,0,255), 6, 8, 0);
186 rtm =
m_result.data.image.raw_data.get_buffer();
187 for (
int i=0;
i<idat.height;
i++){
188 for (
int j=0;
j<idat.width;
j++){
246 RTC::Create<ColorExtractor>,
247 RTC::Delete<ColorExtractor>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
bool addOutPort(const char *name, OutPortBase &outport)
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
def j(str, encoding="cp932")
virtual bool write(DataType &value)
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)