10 #include <opencv2/highgui/highgui.hpp> 11 #include <opencv2/imgproc/imgproc.hpp> 12 #include <opencv2/core/core.hpp> 19 "implementation_id",
"RGB2Gray",
20 "type_name",
"RGB2Gray",
21 "description",
"rgb2gray component",
22 "version", HRPSYS_PACKAGE_VERSION,
24 "category",
"example",
25 "activity_type",
"DataFlowComponent",
28 "lang_type",
"compile",
38 m_rgbIn(
"rgb", m_rgb),
39 m_grayOut(
"gray", m_gray),
53 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
105 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
111 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
121 Img::ImageData& idat =
m_rgb.data.image;
123 cv::Mat src(idat.height, idat.width, CV_8UC3,
124 idat.raw_data.get_buffer());
126 cv::cvtColor(src, dst, CV_RGB2GRAY);
128 m_gray.data.image.width = idat.width;
129 m_gray.data.image.height = idat.height;
130 m_gray.data.image.format = Img::CF_GRAY;
131 m_gray.data.image.raw_data.length(idat.width*idat.height);
132 memcpy(
m_gray.data.image.raw_data.get_buffer(),
133 dst.data, idat.width*idat.height);
184 RTC::Create<RGB2Gray>,
185 RTC::Delete<RGB2Gray>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
Img::TimedCameraImage m_rgb
InPort< Img::TimedCameraImage > m_rgbIn
static const char * jpegdecoder_spec[]
virtual ~RGB2Gray()
Destructor.
RGB2Gray(RTC::Manager *manager)
Constructor.
void RGB2GrayInit(RTC::Manager *manager)
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
bool addOutPort(const char *name, OutPortBase &outport)
virtual RTC::ReturnCode_t onInitialize()
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
ExecutionContextHandle_t UniqueId
OutPort< Img::TimedCameraImage > m_grayOut
virtual bool write(DataType &value)
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Img::TimedCameraImage m_gray