首页 > 试题广场 >

12-4 编写一个应用程序,实现简单的图像处理。

[问答题]
12-4 编写一个应用程序,实现简单的图像处理。
  1. #include "JpegDecoder.h"
  2. #include <stdio.h>
  3. #include <opencv2/highgui.hpp>
  4. #include <math.h>
  5. using namespace JpegCodec;
  6. static cv::Mat ConvertToMat(Matrix &mat)
  7. {
  8.     int channel = CV_8UC3;
  9.     if (mat.channal == 1) channel = CV_8UC1;
  10.     cv::Mat img(mat.rows, mat.cols, channel); // create a new matrix
  11.     for (int i = 0; i < mat.rows * mat.cols * mat.channal; i++)
  12.     {
  13.         img.data[i] = mat.data[i];
  14.     }
  15.     return img;
  16. }
发表于 2020-09-15 15:42:41 回复(0)