image in OnNewFrame to opencv
Hi All,
I have the following code:
void OnNewFrame(const unsigned char *_image,
unsigned int _width, unsigned int _height, unsigned int _depth,
const std::string &_format)
{
// show in opencv
char *data;
data = new char[(_height * _width * 3) + 1]; // rgb 8 bit data
memcpy(data, _image, _height * _width * 3);
cv::Mat image(_height, _width, CV_8UC3, data);
cv::imshow("camera", image);
delete data;
}
I want to try to copy an image into opencv, but Gazebo show an error on cv::imshow("camera", image); Something with undefined symbol: _ZN2cv6imshowERKNS_6StringERKNS_11_InputArrayE. Any special compiler flags I need to set in my ROS launch file or CMakeList / package file?
Thanks in advance, Peter