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
6042c594
Commit
6042c594
authored
Jul 01, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #1764
parent
31395b07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
descriptors.cpp
modules/features2d/src/descriptors.cpp
+14
-20
No files found.
modules/features2d/src/descriptors.cpp
View file @
6042c594
...
...
@@ -134,49 +134,43 @@ static void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat
// Calculate the channels of the opponent color space
{
// (R - G)
/ sqrt(2)
// (R - G)
/sqrt(2), but converted to the destination data type
MatConstIterator_
<
signed
char
>
rIt
=
bgrChannels
[
2
].
begin
<
signed
char
>
();
MatConstIterator_
<
signed
char
>
gIt
=
bgrChannels
[
1
].
begin
<
signed
char
>
();
MatIterator_
<
unsigned
char
>
dstIt
=
opponentChannels
[
0
].
begin
<
unsigned
char
>
();
float
factor
=
1.
f
/
sqrt
(
2.
f
);
for
(
;
dstIt
!=
opponentChannels
[
0
].
end
<
unsigned
char
>
();
++
rIt
,
++
gIt
,
++
dstIt
)
{
int
value
=
static_cast
<
int
>
(
static_cast
<
float
>
(
static_cast
<
int
>
(
*
gIt
)
-
static_cast
<
int
>
(
*
rIt
))
*
factor
);
if
(
value
<
0
)
value
=
0
;
if
(
value
>
255
)
value
=
255
;
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
);
float
value
=
0.5
f
*
(
static_cast
<
int
>
(
*
gIt
)
-
static_cast
<
int
>
(
*
rIt
)
+
255
);
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
+
0.5
f
);
}
}
{
// (R + G - 2B)/sqrt(6)
// (R + G - 2B)/sqrt(6)
, but converted to the destination data type
MatConstIterator_
<
signed
char
>
rIt
=
bgrChannels
[
2
].
begin
<
signed
char
>
();
MatConstIterator_
<
signed
char
>
gIt
=
bgrChannels
[
1
].
begin
<
signed
char
>
();
MatConstIterator_
<
signed
char
>
bIt
=
bgrChannels
[
0
].
begin
<
signed
char
>
();
MatIterator_
<
unsigned
char
>
dstIt
=
opponentChannels
[
1
].
begin
<
unsigned
char
>
();
float
factor
=
1.
f
/
sqrt
(
6.
f
);
for
(
;
dstIt
!=
opponentChannels
[
1
].
end
<
unsigned
char
>
();
++
rIt
,
++
gIt
,
++
bIt
,
++
dstIt
)
{
int
value
=
static_cast
<
int
>
(
static_cast
<
float
>
(
static_cast
<
int
>
(
*
rIt
)
+
static_cast
<
int
>
(
*
gIt
)
-
2
*
static_cast
<
int
>
(
*
bIt
))
*
factor
);
if
(
value
<
0
)
value
=
0
;
if
(
value
>
255
)
value
=
255
;
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
);
float
value
=
0.25
f
*
(
static_cast
<
int
>
(
*
rIt
)
+
static_cast
<
int
>
(
*
gIt
)
-
2
*
static_cast
<
int
>
(
*
bIt
)
+
510
);
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
+
0.5
f
);
}
}
{
// (R + G + B)/sqrt(3)
// (R + G + B)/sqrt(3)
, but converted to the destination data type
MatConstIterator_
<
signed
char
>
rIt
=
bgrChannels
[
2
].
begin
<
signed
char
>
();
MatConstIterator_
<
signed
char
>
gIt
=
bgrChannels
[
1
].
begin
<
signed
char
>
();
MatConstIterator_
<
signed
char
>
bIt
=
bgrChannels
[
0
].
begin
<
signed
char
>
();
MatIterator_
<
unsigned
char
>
dstIt
=
opponentChannels
[
2
].
begin
<
unsigned
char
>
();
float
factor
=
1.
f
/
sqrt
(
3.
f
)
;
float
factor
=
1.
f
/
3.
f
;
for
(
;
dstIt
!=
opponentChannels
[
2
].
end
<
unsigned
char
>
();
++
rIt
,
++
gIt
,
++
bIt
,
++
dstIt
)
{
int
value
=
static_cast
<
int
>
(
static_cast
<
float
>
(
static_cast
<
int
>
(
*
rIt
)
+
static_cast
<
int
>
(
*
gIt
)
+
static_cast
<
int
>
(
*
bIt
))
*
factor
);
if
(
value
<
0
)
value
=
0
;
if
(
value
>
255
)
value
=
255
;
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
);
float
value
=
factor
*
(
static_cast
<
int
>
(
*
rIt
)
+
static_cast
<
int
>
(
*
gIt
)
+
static_cast
<
int
>
(
*
bIt
));
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
+
0.5
f
);
}
}
}
...
...
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