Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Events Not Working in C#?

Gerald_M_1
Beginner
585 Views

Hello there,

Recently got the chance to (finally) try out the camera, and while nice so far, I've been having trouble with getting events to work.  My code can be found over on my Github (https://github.com/gemisis/Pinch-Me), and when trying an event based approach, I modify the mainForm_Load method in mainForm.cs to look like this:

        private void mainForm_Load(object sender, EventArgs e)
        {
            session = PXCMSession.CreateInstance();
            manager = session.CreateSenseManager();

            if (manager == null)
            {
                Console.WriteLine("Failed");
            }
            manager.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, 1920, 1080, 30);
            manager.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_DEPTH, 640, 480, 60);
            manager.EnableHand();

            PXCMSenseManager.Handler handler = new PXCMSenseManager.Handler();
            handler.onNewSample = this.newColorFrame;
            manager.Init(handler);

            manager.StreamFrames(true);
        }

According to the SDK Documentation, that should work, but I receive the following error :

An unhandled exception of type 'System.Runtime.InteropServices.SafeArrayTypeMismatchException' occurred in libpxcclr.cs.dll

Any ideas what could be causing this?

0 Kudos
1 Reply
Xusheng_L_Intel
Employee
585 Views

You need implement onNewSample. You can find details @https://software.intel.com/sites/landingpage/realsense/camera-sdk/2014gold/documentation/html/index.html?manuals_color_and_depth_picture_alignment.html

0 Kudos
Reply