https://github.com/opencv/opencv/issues/4292
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
int main(int argc, char ** argv)
{
FILE* f = fopen("人脸.jpg", "rb");
fseek(f, 0, SEEK_END); // seek to end of file
size_t buffer_size = ftell(f); // get current file pointer
fseek(f, 0, SEEK_SET); // seek back to beginning of file
std::vector<char> buffer(buffer_size);
fread(&buffer[0], sizeof(char), buffer_size, f);
fclose(f);
cv::Mat frame = cv::imdecode(buffer, cv::IMREAD_COLOR);
cv::imshow("Camera", frame);
cv::waitKey();
}