src/imgsubcriber.cpp
void imageCallback(const sensor_msgs::ImageConstPtr& msg){

  try{

    cv::imshow("Face Detection", cv_bridge::toCvShare(msg, "bgr8")->image); // displays an subcribed image 
    cv::waitKey(30);
  
  }

  catch (cv_bridge::Exception& e){
  
    ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str()); // display Exception whwn image could not be displayed

  }

}
// imageCallback function gets the image 
// it displays an image in window
imageCallback function gets the image
it displays an image in window
imageCallback function gets the image it displays an image in window
void imageCallback(const sensor_msgs::ImageConstPtr& msg){
  try{
    cv::imshow("Face Detection", cv_bridge::toCvShare(msg, "bgr8")->image); 
    cv::waitKey(30);
  }
  catch (cv_bridge::Exception& e){
    ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str()); 
  }
}
void imageCallback ( const sensor_msgs :: ImageConstPtr & msg ) { try { cv :: imshow ( " " , cv_bridge :: toCvShare ( msg , " " ) -> image ) ; cv :: waitKey ( 30 ) ; } catch ( cv_bridge :: Exception & e ) { ROS_ERROR ( " " , msg -> encoding . c_str ( ) ) ; } }
imageCallback function gets the image
it displays an image in window
imageCallback function gets the image it displays an image in window
// displays an subcribed image  // display Exception whwn image could not be displayed