Skip to content

Commit c22f72e

Browse files
committed
feature2d: fix descriptors allocation for AKAZE and KAZE
fix crash when descriptors are UMat
1 parent 5860b76 commit c22f72e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

modules/features2d/src/akaze.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,10 @@ namespace cv
211211

212212
if( descriptors.needed() )
213213
{
214-
Mat& desc = descriptors.getMatRef();
214+
Mat desc;
215215
impl.Compute_Descriptors(keypoints, desc);
216+
// TODO optimize this copy
217+
desc.copyTo(descriptors);
216218

217219
CV_Assert((!desc.rows || desc.cols == descriptorSize()));
218220
CV_Assert((!desc.rows || (desc.type() == descriptorType())));

modules/features2d/src/kaze.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ namespace cv
151151

152152
if( descriptors.needed() )
153153
{
154-
Mat& desc = descriptors.getMatRef();
154+
Mat desc;
155155
impl.Feature_Description(keypoints, desc);
156+
desc.copyTo(descriptors);
156157

157158
CV_Assert((!desc.rows || desc.cols == descriptorSize()));
158159
CV_Assert((!desc.rows || (desc.type() == descriptorType())));

0 commit comments

Comments
 (0)