/home/liu/actions-runner/_work/ccv/ccv/test/unit/image_processing.tests.c
Line | Count | Source |
1 | | #include "ccv.h" |
2 | | #include "case.h" |
3 | | #include "ccv_case.h" |
4 | | |
5 | | #ifdef HAVE_LIBPNG |
6 | | TEST_CASE("image saturation") |
7 | 1 | { |
8 | 1 | ccv_dense_matrix_t* image = 0; |
9 | 1 | ccv_read("../../samples/nature.png", &image, CCV_IO_RGB_COLOR | CCV_IO_ANY_FILE); |
10 | 1 | ccv_dense_matrix_t* b = 0; |
11 | 1 | ccv_saturation(image, &b, 0, 0.5); |
12 | 1 | REQUIRE_MATRIX_FILE_EQ(b, "data/nature.saturation.0.5.bin", "should be desaturated image"); |
13 | 1 | ccv_matrix_free(b); |
14 | 1 | b = 0; |
15 | 1 | ccv_saturation(image, &b, 0, 1.5); |
16 | 1 | REQUIRE_MATRIX_FILE_EQ(b, "data/nature.saturation.1.5.bin", "should be oversaturated image"); |
17 | 1 | ccv_matrix_free(b); |
18 | 1 | ccv_matrix_free(image); |
19 | 1 | } |
20 | | |
21 | | TEST_CASE("image contrast") |
22 | 1 | { |
23 | 1 | ccv_dense_matrix_t* image = 0; |
24 | 1 | ccv_read("../../samples/nature.png", &image, CCV_IO_RGB_COLOR | CCV_IO_ANY_FILE); |
25 | 1 | ccv_dense_matrix_t* b = 0; |
26 | 1 | ccv_contrast(image, &b, 0, 0.5); |
27 | 1 | REQUIRE_MATRIX_FILE_EQ(b, "data/nature.contrast.0.5.bin", "should be decontrasted image"); |
28 | 1 | ccv_matrix_free(b); |
29 | 1 | b = 0; |
30 | 1 | ccv_contrast(image, &b, 0, 1.5); |
31 | 1 | REQUIRE_MATRIX_FILE_EQ(b, "data/nature.contrast.1.5.bin", "should be overcontrasted image"); |
32 | 1 | ccv_matrix_free(b); |
33 | 1 | ccv_matrix_free(image); |
34 | 1 | } |
35 | | #endif |
36 | | |
37 | | #include "case_main.h" |