Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
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
Container 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
David Youssefi
otb
Commits
656e0087
Commit
656e0087
authored
16 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
ENH : invalid cast correction in entropy
parent
038791b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/FeatureExtraction/otbEntropyTextureFunctor.h
+32
-32
32 additions, 32 deletions
Code/FeatureExtraction/otbEntropyTextureFunctor.h
with
32 additions
and
32 deletions
Code/FeatureExtraction/otbEntropyTextureFunctor.h
+
32
−
32
View file @
656e0087
...
...
@@ -54,7 +54,7 @@ public:
typedef
typename
OutputType
::
ValueType
OutputPixelType
;
typedef
std
::
vector
<
double
>
DoubleVectorType
;
typedef
std
::
vector
<
int
>
IntVectorType
;
typedef
std
::
vector
<
IntVectorType
>
IntVectorVectorType
;
typedef
std
::
vector
<
IntVectorType
>
IntVectorVectorType
;
void
SetOffset
(
OffsetType
off
)
{
...
...
@@ -88,8 +88,8 @@ public:
offsetOffInit
[
0
]
=
-
radius
[
0
]
+
m_Offset
[
0
]
-
1
;
offsetOffInit
[
1
]
=
-
radius
[
1
]
+
m_Offset
[
1
]
-
1
;
Int
VectorType
mean
;
Int
VectorType
meanOff
;
Double
VectorType
mean
;
Double
VectorType
meanOff
;
for
(
unsigned
int
i
=
0
;
i
<
nbComp
;
i
++
)
{
offsetOff
=
offsetOffInit
;
...
...
@@ -191,36 +191,36 @@ public:
offsetOff
=
offsetOffInit
;
for
(
int
l
=
-
static_cast
<
int
>
(
radius
[
0
]);
l
<=
static_cast
<
int
>
(
radius
[
0
]);
l
++
)
{
offsetOff
[
0
]
++
;
offsetOff
[
1
]
=
offsetOffInit
[
1
];
offset
[
0
]
=
l
;
for
(
int
k
=
-
static_cast
<
int
>
(
radius
[
1
]);
k
<=
static_cast
<
int
>
(
radius
[
1
]);
k
++
)
{
offsetOff
[
1
]
++
;
offset
[
1
]
=
k
;
if
(
binsLength
[
1
][
i
]
!=
0
)
histoIdX
=
static_cast
<
int
>
(
vcl_floor
(
(
itOff
.
GetPixel
(
offsetOff
)[
i
]
-
m_MiniOff
[
i
])
/
binsLength
[
1
][
i
]
));
else
histoIdX
=
0
;
if
(
binsLength
[
0
][
i
]
!=
0
)
histoIdY
=
static_cast
<
int
>
(
vcl_floor
(
(
it
.
GetPixel
(
offset
)[
i
]
-
m_Mini
[
i
])
/
binsLength
[
0
][
i
]
));
else
histoIdY
=
0
;
histo
[
histoIdX
][
histoIdY
]
++
;
}
}
{
offsetOff
[
0
]
++
;
offsetOff
[
1
]
=
offsetOffInit
[
1
];
offset
[
0
]
=
l
;
for
(
int
k
=
-
static_cast
<
int
>
(
radius
[
1
]);
k
<=
static_cast
<
int
>
(
radius
[
1
]);
k
++
)
{
offsetOff
[
1
]
++
;
offset
[
1
]
=
k
;
if
(
binsLength
[
1
][
i
]
!=
0
)
histoIdX
=
static_cast
<
int
>
(
vcl_floor
(
(
itOff
.
GetPixel
(
offsetOff
)[
i
]
-
m_MiniOff
[
i
])
/
binsLength
[
1
][
i
]
));
else
histoIdX
=
0
;
if
(
binsLength
[
0
][
i
]
!=
0
)
histoIdY
=
static_cast
<
int
>
(
vcl_floor
(
(
it
.
GetPixel
(
offset
)[
i
]
-
m_Mini
[
i
])
/
binsLength
[
0
][
i
]
));
else
histoIdY
=
0
;
histo
[
histoIdX
][
histoIdY
]
++
;
}
}
for
(
unsigned
r
=
0
;
r
<
binsLength
.
size
();
r
++
)
{
for
(
unsigned
s
=
0
;
s
<
binsLength
[
r
].
size
();
s
++
)
{
double
p
=
binsLength
[
r
][
s
]
*
areaInv
;
if
(
p
!=
0
)
outPix
[
i
]
+=
static_cast
<
OutputPixelType
>
(
p
*
vcl_log
(
p
));
}
}
{
for
(
unsigned
s
=
0
;
s
<
binsLength
[
r
].
size
();
s
++
)
{
double
p
=
binsLength
[
r
][
s
]
*
areaInv
;
if
(
p
!=
0
)
outPix
[
i
]
+=
static_cast
<
OutputPixelType
>
(
p
*
vcl_log
(
p
));
}
}
}
return
outPix
;
...
...
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