Skip to content

Implementation of colormap "Turbo"#15388

Merged
alalek merged 4 commits intoopencv:3.4from
atinfinity:impl-turbo-colormap
Aug 26, 2019
Merged

Implementation of colormap "Turbo"#15388
alalek merged 4 commits intoopencv:3.4from
atinfinity:impl-turbo-colormap

Conversation

@atinfinity
Copy link
Copy Markdown
Contributor

@atinfinity atinfinity commented Aug 24, 2019

This pullrequest changes

I implemented the colormap "Turbo" proposed by Google.

And, I add cv::COLORMAP_TURBO as the flag of cv::applyColorMap.
I checked this feature using the following code.

#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>

int main(int argc, const char* argv[])
{
    cv::Mat disp(cv::Size(256, 30), CV_8UC1, cv::Scalar(0));
    for(int y = 0; y < disp.rows; y++)
    {
        for(int x = 0; x < disp.cols; x++)
        {
            disp.at<uchar>(y, x) = x;
        }
    }

    cv::Mat turbo;
    cv::applyColorMap(disp, turbo, cv::COLORMAP_TURBO);
    cv::imwrite("colorscale_turbo.jpg", turbo);

    return 0;
}

colorscale_turbo

colormap == COLORMAP_VIRIDIS ? (colormap::ColorMap*)(new colormap::Viridis) :
colormap == COLORMAP_WINTER ? (colormap::ColorMap*)(new colormap::Winter) : 0;
colormap == COLORMAP_WINTER ? (colormap::ColorMap*)(new colormap::Winter) :
colormap == COLORMAP_TURBO ? (colormap::ColorMap*)(new colormap::Turbo) : 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep it sorted alphabetically for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catree Thank you for your comment! I fixed the order of check.

@alalek alalek merged commit 824465e into opencv:3.4 Aug 26, 2019
@alalek alalek mentioned this pull request Aug 30, 2019
@catree catree mentioned this pull request May 10, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants