#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/Path.h>
#include <Poco/URI.h>
#include <iostream>
#include <string>
#include <Poco/JSON/JSON.h>
#include <Poco/JSON/Parser.h>
#include <Poco/Net/HTMLForm.h>
#include <Windows.h>
#include <vector>
#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_sinks.h>
#include <chrono>
#include <typeinfo>
#include <string>
#include "base64.cpp"
std::string host="127.0.0.1";
int port =2000;
std::string path="/images/"
Poco::Net::HTTPClientSession session(host, port);
session.setKeepAlive(true);
Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_POST, path);
std::string m_files_path=
"C:/Users/syste/OneDrive/Pictures/Screenshots/*.png";
std::vector<std::string> imageFiles;
cv::glob(m_files_path, imageFiles);
cv::Mat image = cv::imread(imageFiles[0]);
std::vector<unsigned char> buff;
cv::imencode(".png", image, buff);
auto base64_png = reinterpret_cast<const unsigned char*>(buff.data());
std::string body1 = base64_encode(base64_png, buff.size());
obj.set("photo1", body1);
std::stringstream ss;
obj.stringify(ss);
std::string body;
body = ss.str();
req.setContentType("application/json");
req.setContentLength(body.length());
session.sendRequest(req)<<body;
I am able to send image from cpp Client using poco server but the image taking more time to converting imencode and using base64 encode and making as stringify. So is any another method for sending data using post request of poco cpp.
If any faster methods for sending image suggest me to move forward.
In my case processing 1 image taking 0.45-0.55 seconds. but i want to send atleast 60 images per second.