Skip to content

Commit

Permalink
Add color map based on MatplotLib.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsy committed Oct 3, 2019
1 parent adfe8af commit d02df95
Show file tree
Hide file tree
Showing 5 changed files with 519 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -47,6 +47,15 @@ This library supports following methods.
* Uniform noise
* Perlin noise

### Image Assessment

* Mean squared error (MSE)
* Root mean squared error (RMSE)
* Peak signal-to-noise ratio (PSNR)
* Structural similarity (SSIM)
* Multi-scale structural similarity (MS-SSIM)
* Color multi-scale structural similarity (CM-SSIM)

## Samples

You can compile all the samples using CMake!
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/CMakeLists.txt
Expand Up @@ -4,6 +4,7 @@ endif()

message(STATUS "[ LIME ] Build examples.")
add_example(color_constancy)
add_example(colormap)
add_example(flow_field_design)
add_example(npr_filters)
add_example(pencil_drawing)
Expand Down
36 changes: 36 additions & 0 deletions examples/cpp/colormap/colormap.cpp
@@ -0,0 +1,36 @@
#include <opencv2/opencv.hpp>
#include <lime.hpp>

int main(int argc, char** argv) {
const int size = 256;
const int interval = size / 16;

cv::Mat intensity(size, size, CV_8UC1);
for (int y = 0; y < size; y++) {
for (int x = 0; x < size; x++) {
const int row = y / interval;
const int col = x / interval;
const int val = row * 16 + col;
intensity.at<uchar>(y, x) = val;
}
}

cv::Mat jet, coolwarm, inferno, magma, plasma, viridis;
lime::pseudoColors(intensity, jet, lime::CMap::Jet);
lime::pseudoColors(intensity, coolwarm, lime::CMap::CoolWarm);
lime::pseudoColors(intensity, inferno, lime::CMap::Inferno);
lime::pseudoColors(intensity, magma, lime::CMap::Magma);
lime::pseudoColors(intensity, plasma, lime::CMap::Plasma);
lime::pseudoColors(intensity, viridis, lime::CMap::Viridis);

cv::imshow("Intensity", intensity);
cv::imshow("Jet", jet);
cv::imshow("CoolWarm", coolwarm);
cv::imshow("Inferno", inferno);
cv::imshow("Magma", magma);
cv::imshow("Plasma", plasma);
cv::imshow("Viridis", viridis);

cv::waitKey();
cv::destroyAllWindows();
}

0 comments on commit d02df95

Please sign in to comment.