Skip to content

Commit

Permalink
AKAZE: check channels instead of type in detectAndCompute
Browse files Browse the repository at this point in the history
add same CV_32F and CV_16U support for KAZE
  • Loading branch information
berak committed Nov 12, 2015
1 parent 979f88f commit 0baf0bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/features2d/src/akaze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ namespace cv
bool useProvidedKeypoints)
{
Mat img = image.getMat();
if (img.type() != CV_8UC1)
if (img.channels() > 1)
cvtColor(image, img, COLOR_BGR2GRAY);

Mat img1_32;
Expand Down
11 changes: 9 additions & 2 deletions modules/features2d/src/kaze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,18 @@ namespace cv
bool useProvidedKeypoints)
{
cv::Mat img = image.getMat();
if (img.type() != CV_8UC1)
if (img.channels() > 1)
cvtColor(image, img, COLOR_BGR2GRAY);

Mat img1_32;
img.convertTo(img1_32, CV_32F, 1.0 / 255.0, 0);
if ( img.depth() == CV_32F )
img1_32 = img;
else if ( img.depth() == CV_8U )
img.convertTo(img1_32, CV_32F, 1.0 / 255.0, 0);
else if ( img.depth() == CV_16U )
img.convertTo(img1_32, CV_32F, 1.0 / 65535.0, 0);

CV_Assert( ! img1_32.empty() );

KAZEOptions options;
options.img_width = img.cols;
Expand Down

0 comments on commit 0baf0bd

Please sign in to comment.