Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ImageINSA_Tanguy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tanguy.Raufflet
ImageINSA_Tanguy
Commits
936c1f4f
Commit
936c1f4f
authored
6 years ago
by
ariotte
Browse files
Options
Downloads
Patches
Plain Diff
prepared algorithm for custom pseudo color
parent
a94aa2cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Operations/PseudoColorOp.cpp
+17
-6
17 additions, 6 deletions
app/Operations/PseudoColorOp.cpp
with
17 additions
and
6 deletions
app/Operations/PseudoColorOp.cpp
+
17
−
6
View file @
936c1f4f
...
...
@@ -33,16 +33,27 @@ bool PseudoColorOp::needCurrentImg() const {
return
true
;
}
static
int
getLinearHue
(
int
value
,
int
nhue
){
return
floor
(
value
*
nhue
/
255
);
}
void
PseudoColorOp
::
operator
()(
const
imagein
::
Image
*
image
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
)
{
GrayscaleImage
*
tmpImg
=
Converter
<
GrayscaleImage
>::
convert
(
*
image
);
Image
*
resImg
=
new
Image
(
tmpImg
->
getWidth
(),
tmpImg
->
getHeight
(),
3
);
GrayscaleImage
*
tmpImg
=
Converter
<
GrayscaleImage
>::
convert
(
*
image
);
Image
*
resImg
=
new
Image
(
tmpImg
->
getWidth
(),
tmpImg
->
getHeight
(),
3
);
int
nhue
=
255
;
// changer cette valeur en fonction de la fenêtre de dialog
int
(
*
getHue
)(
int
a
,
int
b
);
getHue
=
getLinearHue
;
for
(
unsigned
int
j
=
0
;
j
<
tmpImg
->
getHeight
();
++
j
)
{
for
(
unsigned
int
i
=
0
;
i
<
tmpImg
->
getWidth
();
++
i
)
{
Image
::
depth_t
value
=
tmpImg
->
getPixel
(
i
,
j
);
const
int
nhue
=
256
;
const
int
ngrad
=
ceil
(
25
6
.
/
(
double
)
nhue
);
const
int
hue
=
floor
(
value
*
nhue
/
256
);
/* € [0, nhue[ */
const
int
grad
=
value
-
ceil
((
double
)
hue
*
25
6.
/
(
double
)
nhue
);
/* € [0, ngrad[ */
const
int
ngrad
=
ceil
(
25
5
.
/
(
double
)
nhue
);
const
int
hue
=
getHue
(
value
,
nhue
);
/* € [0, nhue[ */
const
int
grad
=
value
-
ceil
((
double
)
hue
*
25
5
/
(
double
)
nhue
);
/* € [0, ngrad[ */
QColor
color
=
QColor
::
fromHsl
(
300
-
hue
*
300
/
nhue
,
255
,
(
grad
+
1
)
*
255
/
(
ngrad
+
1
));
resImg
->
setPixel
(
i
,
j
,
0
,
color
.
red
());
resImg
->
setPixel
(
i
,
j
,
1
,
color
.
green
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment