android - OpenCV4Android Kalman filter Assertion Failed at matmul -


i have problem opencv4android. i'm using it's newest version 2.4.10 although seems, issue occurs in 2.4.9. whenever i'm trying implement 2d kalman filter jni on android, code failing, because of errors (then method throws me sigabrt , there nothing can do):

opencv error: assertion failed (type == b.type() && (type == cv_32fc1 || type == cv_64fc1 || type == cv_32fc2 || type == cv_64fc2)) in void cv::gemm(cv::inputarray, cv::inputarray, double, cv::inputarray, double, cv::outputarray, int), file /hdd2/buildbot/slaves/slave_ardbeg1/50-sdk/opencv/modules/core/src/matmul.cpp, line 711 

it seems, kalmanfilter.predict() method throws it.

i tried 2 other implementations- 1 taken directly internet, second different.

i remember, (in order use properly) must first predict point, correct filter, isn't issue. assumption that, there weird @ junction of weird android world , c++ (maybe float values aren't 32bit floats in android's jni? i'm unable tell..)

here code:

class kalman{ private:     kalmanfilter kalmanfilter;     mat_<float> measurement;     bool inited; public:     void init(float startx, float starty){         inited = true;         kalmanfilter = kalmanfilter(4, 2, 0);         float tmparr[4][4] = {{1,0,1,0}, {0,1,0,1}, {0,0,1,0}, {0,0,0,1}};         kalmanfilter.transitionmatrix = mat(4,4,cv_32fc1, &tmparr);         measurement = mat(2,1,cv_32fc1);         measurement.setto(scalar(0));         kalmanfilter.statepre.at<float>(0) = startx;         kalmanfilter.statepre.at<float>(1) = starty;         kalmanfilter.statepre.at<float>(2) = 0;         kalmanfilter.statepre.at<float>(3) = 0;         setidentity(kalmanfilter.measurementmatrix);         setidentity(kalmanfilter.processnoisecov, scalar::all(1e-4));         setidentity(kalmanfilter.measurementnoisecov, scalar::all(10));         setidentity(kalmanfilter.errorcovpost, scalar::all(.1));     }     kalman(){}     kalman(float startx, float starty){         this->init(startx, starty);     }     geometry::point newprediction(){         geometry::point res;         if(inited){             log::d("kalman", "newprediction pre!");             mat prediction = kalmanfilter.predict();             log::d("kalman", "newprediction post!");             res.x = prediction.at<float>(0);             res.y = prediction.at<float>(1);         }         return res;     }     void correction(float x, float y){         measurement(0) = x;         measurement(1) = y;         log::d("kalman", "correction pre!");         kalmanfilter.correct(measurement);         log::d("kalman", "correction post!");     }  }; 

community, please me!


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -