Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e0136e39
Commit
e0136e39
authored
May 16, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4011 from cr333:parula
parents
78e89ba3
6425ac3b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
colorscale_parula.jpg
modules/imgproc/doc/pics/colormaps/colorscale_parula.jpg
+0
-0
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+2
-1
colormap.cpp
modules/imgproc/src/colormap.cpp
+25
-0
No files found.
modules/imgproc/doc/pics/colormaps/colorscale_parula.jpg
0 → 100644
View file @
e0136e39
1.4 KB
modules/imgproc/include/opencv2/imgproc.hpp
View file @
e0136e39
...
...
@@ -3741,7 +3741,8 @@ enum ColormapTypes
COLORMAP_COOL
=
8
,
//!< ![cool](pics/colormaps/colorscale_cool.jpg)
COLORMAP_HSV
=
9
,
//!< ![HSV](pics/colormaps/colorscale_hsv.jpg)
COLORMAP_PINK
=
10
,
//!< ![pink](pics/colormaps/colorscale_pink.jpg)
COLORMAP_HOT
=
11
//!< ![hot](pics/colormaps/colorscale_hot.jpg)
COLORMAP_HOT
=
11
,
//!< ![hot](pics/colormaps/colorscale_hot.jpg)
COLORMAP_PARULA
=
12
//!< ![hot](pics/colormaps/colorscale_parula.jpg)
};
/** @brief Applies a GNU Octave/MATLAB equivalent colormap on a given image.
...
...
modules/imgproc/src/colormap.cpp
View file @
e0136e39
...
...
@@ -469,6 +469,30 @@ namespace colormap
}
};
// Colormap similar to MATLAB's "parula".
class
Parula
:
public
ColorMap
{
public
:
Parula
()
:
ColorMap
()
{
init
(
256
);
}
Parula
(
int
n
)
:
ColorMap
()
{
init
(
n
);
}
void
init
(
int
n
)
{
float
r
[]
=
{
0.2078
,
0.0118
,
0.0784
,
0.0235
,
0.2196
,
0.5725
,
0.8510
,
0.9882
,
0.9765
};
float
g
[]
=
{
0.1647
,
0.3882
,
0.5216
,
0.6549
,
0.7255
,
0.7490
,
0.7294
,
0.8078
,
0.9843
};
float
b
[]
=
{
0.5294
,
0.8824
,
0.8314
,
0.7765
,
0.6196
,
0.4510
,
0.3373
,
0.1804
,
0.0549
};
Mat
X
=
linspace
(
0
,
1
,
9
);
this
->
_lut
=
ColorMap
::
linear_colormap
(
X
,
Mat
(
9
,
1
,
CV_32FC1
,
r
).
clone
(),
// red
Mat
(
9
,
1
,
CV_32FC1
,
g
).
clone
(),
// green
Mat
(
9
,
1
,
CV_32FC1
,
b
).
clone
(),
// blue
n
);
// number of sample points
}
};
void
ColorMap
::
operator
()(
InputArray
_src
,
OutputArray
_dst
)
const
{
if
(
_lut
.
total
()
!=
256
)
...
...
@@ -513,6 +537,7 @@ namespace colormap
colormap
==
COLORMAP_HSV
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
HSV
)
:
colormap
==
COLORMAP_JET
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
Jet
)
:
colormap
==
COLORMAP_OCEAN
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
Ocean
)
:
colormap
==
COLORMAP_PARULA
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
Parula
)
:
colormap
==
COLORMAP_PINK
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
Pink
)
:
colormap
==
COLORMAP_RAINBOW
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
Rainbow
)
:
colormap
==
COLORMAP_SPRING
?
(
colormap
::
ColorMap
*
)(
new
colormap
::
Spring
)
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment