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
18fc11bc
Commit
18fc11bc
authored
Aug 21, 2012
by
Corentin Wallez
Committed by
Vadim Pisarevsky
Aug 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fixed-point arithmetics in FREAK::meanIntensity
parent
dc6fa941
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
freak.cpp
modules/features2d/src/freak.cpp
+5
-2
No files found.
modules/features2d/src/freak.cpp
View file @
18fc11bc
...
@@ -455,7 +455,6 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
...
@@ -455,7 +455,6 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
const
float
radius
=
FreakPoint
.
sigma
;
const
float
radius
=
FreakPoint
.
sigma
;
// calculate output:
// calculate output:
int
ret_val
;
if
(
radius
<
0.5
)
{
if
(
radius
<
0.5
)
{
// interpolation multipliers:
// interpolation multipliers:
const
int
r_x
=
static_cast
<
int
>
((
xf
-
x
)
*
1024
);
const
int
r_x
=
static_cast
<
int
>
((
xf
-
x
)
*
1024
);
...
@@ -463,6 +462,7 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
...
@@ -463,6 +462,7 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
const
int
r_x_1
=
(
1024
-
r_x
);
const
int
r_x_1
=
(
1024
-
r_x
);
const
int
r_y_1
=
(
1024
-
r_y
);
const
int
r_y_1
=
(
1024
-
r_y
);
uchar
*
ptr
=
image
.
data
+
x
+
y
*
imagecols
;
uchar
*
ptr
=
image
.
data
+
x
+
y
*
imagecols
;
unsigned
int
ret_val
;
// linear interpolation:
// linear interpolation:
ret_val
=
(
r_x_1
*
r_y_1
*
int
(
*
ptr
));
ret_val
=
(
r_x_1
*
r_y_1
*
int
(
*
ptr
));
ptr
++
;
ptr
++
;
...
@@ -471,7 +471,9 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
...
@@ -471,7 +471,9 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
ret_val
+=
(
r_x
*
r_y
*
int
(
*
ptr
));
ret_val
+=
(
r_x
*
r_y
*
int
(
*
ptr
));
ptr
--
;
ptr
--
;
ret_val
+=
(
r_x_1
*
r_y
*
int
(
*
ptr
));
ret_val
+=
(
r_x_1
*
r_y
*
int
(
*
ptr
));
return
static_cast
<
uchar
>
((
ret_val
+
512
)
/
1024
);
//return the rounded mean
ret_val
+=
2
*
1024
*
1024
;
return
static_cast
<
uchar
>
(
ret_val
/
(
4
*
1024
*
1024
));
}
}
// expected case:
// expected case:
...
@@ -481,6 +483,7 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
...
@@ -481,6 +483,7 @@ uchar FREAK::meanIntensity( const cv::Mat& image, const cv::Mat& integral,
const
int
y_top
=
int
(
yf
-
radius
+
0.5
);
const
int
y_top
=
int
(
yf
-
radius
+
0.5
);
const
int
x_right
=
int
(
xf
+
radius
+
1.5
);
//integral image is 1px wider
const
int
x_right
=
int
(
xf
+
radius
+
1.5
);
//integral image is 1px wider
const
int
y_bottom
=
int
(
yf
+
radius
+
1.5
);
//integral image is 1px higher
const
int
y_bottom
=
int
(
yf
+
radius
+
1.5
);
//integral image is 1px higher
int
ret_val
;
ret_val
=
integral
.
at
<
int
>
(
y_bottom
,
x_right
);
//bottom right corner
ret_val
=
integral
.
at
<
int
>
(
y_bottom
,
x_right
);
//bottom right corner
ret_val
-=
integral
.
at
<
int
>
(
y_bottom
,
x_left
);
ret_val
-=
integral
.
at
<
int
>
(
y_bottom
,
x_left
);
...
...
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