Category : video-processing

AVFrame *cvmatToAvframe(cv::Mat *cv_image, AVFrame *av_frame, StreamingContext *decoder) { int width = cv_image->cols; int height = cv_image->rows; int typeOFImage = cv_image->type(); int cvLinesizes[1]; cvLinesizes[0] = cv_image->step1(); if (av_frame == NULL) { av_frame = av_frame_alloc(); } av_image_alloc(av_frame->data, av_frame->linesize, width, height, AVPixelFormat::AV_PIX_FMT_YUV420P, 1); SwsContext *conversion = sws_getContext(width, height, AVPixelFormat::AV_PIX_FMT_BGR24, width, height, AVPixelFormat::AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); if (!conversion) ..

Read more

#include <opencv2/imgcodecs.hpp> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> #include <iostream> using namespace std; using namespace cv; int main() { String path = "resources/grey scale forest.jpg"; Mat image = imread(path); Mat dst; equalizeHist(image, dst); imshow("forest", dst); waitKey(0); return 0; } When I tried running the above code I’ve got an exemption. I’ve found out the error was in ..

Read more