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
51987361
Commit
51987361
authored
6 years ago
by
ariotte
Browse files
Options
Downloads
Patches
Plain Diff
fixed crash when launching LloydMax quantization
parent
a2f25e74
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Operations/Quantification.cpp
+16
-2
16 additions, 2 deletions
app/Operations/Quantification.cpp
app/Operations/Quantification.h
+1
-8
1 addition, 8 deletions
app/Operations/Quantification.h
with
17 additions
and
10 deletions
app/Operations/Quantification.cpp
+
16
−
2
View file @
51987361
...
...
@@ -70,6 +70,20 @@ void Quantification::saveAs(std::string filename) {
}
}
int
Quantification
::
valueOf
(
int
value
)
const
{
for
(
int
i
=
0
;
i
<
nbThresholds
();
++
i
)
{
if
(
value
<
_threshold
[
i
])
{
return
_values
[
i
];
}
}
return
_values
[
nbThresholds
()];
}
Quantification
Quantification
::
linearQuant
(
int
size
)
{
Quantification
quant
(
size
);
...
...
@@ -210,13 +224,13 @@ Quantification Quantification::lloydMaxQuant(int size, const Image* image, unsig
//calcul pdf
for
(
int
j
=
0
;
j
<
size
-
1
;
j
++
){
for
(
int
j
=
0
;
j
<
size
-
2
;
j
++
){
for
(
int
i
=
((
quant
.
_threshold
)[
j
]);
i
<=
((
quant
.
_threshold
)[
j
+
1
]);
i
++
){
som_lum
+=
histogram
[
i
]
*
i
;
nb_points
+=
histogram
[
i
];
}
quant
.
_values
[
j
]
=
(
int
)
quant
.
_values
[
j
]
*
(
som_lum
/
nb_points
)
/
(
som_lum
/
nb_points
);
quant
.
_values
[
j
]
=
(
int
)
quant
.
_values
[
j
]
*
(
som_lum
/
nb_points
)
/
(
som_lum
/
nb_points
);
}
//for (parcours du tableau de valeurs)
cpt
--
;
...
...
This diff is collapsed.
Click to expand it.
app/Operations/Quantification.h
+
1
−
8
View file @
51987361
...
...
@@ -31,14 +31,7 @@ public:
void
saveAs
(
std
::
string
filename
);
inline
int
valueOf
(
int
value
)
const
{
for
(
int
i
=
0
;
i
<
nbThresholds
();
++
i
)
{
if
(
value
<
_threshold
[
i
])
{
return
_values
[
i
];
}
}
return
_values
[
nbThresholds
()];
}
int
valueOf
(
int
value
)
const
;
inline
int
nbValues
()
const
{
return
size
;}
...
...
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