I am trying to find the fundamental matrix by manually identifying 7 corresponding points in two images and using the findFundamentalMatrix function. However on printing the matrix, it turn out to be 3x9. It seems to be a bug in my code but I cant seem to figure it out.
void mouseEventOne(int event, int x, int y, int, void* param){
//select points in first image. store in one.
}
void mouseEventTwo(int event, int x, int y, int, void* param) {
//select points in second image. store in two.
set flag after 7 points
}
int main(int argc, char** argv) {
setMouseCallback("ImageOne", mouseEventOne, (void *) &ptOne);
setMouseCallback("ImageTwo", mouseEventTwo, (void *) &ptTwo);
for(;;) {
if(one.size() == 7 && two.size() == 7 && flag){
F = findFundamentalMat(one, two, CV_FM_7POINT);
flag = false;
cout<<F<<endl;
}
imshow("ImageOne", imageOne);
imshow("ImageTwo", imageTwo);
char s = (char)waitKey(30);
switch(s){
case 'q':
return 0;
}
}