Skip to content

add a DeepGreen colormap#17254

Closed
jsxyhelu wants to merge 6 commits intoopencv:3.4from
jsxyhelu:3.4
Closed

add a DeepGreen colormap#17254
jsxyhelu wants to merge 6 commits intoopencv:3.4from
jsxyhelu:3.4

Conversation

@jsxyhelu
Copy link
Copy Markdown
Contributor

@jsxyhelu jsxyhelu commented May 10, 2020

This pullrequest changes

I implemented the colormap "DeepGreen"
And, 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

@jsxyhelu
Copy link
Copy Markdown
Contributor Author

why the autobot is always blocked?

@jsxyhelu jsxyhelu changed the title add deepgreen colormap add a DeepGreen colormap May 10, 2020
@catree
Copy link
Copy Markdown
Contributor

catree commented May 10, 2020

@jsxyhelu You have to create a branch with a specific name.
See:

If you have a clean local state on your computer, it is something like:

# 3.4 branch
git checkout 3.4
# create new branch from 3.4
git checkout -b feat_deep_green_colormap

Have a look at these introduction tutorials:


Can you add the visualisation of the colormap both in this pull request and in the documentation?
See this for the code: #15388

Also, do you have a reference on this colormap? Something like an equivalent in Matplotlib, gnuplot, or Matlab for instance?

If this is a custom colormap, I would advice if it is possible to use an existing colormap. See for instance the colormap in Matplotlib.

colormap == COLORMAP_TWILIGHT ? (colormap::ColorMap*)(new colormap::Twilight) :
colormap == COLORMAP_TWILIGHT_SHIFTED ? (colormap::ColorMap*)(new colormap::TwilightShifted) :
colormap == COLORMAP_VIRIDIS ? (colormap::ColorMap*)(new colormap::Viridis) :
colormap == COLORMAP_DEEPGREEN ? (colormap::ColorMap*)(new colormap::DeepGreen) :
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.

Minor.
Can you keep it sorted alphabetically?

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.

you are right,I have changed my code.

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.

#15388 is great!many thanks!@catree

COLORMAP_TWILIGHT_SHIFTED = 19, //!< ![twilight shifted](pics/colormaps/colorscale_twilight_shifted.jpg)
COLORMAP_TURBO = 20 //!< ![turbo](pics/colormaps/colorscale_turbo.jpg)
COLORMAP_TURBO = 20, //!< ![turbo](pics/colormaps/colorscale_turbo.jpg)
COLORMAP_DEEPGREEN = 21
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.

Visualisation is missing.

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.

Visualisation is added.

@jsxyhelu jsxyhelu closed this May 11, 2020
@jsxyhelu jsxyhelu reopened this May 11, 2020
@jsxyhelu jsxyhelu closed this May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants