mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
removed C API in the following modules: photo, video, imgcodecs, videoio (#13060)
* removed C API in the following modules: photo, video, imgcodecs, videoio * trying to fix various compile errors and warnings on Windows and Linux * continue to fix compile errors and warnings * continue to fix compile errors, warnings, as well as the test failures * trying to resolve compile warnings on Android * Update cap_dc1394_v2.cpp fix warning from the new GCC
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "opencv2/video/tracking_c.h"
|
||||
#include "opencv2/video/tracking.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
@@ -67,54 +67,41 @@ void CV_KalmanTest::run( int )
|
||||
|
||||
const double EPSILON = 1.000;
|
||||
RNG& rng = ts->get_rng();
|
||||
CvKalman* Kalm;
|
||||
int i, j;
|
||||
|
||||
CvMat* Sample = cvCreateMat(Dim,1,CV_32F);
|
||||
CvMat* Temp = cvCreateMat(Dim,1,CV_32F);
|
||||
cv::Mat Sample(Dim,1,CV_32F);
|
||||
cv::Mat Temp(Dim,1,CV_32F);
|
||||
|
||||
Kalm = cvCreateKalman(Dim, Dim);
|
||||
CvMat Dyn = cvMat(Dim,Dim,CV_32F,Kalm->DynamMatr);
|
||||
CvMat Mes = cvMat(Dim,Dim,CV_32F,Kalm->MeasurementMatr);
|
||||
CvMat PNC = cvMat(Dim,Dim,CV_32F,Kalm->PNCovariance);
|
||||
CvMat MNC = cvMat(Dim,Dim,CV_32F,Kalm->MNCovariance);
|
||||
CvMat PriErr = cvMat(Dim,Dim,CV_32F,Kalm->PriorErrorCovariance);
|
||||
CvMat PostErr = cvMat(Dim,Dim,CV_32F,Kalm->PosterErrorCovariance);
|
||||
CvMat PriState = cvMat(Dim,1,CV_32F,Kalm->PriorState);
|
||||
CvMat PostState = cvMat(Dim,1,CV_32F,Kalm->PosterState);
|
||||
cvSetIdentity(&PNC);
|
||||
cvSetIdentity(&PriErr);
|
||||
cvSetIdentity(&PostErr);
|
||||
cvSetZero(&MNC);
|
||||
cvSetZero(&PriState);
|
||||
cvSetZero(&PostState);
|
||||
cvSetIdentity(&Mes);
|
||||
cvSetIdentity(&Dyn);
|
||||
Mat _Sample = cvarrToMat(Sample);
|
||||
cvtest::randUni(rng, _Sample, cvScalarAll(-max_init), cvScalarAll(max_init));
|
||||
cvKalmanCorrect(Kalm, Sample);
|
||||
cv::KalmanFilter Kalm(Dim, Dim);
|
||||
Kalm.transitionMatrix = cv::Mat::eye(Dim, Dim, CV_32F);
|
||||
Kalm.measurementMatrix = cv::Mat::eye(Dim, Dim, CV_32F);
|
||||
Kalm.processNoiseCov = cv::Mat::eye(Dim, Dim, CV_32F);
|
||||
Kalm.errorCovPre = cv::Mat::eye(Dim, Dim, CV_32F);
|
||||
Kalm.errorCovPost = cv::Mat::eye(Dim, Dim, CV_32F);
|
||||
Kalm.measurementNoiseCov = cv::Mat::zeros(Dim, Dim, CV_32F);
|
||||
Kalm.statePre = cv::Mat::zeros(Dim, 1, CV_32F);
|
||||
Kalm.statePost = cv::Mat::zeros(Dim, 1, CV_32F);
|
||||
cvtest::randUni(rng, Sample, Scalar::all(-max_init), Scalar::all(max_init));
|
||||
Kalm.correct(Sample);
|
||||
for(i = 0; i<Steps; i++)
|
||||
{
|
||||
cvKalmanPredict(Kalm);
|
||||
Kalm.predict();
|
||||
const Mat& Dyn = Kalm.transitionMatrix;
|
||||
for(j = 0; j<Dim; j++)
|
||||
{
|
||||
float t = 0;
|
||||
for(int k=0; k<Dim; k++)
|
||||
{
|
||||
t += Dyn.data.fl[j*Dim+k]*Sample->data.fl[k];
|
||||
t += Dyn.at<float>(j,k)*Sample.at<float>(k);
|
||||
}
|
||||
Temp->data.fl[j]= (float)(t+(cvtest::randReal(rng)*2-1)*max_noise);
|
||||
Temp.at<float>(j) = (float)(t+(cvtest::randReal(rng)*2-1)*max_noise);
|
||||
}
|
||||
cvCopy( Temp, Sample );
|
||||
cvKalmanCorrect(Kalm,Temp);
|
||||
Temp.copyTo(Sample);
|
||||
Kalm.correct(Temp);
|
||||
}
|
||||
|
||||
Mat _state_post = cvarrToMat(Kalm->state_post);
|
||||
code = cvtest::cmpEps2( ts, _Sample, _state_post, EPSILON, false, "The final estimated state" );
|
||||
|
||||
cvReleaseMat(&Sample);
|
||||
cvReleaseMat(&Temp);
|
||||
cvReleaseKalman(&Kalm);
|
||||
Mat _state_post = Kalm.statePost;
|
||||
code = cvtest::cmpEps2( ts, Sample, _state_post, EPSILON, false, "The final estimated state" );
|
||||
|
||||
if( code < 0 )
|
||||
ts->set_failed_test_info( code );
|
||||
|
||||
Reference in New Issue
Block a user