I have one urdf model of a car. It gets one camera in front of it. its grabbing the picture and publishing on a topic. I have write a callBack function where it will receive the image data. By the pixel by pixel data it will convert it to a opencv image, and will display on a window. Now my next step is to use the image data to track one target object. which will be the best way to do. I am really stuck in here.
flag = 0;
ROS_INFO("in image node function");
int h = *(&img->height);
int w = *(&img->width);
cv::WImageBuffer3_b image(h,w);
int step = image.WidthStep();
step = 3;
for(int i=(h-1);i>=0;i--)
{
for(int j=(w-1);j>=0;j--)
{
*(image(i,j)) = *(&img->data[count]);
count++;
*(image(i,j)+1) = *(&img->data[count]);
count++;
*(image(i,j)+2) = *(&img->data[count]);
count++;
}
}
//ROS_INFO("data = [%d]",*(&img->data[0]));
cvStartWindowThread();
cvShowImage("view",image.Ipl());
the above is my imagecall back function. I have all the pixel data. please help me. Thank you in advance
Originally posted by Robot on ROS Answers with karma: 180 on 2014-10-06
Post score: 0
Original comments
Comment by Robot on 2014-10-06:
I am really stuck in here, please give me any hints,,, thank you in advance
Comment by ahendrix on 2014-10-06:
This has been the topic of a great many PhD theses. It may help if you can constrain your problem a little bit.
Comment by Robot on 2014-10-06:
using those pixel data I am able to generate the image. it is perfectly showing. the problem is the structure I am using to store the image file with all the relevant data is a WImagebuffer3_b. In order to perform any image processing I am gonna need in cv::Mat format. will cv_bridge will be perfect