Skip to content

Implementation of colormap "DeepGreen"#17260

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
jsxyhelu:add_deepgreen_colormap
May 12, 2020
Merged

Implementation of colormap "DeepGreen"#17260
opencv-pushbot merged 1 commit intoopencv:3.4from
jsxyhelu:add_deepgreen_colormap

Conversation

@jsxyhelu
Copy link
Copy Markdown
Contributor

@jsxyhelu jsxyhelu commented May 11, 2020

This pullrequest changes

from #17254
I need to implement the "false color" transformation of the green theme. Of the templates currently provided, only COLORMAP_SUMMER is the closest, but its color is too light and does not look very clear,in my opinion. So I combined the two existing templates of COLORMAP_OCEAN and COLORMAP_SUMMER to build a new colormap "DeepGreen". It can achieve significant pseudo-color transformation of the green theme.
Also, I add cv::COLORMAP_DEEPGREEN 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 deepgreen;
    cv::applyColorMap(disp, deepgreen, cv::COLORMAP_DEEPGREEN);
    cv::imwrite("colorscale_deepgreen.jpg", deepgreen);
    return 0;
}

colorscale_deepgreen

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov
Copy link
Copy Markdown
Contributor

Thanks for the contribution. Could you add some tests for the new feature or extend the existing one?

@jsxyhelu
Copy link
Copy Markdown
Contributor Author

@asmorkalov This pullrequest hase been changed。

@asmorkalov asmorkalov added category: imgproc pr: needs test New functionality requires minimal tests set labels May 12, 2020
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you for contribution 👍

@opencv-pushbot opencv-pushbot merged commit 508bd3f into opencv:3.4 May 12, 2020
@alalek alalek mentioned this pull request May 12, 2020
@catree catree mentioned this pull request Oct 11, 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