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
d3866674
Commit
d3866674
authored
Jul 03, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged the trunk r8927, r8929
parent
a0ce328f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
54 deletions
+44
-54
descriptors.cpp
modules/features2d/src/descriptors.cpp
+10
-43
imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+34
-11
No files found.
modules/features2d/src/descriptors.cpp
View file @
d3866674
...
...
@@ -122,57 +122,24 @@ static void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat
if
(
bgrImage
.
type
()
!=
CV_8UC3
)
CV_Error
(
CV_StsBadArg
,
"input image must be an BGR image of type CV_8UC3"
);
// Split image into RGB to allow conversion to Opponent Color Space.
vector
<
Mat
>
bgrChannels
(
3
);
split
(
bgrImage
,
bgrChannels
);
// Prepare opponent color space storage matrices.
opponentChannels
.
resize
(
3
);
opponentChannels
[
0
]
=
cv
::
Mat
(
bgrImage
.
size
(),
CV_8UC1
);
// R-G RED-GREEN
opponentChannels
[
1
]
=
cv
::
Mat
(
bgrImage
.
size
(),
CV_8UC1
);
// R+G-2B YELLOW-BLUE
opponentChannels
[
2
]
=
cv
::
Mat
(
bgrImage
.
size
(),
CV_8UC1
);
// R+G+B
// Calculate the channels of the opponent color space
{
// (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
>
();
for
(
;
dstIt
!=
opponentChannels
[
0
].
end
<
unsigned
char
>
();
++
rIt
,
++
gIt
,
++
dstIt
)
{
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), 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
>
();
for
(
;
dstIt
!=
opponentChannels
[
1
].
end
<
unsigned
char
>
();
++
rIt
,
++
gIt
,
++
bIt
,
++
dstIt
)
for
(
int
y
=
0
;
y
<
bgrImage
.
rows
;
++
y
)
for
(
int
x
=
0
;
x
<
bgrImage
.
cols
;
++
x
)
{
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
);
Vec3b
v
=
bgrImage
.
at
<
Vec3b
>
(
y
,
x
);
uchar
&
b
=
v
[
0
];
uchar
&
g
=
v
[
1
];
uchar
&
r
=
v
[
2
];
opponentChannels
[
0
].
at
<
uchar
>
(
y
,
x
)
=
saturate_cast
<
uchar
>
(
0.5
f
*
(
255
+
g
-
r
));
// (R - G)/sqrt(2), but converted to the destination data type
opponentChannels
[
1
].
at
<
uchar
>
(
y
,
x
)
=
saturate_cast
<
uchar
>
(
0.25
f
*
(
510
+
r
+
g
-
2
*
b
));
// (R + G - 2B)/sqrt(6), but converted to the destination data type
opponentChannels
[
2
].
at
<
uchar
>
(
y
,
x
)
=
saturate_cast
<
uchar
>
(
1.
f
/
3.
f
*
(
r
+
g
+
b
));
// (R + G + B)/sqrt(3), but converted to the destination data type
}
}
{
// (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
/
3.
f
;
for
(
;
dstIt
!=
opponentChannels
[
2
].
end
<
unsigned
char
>
();
++
rIt
,
++
gIt
,
++
bIt
,
++
dstIt
)
{
float
value
=
factor
*
(
static_cast
<
int
>
(
*
rIt
)
+
static_cast
<
int
>
(
*
gIt
)
+
static_cast
<
int
>
(
*
bIt
));
(
*
dstIt
)
=
static_cast
<
unsigned
char
>
(
value
+
0.5
f
);
}
}
}
struct
KP_LessThan
...
...
modules/imgproc/src/imgwarp.cpp
View file @
d3866674
...
...
@@ -782,19 +782,8 @@ struct VResizeCubicVec_32f
}
};
typedef
HResizeNoVec
HResizeLinearVec_8u32s
;
typedef
HResizeNoVec
HResizeLinearVec_16u32f
;
typedef
HResizeNoVec
HResizeLinearVec_16s32f
;
typedef
HResizeNoVec
HResizeLinearVec_32f
;
typedef
HResizeNoVec
HResizeLinearVec_64f
;
#else
typedef
HResizeNoVec
HResizeLinearVec_8u32s
;
typedef
HResizeNoVec
HResizeLinearVec_16u32f
;
typedef
HResizeNoVec
HResizeLinearVec_16s32f
;
typedef
HResizeNoVec
HResizeLinearVec_32f
;
typedef
VResizeNoVec
VResizeLinearVec_32s8u
;
typedef
VResizeNoVec
VResizeLinearVec_32f16u
;
typedef
VResizeNoVec
VResizeLinearVec_32f16s
;
...
...
@@ -807,6 +796,12 @@ typedef VResizeNoVec VResizeCubicVec_32f;
#endif
typedef
HResizeNoVec
HResizeLinearVec_8u32s
;
typedef
HResizeNoVec
HResizeLinearVec_16u32f
;
typedef
HResizeNoVec
HResizeLinearVec_16s32f
;
typedef
HResizeNoVec
HResizeLinearVec_32f
;
typedef
HResizeNoVec
HResizeLinearVec_64f
;
template
<
typename
T
,
typename
WT
,
typename
AT
,
int
ONE
,
class
VecOp
>
struct
HResizeLinear
...
...
@@ -894,6 +889,34 @@ struct VResizeLinear
}
};
template
<>
struct
VResizeLinear
<
uchar
,
int
,
short
,
FixedPtCast
<
int
,
uchar
,
INTER_RESIZE_COEF_BITS
*
2
>
,
VResizeLinearVec_32s8u
>
{
typedef
uchar
value_type
;
typedef
int
buf_type
;
typedef
short
alpha_type
;
void
operator
()(
const
buf_type
**
src
,
value_type
*
dst
,
const
alpha_type
*
beta
,
int
width
)
const
{
alpha_type
b0
=
beta
[
0
],
b1
=
beta
[
1
];
const
buf_type
*
S0
=
src
[
0
],
*
S1
=
src
[
1
];
VResizeLinearVec_32s8u
vecOp
;
int
x
=
vecOp
((
const
uchar
**
)
src
,
(
uchar
*
)
dst
,
(
const
uchar
*
)
beta
,
width
);
#if CV_ENABLE_UNROLLED
for
(
;
x
<=
width
-
4
;
x
+=
4
)
{
dst
[
x
+
0
]
=
uchar
((
((
b0
*
(
S0
[
x
+
0
]
>>
4
))
>>
16
)
+
((
b1
*
(
S1
[
x
+
0
]
>>
4
))
>>
16
)
+
2
)
>>
2
);
dst
[
x
+
1
]
=
uchar
((
((
b0
*
(
S0
[
x
+
1
]
>>
4
))
>>
16
)
+
((
b1
*
(
S1
[
x
+
1
]
>>
4
))
>>
16
)
+
2
)
>>
2
);
dst
[
x
+
2
]
=
uchar
((
((
b0
*
(
S0
[
x
+
2
]
>>
4
))
>>
16
)
+
((
b1
*
(
S1
[
x
+
2
]
>>
4
))
>>
16
)
+
2
)
>>
2
);
dst
[
x
+
3
]
=
uchar
((
((
b0
*
(
S0
[
x
+
3
]
>>
4
))
>>
16
)
+
((
b1
*
(
S1
[
x
+
3
]
>>
4
))
>>
16
)
+
2
)
>>
2
);
}
#endif
for
(
;
x
<
width
;
x
++
)
dst
[
x
]
=
uchar
((
((
b0
*
(
S0
[
x
]
>>
4
))
>>
16
)
+
((
b1
*
(
S1
[
x
]
>>
4
))
>>
16
)
+
2
)
>>
2
);
}
};
template
<
typename
T
,
typename
WT
,
typename
AT
>
struct
HResizeCubic
...
...
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