23 std::vector<int> encode_params;
24 encode_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
27 std::vector<uchar> encoded_buffer;
28 cv::imencode(
".png", img, encoded_buffer, encode_params);
43 ss <<
"<img src=\"/stream?";
65 std::vector<int> encode_params;
66 encode_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
69 std::vector<uchar> encoded_buffer;
70 cv::imencode(
".png", img, encoded_buffer, encode_params);
73 sprintf(stamp,
"%.06lf", time.
toSec());
75 .
header(
"Connection",
"close")
76 .
header(
"Server",
"web_video_server")
78 "no-cache, no-store, must-revalidate, pre-check=0, post-check=0, " 80 .
header(
"X-Timestamp", stamp)
81 .
header(
"Pragma",
"no-cache")
82 .
header(
"Content-type",
"image/png")
83 .
header(
"Access-Control-Allow-Origin",
"*")
85 boost::lexical_cast<std::string>(encoded_buffer.size()))
virtual void sendImage(const cv::Mat &, const ros::Time &time)
async_web_server_cpp::HttpConnectionPtr connection_
PngSnapshotStreamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh)
static ReplyBuilder builder(status_type status)
void sendPartAndClear(const ros::Time &time, const std::string &type, std::vector< unsigned char > &data)
PngStreamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh)
void write(HttpConnectionPtr connection)
ReplyBuilder & header(const std::string &name, const std::string &value)
virtual void sendImage(const cv::Mat &, const ros::Time &time)
std::string get_query_param_value_or_default(const std::string &name, const std::string &default_value) const
boost::shared_ptr< ImageStreamer > create_streamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh)
std::string create_viewer(const async_web_server_cpp::HttpRequest &request)