OpenCV学习——基本矩阵

#include <iostream>
#include <cv.h>

//------------ 各種外部変数 ----------//
double first[12][2] =
{
{488.362, 169.911},
{449.488, 174.44},
{408.565, 179.669},
{364.512, 184.56},
{491.483, 122.366},
{451.512, 126.56},
{409.502, 130.342},
{365.5, 134},
{494.335, 74.544},
{453.5, 76.5},
{411.646, 79.5901},
{366.498, 81.6577}
};

double second[12][2] =
{
{526.605, 213.332},
{470.485, 207.632},
{417.5, 201},
{367.485, 195.632},
{530.673, 156.417},
{473.749, 151.39},
{419.503, 146.656},
{368.669, 142.565},
{534.632, 97.5152},
{475.84, 94.6777},
{421.16, 90.3223},
{368.5, 87.5}
};

int main(int argc,char *argv[])
{
CvMat *firstM = cvCreateMat(12,2,CV_64FC1);
cvSetData(firstM,first,firstM->step);

CvMat *secondM = cvCreateMat(12,2,CV_64FC1);
cvSetData(secondM,second,secondM->step);

CvMat *FMat= cvCreateMat(3,3,CV_64FC1);

if(cvFindFundamentalMat(firstM,secondM,FMat,CV_FM_RANSAC,1.00,0.99) == 0){
std::cerr << "Can't Get F Mat\n";
return -1;
}

for(int y = 0; y < 3;++y){
for(int x = 0; x < 3;++x)
{
std::cout << CV_MAT_ELEM(*FMat,double,y,x) << " ";
}
std::cout << "\n";
}


cvReleaseMat(&firstM);
cvReleaseMat(&secondM);
cvReleaseMat(&FMat);

return EXIT_SUCCESS;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值