tags:

views:

252

answers:

2

Hai ,

how do i typecast in opencv ,I want to type cast to cvseq to cvpoint

+1  A: 

From what I can see here:

http://opencv.willowgarage.com/documentation/dynamic_structures.html

CvSeq seems to be some form of data container and can not be directly cast to a CvPoint.

This might be what you want:

char* cvGetSeqElem(const CvSeq* seq, int index)

I guess it's used like this:

CvPoint* point = reinterpret_cast<CvPoint*>(cvGetSeqElem(sequence, some_index));
Andreas Brinck
A: 

You don't typecast in onpenCV as such, its a feature of C++

you do it something like this

float var_a = 9.99;
int   var_b = static_cast<int>var_a;

if you had only tried to write

int var_b = var_a;

You would have got a warning that you can't implicitly (automatically) convert a float to an int, as you lose the decimal.

typecasting (putting the type you KNOW you want in brackets) tells the compiler you know what you are doing and are cool with it.

thecoshman
whether or not you actually wan't and/or can typecast these types is another matter entirely.
thecoshman
how is this relevant to the question?
Naveen
the question is about typecasting, I am showing him an example of how you typecast. What with it being an example I have not used the exact same types he asked about, but it works for any type. I then pointed out in a comment (admittedly probably should have edited answer to include it) that not all types can be converted to one another.
thecoshman