10 #include <opencv2/highgui/highgui.hpp> 11 #include <opencv2/imgproc/imgproc.hpp> 12 #include <opencv2/core/core.hpp> 13 #include <opencv2/imgproc/types_c.h> 20 "implementation_id",
"RGB2Gray",
21 "type_name",
"RGB2Gray",
22 "description",
"rgb2gray component",
23 "version", HRPSYS_PACKAGE_VERSION,
25 "category",
"example",
26 "activity_type",
"DataFlowComponent",
29 "lang_type",
"compile",
39 m_rgbIn(
"rgb", m_rgb),
40 m_grayOut(
"gray", m_gray),
54 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
106 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
112 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
122 Img::ImageData& idat =
m_rgb.data.image;
124 cv::Mat src(idat.height, idat.width, CV_8UC3,
125 idat.raw_data.get_buffer());
127 cv::cvtColor(src, dst, CV_RGB2GRAY);
129 m_gray.data.image.width = idat.width;
130 m_gray.data.image.height = idat.height;
131 m_gray.data.image.format = Img::CF_GRAY;
132 m_gray.data.image.raw_data.length(idat.width*idat.height);
133 memcpy(
m_gray.data.image.raw_data.get_buffer(),
134 dst.data, idat.width*idat.height);
185 RTC::Create<RGB2Gray>,
186 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