Download modules/imgcodecs/perf/perf_jpeg.cpp from tgollogly/test: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/tgollogly/test/resolve/main/modules/imgcodecs/perf/perf_jpeg.cpp
- Command line
-
hf download hf://tgollogly/test/modules/imgcodecs/perf/perf_jpeg.cpp
-
curl -L -o perf_jpeg.cpp https://huggingface.co/tgollogly/test/resolve/main/modules/imgcodecs/perf/perf_jpeg.cpp
1.41 kB
| // This file is part of OpenCV project. | |
| // It is subject to the license terms in the LICENSE file found in the top-level directory | |
| // of this distribution and at http://opencv.org/license.html | |
| namespace opencv_test | |
| { | |
| using namespace perf; | |
| PERF_TEST(JPEG, Decode) | |
| { | |
| String filename = getDataPath("stitching/boat1.jpg"); | |
| FILE *f = fopen(filename.c_str(), "rb"); | |
| fseek(f, 0, SEEK_END); | |
| long len = ftell(f); | |
| fseek(f, 0, SEEK_SET); | |
| vector<uchar> file_buf((size_t)len); | |
| EXPECT_EQ(len, (long)fread(&file_buf[0], 1, (size_t)len, f)); | |
| fclose(f); f = NULL; | |
| TEST_CYCLE() imdecode(file_buf, IMREAD_UNCHANGED); | |
| SANITY_CHECK_NOTHING(); | |
| } | |
| PERF_TEST(JPEG, Decode_rgb) | |
| { | |
| String filename = getDataPath("stitching/boat1.jpg"); | |
| FILE *f = fopen(filename.c_str(), "rb"); | |
| fseek(f, 0, SEEK_END); | |
| long len = ftell(f); | |
| fseek(f, 0, SEEK_SET); | |
| vector<uchar> file_buf((size_t)len); | |
| EXPECT_EQ(len, (long)fread(&file_buf[0], 1, (size_t)len, f)); | |
| fclose(f); f = NULL; | |
| TEST_CYCLE() imdecode(file_buf, IMREAD_COLOR_RGB); | |
| SANITY_CHECK_NOTHING(); | |
| } | |
| PERF_TEST(JPEG, Encode) | |
| { | |
| String filename = getDataPath("stitching/boat1.jpg"); | |
| cv::Mat src = imread(filename); | |
| vector<uchar> buf; | |
| TEST_CYCLE() imencode(".jpg", src, buf); | |
| SANITY_CHECK_NOTHING(); | |
| } | |
| } // namespace |