10 #include <opencv2/highgui/highgui_c.h> 11 #include <opencv2/imgproc/imgproc_c.h> 13 #define CV_RGB( r, g, b ) cvScalar( (b), (g), (r), 0 ) 16 #include "hrpsys/util/VectorConvert.h" 20 static const char*
spec[] =
22 "implementation_id",
"ColorExtractor",
23 "type_name",
"ColorExtractor",
24 "description",
"rotate image component",
25 "version", HRPSYS_PACKAGE_VERSION,
27 "category",
"example",
28 "activity_type",
"DataFlowComponent",
31 "lang_type",
"compile",
33 "conf.default.minPixels",
"0",
34 "conf.default.rgbRegion",
"0,0,0,0,0,0",
43 m_originalIn(
"original", m_original),
44 m_resultOut(
"result", m_result),
45 m_posOut(
"pos", m_pos),
62 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
116 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
122 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
135 ||
m_img->height != idat.height)){
136 cvReleaseImage(&
m_img);
140 m_img = cvCreateImage(cvSize(idat.width, idat.height),
142 m_result.data.image.width = idat.width;
143 m_result.data.image.height = idat.height;
144 m_result.data.image.format = idat.format;
145 m_result.data.image.raw_data.length(idat.width*idat.height*3);
149 unsigned char *
rtm=idat.raw_data.get_buffer();
151 for (
int i=0;
i<idat.height;
i++){
152 for (
int j=0; j<idat.width; j++){
162 int npixel=0, cx=0, cy=0;
164 for (
int i=0;
i<idat.height;
i++){
165 for (
int j=0; j<idat.width; j++){
167 b = cv[0]; g = cv[1]; r = cv[2];
181 cvCircle(
m_img, cvPoint(cx, cy), sqrt(npixel),
CV_RGB(0,0,255), 6, 8, 0);
190 rtm =
m_result.data.image.raw_data.get_buffer();
191 for (
int i=0;
i<idat.height;
i++){
192 for (
int j=0; j<idat.width; j++){
250 RTC::Create<ColorExtractor>,
251 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)
virtual bool write(DataType &value)
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)