norm.cpp 825 B

123456789101112131415161718192021222324252627282930313233
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html
  4. #include <opencv2/core.hpp>
  5. #include <opencv2/imgcodecs.hpp>
  6. #include <cstdint>
  7. #include <array>
  8. #include <iostream>
  9. #include "raw_pixels.hpp"
  10. #define IMG_ROWS 100
  11. #define IMG_COLS 100
  12. static_assert(IMG_ROWS * IMG_COLS <= RAW_PIXELS_SIZE, "Incompatible size");
  13. int main(void)
  14. {
  15. // Number of experiment runs
  16. int no_runs = 2;
  17. // https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html
  18. cv::Mat src(IMG_ROWS, IMG_COLS, CV_8UC1, (void *)raw_pixels);
  19. // Run calc Hist
  20. for(int i=0; i < no_runs; i++){
  21. std::cout << "Running iteration # "<< i << std::endl;
  22. cv::norm(src);
  23. }
  24. return 0;
  25. }