Sunday, 8 September 2013

Can some one show me a short quick function that uses OpenCV's C Interfaces cvCrossProduct:

Can some one show me a short quick function that uses OpenCV's C
Interfaces cvCrossProduct:

Just something short that uses cvCreateMat and would output the vector
result to a window something simple so the output looks something like
this

I just basically would like if someone could write a program that uses
cvCreateMat to create 2 empty mats, cvSet?d to fill them in and
cvCrossProduct to calculate the result. I looked on google and I can't get
any cvCrossProduct code sample to run.
It must use C code though....If not cvSet?D, pls something
comparable....or If you can just update my code as minimally as possible
to work I would appreciate it.....This is what I would like to have
happen:
#include <cv.h>
#include <highgui.h>
using namespace std;
int main()
{
cvNamedWindow("MyWindow" , CV_WINDOW_NORMAL);
CvMat *a = cvCreateMat(3, 3, CV_32F);
CvMat *b = cvCreateMat(3, 1, CV_32F);
CvMat *c = cvCreateMat(3, 1, CV_32F);
cvSet1D(a, 0, CvScalar(128.0));
cvSet1D(a, 1, CvScalar(128.0));
cvSet1D(a, 2, CvScalar(128.0));
cvSet1D(b, 0, CvScalar(228.0));
cvSet1D(b, 1, CvScalar(228.0));
cvSet1D(b, 2, CvScalar(228.0));
cvCrossProduct(a, b, c);
cvShowImage("MyWindow", c);
cvWaitKey(0);
//cleaning up
cvDestroyWindow("MyWindow");
cvReleaseImage(&a);
cvReleaseImage(&b);
cvReleaseImage(&c);
return 0;
}

No comments:

Post a Comment