Ask Your Question
0

Opencv4Android KCFTracker grayscale

asked 2018-02-19 23:07:12 -0600

changsheng1239 gravatar image

Hello guys, right now I am facing a problem where grayscale image will causes assertion error in KCFTracker. The problem is probably caused by KCFTracker default params is CN where my image is GRAY. In C++ I can create a KCFTracker object with KCFTracker::Params but I am unable to find a way to set this params in Opencv4Android.

OpenCV Error: Assertion failed (img.channels() == 3) in bool cv::TrackerKCFImpl::getSubWindow(cv::Mat, cv::Rect, cv::Mat&, cv::Mat&, cv::TrackerKCF::MODE)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-02-20 04:26:04 -0600

berak gravatar image

yes, KCF is using ColorNames features (that's the CN flag) by default, which needs color images. and no, no way to set the params from java.

please update your opencv libs to latest master, to have it fixed

edit flag offensive delete link more

Comments

Thanks for your very helpful reply! Seems like my libs(v331) is too outdated. However, when I tried to compile the latest opencv with the contrib modules, it compiled successfully but install/sdk/java is missing. I did try to compile the v331 again and it compiles successfully without problem. I didn't change any steps between compiling these 2 versions.

changsheng1239 gravatar imagechangsheng1239 ( 2018-02-22 06:26:39 -0600 )edit

"but install/sdk/java is missing" -- check again, if cmake finds the ant tool. see if java shows up in the "to be built" section of the cmake output.

if you can't get it done, please ask a new question, and add the cmake output.

berak gravatar imageberak ( 2018-02-22 06:45:50 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-02-19 23:07:12 -0600

Seen: 788 times

Last updated: Feb 20 '18