From: John Lyle on 14 Nov 2009 01:59 I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#cvGetSeqElem) like this: cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The MATLAB signature is: [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32)
From: roger on 14 Nov 2009 05:45 On Nov 14, 7:59 am, "John Lyle" <mathwo...(a)myallit.com> wrote: > I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#....) like this: > > cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); > > where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The MATLAB signature is: > > [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32) are you trying to typecast in matlab? better do it in c/c++ if you can. R
From: John Lyle on 14 Nov 2009 23:34 Yes I am, is that not possible? I'm trying to use the OpenCV DLLs directly in MATLAB without writing any C++ wrapper code. roger <northsolomonsea(a)gmail.com> wrote in message <5badc0bd-f0dd-44e8-9153-b0975f7ffe2b(a)l2g2000yqd.googlegroups.com>... > On Nov 14, 7:59?am, "John Lyle" <mathwo...(a)myallit.com> wrote: > > I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#...) like this: > > > > cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); > > > > where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The MATLAB signature is: > > > > [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32) > > are you trying to typecast in matlab? better do it in c/c++ if you > can. > R
From: roger on 15 Nov 2009 05:52 On Nov 15, 5:34 am, "John Lyle" <mathwo...(a)myallit.com> wrote: > Yes I am, is that not possible? I'm trying to use the OpenCV DLLs directly in MATLAB without writing any C++ wrapper code. > > > > roger <northsolomon...(a)gmail.com> wrote in message <5badc0bd-f0dd-44e8-9153-b0975f7ff...(a)l2g2000yqd.googlegroups.com>... > > On Nov 14, 7:59?am, "John Lyle" <mathwo...(a)myallit.com> wrote: > > > I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#...) like this: > > > > cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); > > > > where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The MATLAB signature is: > > > > [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32) > > > are you trying to typecast in matlab? better do it in c/c++ if you > > can. > > R Typecasting in matlab is very basic and afaik you can't cast non (matlab) base types, apart from that it's inefficiently implemented. Better write a small wrapper, if typecasting is all it does it will be easy enough.
From: John Lyle on 16 Nov 2009 00:35
OK thanks for your help roger <northsolomonsea(a)gmail.com> wrote in message <5601f08d-e6c6-4fa1-8b24-f8f83c6c0c91(a)g23g2000yqh.googlegroups.com>... > On Nov 15, 5:34?am, "John Lyle" <mathwo...(a)myallit.com> wrote: > > Yes I am, is that not possible? I'm trying to use the OpenCV DLLs directly in MATLAB without writing any C++ wrapper code. > > > > > > > > roger <northsolomon...(a)gmail.com> wrote in message <5badc0bd-f0dd-44e8-9153-b0975f7ff...(a)l2g2000yqd.googlegroups.com>... > > > On Nov 14, 7:59?am, "John Lyle" <mathwo...(a)myallit.com> wrote: > > > > I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#...) like this: > > > > > > cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); > > > > > > where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The MATLAB signature is: > > > > > > [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32) > > > > > are you trying to typecast in matlab? better do it in c/c++ if you > > > can. > > > R > > Typecasting in matlab is very basic and afaik you can't cast non > (matlab) base types, apart from that it's inefficiently implemented. > Better write a small wrapper, if typecasting is all it does it will be > easy enough. |