Skip to content

Commit d02df95

Browse files
committed
Add color map based on MatplotLib.
1 parent adfe8af commit d02df95

5 files changed

Lines changed: 519 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ This library supports following methods.
4747
* Uniform noise
4848
* Perlin noise
4949

50+
### Image Assessment
51+
52+
* Mean squared error (MSE)
53+
* Root mean squared error (RMSE)
54+
* Peak signal-to-noise ratio (PSNR)
55+
* Structural similarity (SSIM)
56+
* Multi-scale structural similarity (MS-SSIM)
57+
* Color multi-scale structural similarity (CM-SSIM)
58+
5059
## Samples
5160

5261
You can compile all the samples using CMake!

examples/cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ endif()
44

55
message(STATUS "[ LIME ] Build examples.")
66
add_example(color_constancy)
7+
add_example(colormap)
78
add_example(flow_field_design)
89
add_example(npr_filters)
910
add_example(pencil_drawing)

examples/cpp/colormap/colormap.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <opencv2/opencv.hpp>
2+
#include <lime.hpp>
3+
4+
int main(int argc, char** argv) {
5+
const int size = 256;
6+
const int interval = size / 16;
7+
8+
cv::Mat intensity(size, size, CV_8UC1);
9+
for (int y = 0; y < size; y++) {
10+
for (int x = 0; x < size; x++) {
11+
const int row = y / interval;
12+
const int col = x / interval;
13+
const int val = row * 16 + col;
14+
intensity.at<uchar>(y, x) = val;
15+
}
16+
}
17+
18+
cv::Mat jet, coolwarm, inferno, magma, plasma, viridis;
19+
lime::pseudoColors(intensity, jet, lime::CMap::Jet);
20+
lime::pseudoColors(intensity, coolwarm, lime::CMap::CoolWarm);
21+
lime::pseudoColors(intensity, inferno, lime::CMap::Inferno);
22+
lime::pseudoColors(intensity, magma, lime::CMap::Magma);
23+
lime::pseudoColors(intensity, plasma, lime::CMap::Plasma);
24+
lime::pseudoColors(intensity, viridis, lime::CMap::Viridis);
25+
26+
cv::imshow("Intensity", intensity);
27+
cv::imshow("Jet", jet);
28+
cv::imshow("CoolWarm", coolwarm);
29+
cv::imshow("Inferno", inferno);
30+
cv::imshow("Magma", magma);
31+
cv::imshow("Plasma", plasma);
32+
cv::imshow("Viridis", viridis);
33+
34+
cv::waitKey();
35+
cv::destroyAllWindows();
36+
}

0 commit comments

Comments
 (0)