2 #include <gtest/gtest.h> 3 #include <camera_calibration_parsers/parse.h> 5 #include <opencv2/highgui/highgui.hpp> 8 #include <boost/foreach.hpp> 19 if (camera_ns ==
"/camera")
20 throw "Must remap 'camera' to the camera namespace.";
29 std::string raw_image_file, cam_info_file;
30 if (!local_nh.
getParam(
"raw_image_file", raw_image_file))
31 throw "Must set parameter ~raw_image_file.";
32 if (!local_nh.
getParam(
"camera_info_file", cam_info_file))
33 throw "Must set parameter ~camera_info_file.";
36 cv::Mat img = cv::imread(raw_image_file, 0);
39 if (!camera_calibration_parsers::readCalibration(cam_info_file, cam_name,
cam_info))
40 throw "Failed to read camera info file.";
72 cam_pub.
publish(*raw_image, cam_info);
76 void callback(
const sensor_msgs::ImageConstPtr& msg)
94 int main(
int argc,
char** argv)
96 ros::init(argc, argv,
"imageproc_rostest");
97 testing::InitGoogleTest(&argc, argv);
98 return RUN_ALL_TESTS();
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
std::string resolveName(const std::string &name, bool remap=true) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
std::vector< TopicInfo > V_TopicInfo
TEST_F(ImageProcTest, monoSubscription)
ROSCPP_DECL void spin(Spinner &spinner)
void callback(const sensor_msgs::ImageConstPtr &msg)
CameraPublisher advertiseCamera(const std::string &base_topic, uint32_t queue_size, bool latch=false)
sensor_msgs::CameraInfo cam_info
image_transport::CameraPublisher cam_pub
bool getParam(const std::string &key, std::string &s) const
int main(int argc, char **argv)
ROSCPP_DECL void shutdown()
sensor_msgs::ImagePtr raw_image
sensor_msgs::ImagePtr toImageMsg() const
std::string topic_rect_color