ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi,

From your comment it appears that you are using the newer version of openCV where the images are of the cv::Mat type and not IplImage. In that case, where you are using C++ functions of OpenCV there are following replacements for the functions you have used:

cvCreateImage() = cv::create()

cvGetSize() = cv::size()

In general I might have written one of your above lines as:

cv_ptr_red.create(cv::size(cv_ptr), CV_8UC1);

Further, I believe you may have to include the following header file since you are using CVbridge:

include "cv_bridge/cv_bridge.h"

You may have to do relevant changes in your manifest file for this change to be accommodated. But before going into details I would want to know if you believe, I took you in the right direction!

For the complete details of the functions I have provided above you may want to check the following link by searching for relevant functions:

OpenCV Documentation

Hope this helps.

Regards,

click to hide/show revision 2
corrected the functions written earlier.

Hi,

From your comment it appears that you are using the newer version of openCV where the images are of the cv::Mat type and not IplImage. In that case, where you are using C++ functions of OpenCV there are following replacements for the functions you have used:

cvCreateImage() = cv::create()

cvGetSize() = cv::size()

In general I might have written one of your above lines as:

cv_ptr_red.create(cv::size(cv_ptr), cv_ptr_red->image.create(cv_ptr->image.size(), CV_8UC1);

Further, I believe you may have to include the following header file since you are using CVbridge:

include "cv_bridge/cv_bridge.h"

You may have to do relevant changes in your manifest file for this change to be accommodated. But before going into details I would want to know if you believe, I took you in the right direction!

For the complete details of the functions I have provided above you may want to check the following link by searching for relevant functions:

OpenCV Documentation

Hope this helps.

Regards,

click to hide/show revision 3
Explained the details of cv_bridge::CvImagePtr cv_ptr;

Hi,

From your comment it appears that you are using the newer version of openCV where the images are of the cv::Mat type and not IplImage. In that case, where you are using C++ functions of OpenCV there are following replacements for the functions you have used:

cvCreateImage() = cv::create()

cvGetSize() = cv::size()

In general I might have written one of your above lines as:

cv_ptr_red->image.create(cv_ptr->image.size(), CV_8UC1);

Further, I believe you may have to include the following header file since you are using CVbridge:

include "cv_bridge/cv_bridge.h"

You may have to do relevant changes in your manifest file for this change to be accommodated. But before going into details I would want to know if you believe, I took you in the right direction!

For the complete details of the functions I have provided above you may want to check the following link by searching for relevant functions:

OpenCV Documentation

Whenever you use cv_bridge to create an opencv image it is important to note that image is a member element of the class you create.

For example, if you create an image like this:

cv_bridge::CvImagePtr cv_ptr;

Then the image and all its members could only be accessed by,

cv_ptr->image, cv_ptr->image.size(), cv_ptr->image.rows, etc.

Hope this helps.

Regards,