.net wrappers for c++ SDK
Re: .net wrappers for c++ SDK
Okay, problem solved, I was missing the cameralibrary.dll
Now looking at the wrapper, I can't find a way to actually get the pixels from a frame, something like the Rasterize function in the demos, is this possible? Looking at the source code for the wrapper, Rasterize functions seem to be commented, is there a reason for this?
Now looking at the wrapper, I can't find a way to actually get the pixels from a frame, something like the Rasterize function in the demos, is this possible? Looking at the source code for the wrapper, Rasterize functions seem to be commented, is there a reason for this?
Re: .net wrappers for c++ SDK
Okay, I've tried to wrap the Bitmap class myself and try to extend the wrapper into supporting the Rasterize function. The problem is, I'm new to this wrapping stuff so I'm having some trouble in the process.
This is the MBitmap class I've added to the exsitent wrapper by Brad:
And this is the rasterize function on the MFrame managed class:
The problem is, when calling this Rasterize function from my application, I get a criptic error saying "Rasterize is not supported by the language".
Any ideas on what I'm doing wrong?
This is the MBitmap class I've added to the exsitent wrapper by Brad:
Code: Select all
public ref class MBitmap{
public:
/* Wrapping constructors */
MBitmap( int pixelWidth, int pixelHeight, int byteSpan, mColorDepth mcd, const unsigned char *bits){
CameraLibrary::Bitmap::ColorDepth cd = static_cast<CameraLibrary::Bitmap::ColorDepth>(mcd);
bitmap = new Bitmap(pixelWidth, pixelHeight, byteSpan, cd, bits );
}
MBitmap( int pixelWidth, int pixelHeight, int byteSpan, mColorDepth mcd){
MBitmap(pixelWidth, pixelHeight, byteSpan, mcd, 0);
}
~MBitmap(){
delete this->bitmap;
bitmap = 0;
}
//Wrapping functions
int PixelWidth() {return bitmap->PixelWidth();}
int PixelHeight() {return bitmap->PixelHeight();}
int ByteSpan() {return bitmap->ByteSpan();}
int GetPixel(int X, int Y) {return bitmap->GetPixel(X,Y);}
// GUI uses this to draw.
const unsigned char *GetBits() {return bitmap->GetBits();}
int BufferSize() {return bitmap->BufferSize();}
public:
//private:
Bitmap * bitmap;
};
Code: Select all
///== Rasterization Functionality ==========--
void Rasterize(MBitmap bitmapRef){frame->Rasterize(bitmapRef.bitmap);}
The problem is, when calling this Rasterize function from my application, I get a criptic error saying "Rasterize is not supported by the language".
Any ideas on what I'm doing wrong?
Re: .net wrappers for c++ SDK
Code: Select all
///== Rasterization Functionality ==========--
void Rasterize(MBitmap^ bitmapRef){frame->Rasterize(bitmapRef->bitmap);}
Re: .net wrappers for c++ SDK
Someone else have tried to wrap the ModuleVectorProcessor?
I seem to have a problem getting the Position after processing the vector.
Code is something as follows
Wrappercode getposition for ModuleVectorProcessor (bit ugly value call by reference is a bit strange in managed c++ :\ maybe thats the problem?):
When processing the vectors like the sample application and calling in my C# app:
the processor is return Double.MinValue or Double.NaN. I tried to look if i was missing something out but everything looks correct compared to the C++ implementation. Is it my "call by reference" function which is implemented incorrect? Or does it mean that my vector module wrapper implementation is not correctly pushing vectors to the processor?
I seem to have a problem getting the Position after processing the vector.
Code is something as follows
Wrappercode getposition for ModuleVectorProcessor (bit ugly value call by reference is a bit strange in managed c++ :\ maybe thats the problem?):
Code: Select all
void GetPosition(double % x, double % y, double % z)
{
double dX;
double dX;
double dX;
// passing x directly is giving cast (double) to (double&) compiler error
moduleVectorProcessor->GetPosition(dX, dY, dZ);
x = dX;
y = dY;
z = dZ;
}
When processing the vectors like the sample application and calling in my C# app:
Code: Select all
// starting getframe
...
// processing vector
...
vectorProcessor.GetPosition(ref x, ref y, ref z);
// the x,z,y = NaN or very low probaly Double.MinValue :(
...
the processor is return Double.MinValue or Double.NaN. I tried to look if i was missing something out but everything looks correct compared to the C++ implementation. Is it my "call by reference" function which is implemented incorrect? Or does it mean that my vector module wrapper implementation is not correctly pushing vectors to the processor?
Re: .net wrappers for c++ SDK
A bit to fast with posting I tested the call by reference function and it seems the way to implement a C++ CLI call by reference to a native function to make a temporary variable so that must not be the problem.
I will try to look again to my ModuleVector implementation for calculation and pushing it to the vector processor maybe its not working there
I will try to look again to my ModuleVector implementation for calculation and pushing it to the vector processor maybe its not working there
Re: .net wrappers for c++ SDK
This looks exactly what I seem to need. I am trying to get the 2d blob frames from my TrackIR 5 camera using C# and have been unsuccessful. Doug, you say that is unnecessary now. How do I now access it?
Thanks.
Thanks.
Re: .net wrappers for c++ SDK
My problem has been resolved btw just forgot to setup some settings for the camera
Re: .net wrappers for c++ SDK
I am a newbee and trying to access the trackir 5 with C#. Can you tell me what dll you are accessing to communicate with the camera?
Thanks
Thanks
Re: .net wrappers for c++ SDK
They are using cameralibrary.dll which is included with the Camera SDK when it is installed.
Re: .net wrappers for c++ SDK
Hi all,
I'm using this wrapper with VS 2010 Express, SP1. Works fine under both 64-bit Win 7 and 32-bit XP, on machines that have VS installed; both release and debug builds.
On machines without VS, the call to CameraManager::Ptr() (or X()) fails. I know this by dropping OutputDebugString() statements in the wrapper and running DebugView from SysInternals. I've run Dependency Walker and only get the missing MSJAVA DLL, which is delay-loaded and doesn't apply.
I installed .NET 4, which I'm using, and the SDK 1.1 final. I do not want to have to install VS 2010 Express just to run, but I'm kind of out of ideas. Anything clever out there?
Thanks.
-reilly.
I'm using this wrapper with VS 2010 Express, SP1. Works fine under both 64-bit Win 7 and 32-bit XP, on machines that have VS installed; both release and debug builds.
On machines without VS, the call to CameraManager::Ptr() (or X()) fails. I know this by dropping OutputDebugString() statements in the wrapper and running DebugView from SysInternals. I've run Dependency Walker and only get the missing MSJAVA DLL, which is delay-loaded and doesn't apply.
I installed .NET 4, which I'm using, and the SDK 1.1 final. I do not want to have to install VS 2010 Express just to run, but I'm kind of out of ideas. Anything clever out there?
Thanks.
-reilly.