Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get feedback from MediaCapture API in Windows 8

I'm trying to do face tracking apps in Windows 8 app. And I aware that in order to access the camera stream, I have to use MediaCapture.AddEffectAsync() which has to be done incorporate with C++ as shown in this sample.

Now I'm able to access the stream and track the face, but I'm not able to pass/return the tracking face coordinate to C# for further processing.

One way I've tried is to invoke C# method in C++ to pass back the tracking coordinate. But no avail, because Visual Studio doesn't allow circular dependencies between projects.

Another way is to constantly pull the data from C++, but this is not what I want.

Maybe there is another more straight forward way to access the camera buffer, I would like to know.

So my question is, how to get back the tracking coordinate? Or What is the right way to do it? Thanks!

like image 754
NcJie Avatar asked Oct 16 '12 04:10

NcJie


1 Answers

To overcome this, we simply setup TCP/IP localhost connection between C++ DLL and C# code. That is, we let C# become server, and C++ DLL become client. Whenever C++ DLL wants to talk with C#, C++ merely pass the data to C# through TCP/IP socket. Currently, Windows 8 doeesn't place restriction on TCP/IP communication within same process.

A good starting reference is StreamSocket sample

This is not a best way, and it is having slightly performance pernalty as the data need to go through TCP/IP layer. But, so far, perhaps this is the best we can have, unless Microsoft breaks the barrier.

like image 97
Cheok Yan Cheng Avatar answered Oct 10 '22 08:10

Cheok Yan Cheng