ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your

IplImage copy = currentImage;

beacause at that point the image cannot be filled. Your callback is called in ros::spinOnce(), so before your first call of spinOnce() your currentImage is 100% empty.Afterwards it might be empty.

Check in your while loop and process only if filled:

ros::Rate loop_rate(5);

IplImage copy = currentImage; IplImage* frame = © // computation......ERROR while (ros::ok()) { ros::spinOnce();

   if ( !currentImage.empty() )

{ IplImage copy = currentImage;

 //other computations.......Error

}

    loop_rate.sleep();
}

Your

IplImage copy = currentImage;

beacause at that point the image cannot be filled. Your callback is called in ros::spinOnce(), so before your first call of spinOnce() your currentImage is 100% empty.Afterwards it might be empty.

Check in your while loop and process only if filled:

ros::Rate loop_rate(5);  

IplImage copy = currentImage; IplImage* frame = © // computation......ERROR while (ros::ok()) { ros::spinOnce();

ros::spinOnce();
    if ( !currentImage.empty() )

{ IplImage copy = currentImage;

currentImage;
  //other computations.......Error
computations. }

}

     loop_rate.sleep();
 }

Your

IplImage copy = currentImage;

beacause cannot work because at that point the image cannot be filled. Your callback is called in ros::spinOnce(), so before your first call of spinOnce() your currentImage is 100% empty.Afterwards it might be empty.

Check in your while loop and process only if filled:

ros::Rate loop_rate(5);  

while (ros::ok())
 {
        ros::spinOnce();

       if ( !currentImage.empty() )
       {
           IplImage copy = currentImage;

          //other computations.
        }

        loop_rate.sleep();
 }