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
38488cfd
Commit
38488cfd
authored
Apr 11, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
probably fixed linemod crash (thanks to Stefan for the report)
parent
04d24a88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
linemod.cpp
modules/objdetect/src/linemod.cpp
+12
-12
No files found.
modules/objdetect/src/linemod.cpp
View file @
38488cfd
...
...
@@ -272,12 +272,12 @@ void quantizedOrientations(const Mat& src, Mat& magnitude,
// Allocate temporary buffers
Size
size
=
src
.
size
();
Mat
_
<
Vec3s
>
sobel_3dx
(
size
)
;
// per-channel horizontal derivative
Mat
_
<
Vec3s
>
sobel_3dy
(
size
)
;
// per-channel vertical derivative
Mat
_
<
float
>
sobel_dx
(
size
);
// maximum horizontal derivative
Mat
_
<
float
>
sobel_dy
(
size
);
// maximum vertical derivative
Mat
_
<
float
>
sobel_ag
(
size
);
// final gradient orientation (unquantized)
Mat
_
<
Vec3b
>
smoothed
(
size
)
;
Mat
sobel_3dx
;
// per-channel horizontal derivative
Mat
sobel_3dy
;
// per-channel vertical derivative
Mat
sobel_dx
(
size
,
CV_32F
);
// maximum horizontal derivative
Mat
sobel_dy
(
size
,
CV_32F
);
// maximum vertical derivative
Mat
sobel_ag
;
// final gradient orientation (unquantized)
Mat
smoothed
;
// Compute horizontal and vertical image derivatives on all color channels separately
static
const
int
KERNEL_SIZE
=
7
;
...
...
@@ -306,27 +306,27 @@ void quantizedOrientations(const Mat& src, Mat& magnitude,
for
(
int
i
=
0
;
i
<
length0
;
i
+=
3
)
{
// Use the gradient orientation of the channel whose magnitude is largest
unsigned
short
mag1
=
CV_SQR
((
unsigned
short
)
ptrx
[
i
])
+
CV_SQR
((
unsigned
short
)
ptry
[
i
]);
unsigned
short
mag2
=
CV_SQR
((
unsigned
short
)
ptrx
[
i
+
1
])
+
CV_SQR
((
unsigned
short
)
ptry
[
i
+
1
]);
unsigned
short
mag3
=
CV_SQR
((
unsigned
short
)
ptrx
[
i
+
2
])
+
CV_SQR
((
unsigned
short
)
ptry
[
i
+
2
]);
int
mag1
=
CV_SQR
(
ptrx
[
i
])
+
CV_SQR
(
ptry
[
i
]);
int
mag2
=
CV_SQR
(
ptrx
[
i
+
1
])
+
CV_SQR
(
ptry
[
i
+
1
]);
int
mag3
=
CV_SQR
(
ptrx
[
i
+
2
])
+
CV_SQR
(
ptry
[
i
+
2
]);
if
(
mag1
>=
mag2
&&
mag1
>=
mag3
)
{
ptr0x
[
ind
]
=
ptrx
[
i
];
ptr0y
[
ind
]
=
ptry
[
i
];
ptrmg
[
ind
]
=
mag1
;
ptrmg
[
ind
]
=
(
float
)
mag1
;
}
else
if
(
mag2
>=
mag1
&&
mag2
>=
mag3
)
{
ptr0x
[
ind
]
=
ptrx
[
i
+
1
];
ptr0y
[
ind
]
=
ptry
[
i
+
1
];
ptrmg
[
ind
]
=
mag2
;
ptrmg
[
ind
]
=
(
float
)
mag2
;
}
else
{
ptr0x
[
ind
]
=
ptrx
[
i
+
2
];
ptr0y
[
ind
]
=
ptry
[
i
+
2
];
ptrmg
[
ind
]
=
mag3
;
ptrmg
[
ind
]
=
(
float
)
mag3
;
}
++
ind
;
}
...
...
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