Kinect sdk version compatibility issue - c#

I am working on Kinect project for Blob detection using Kinect sdk 2.0.
After doing so much efforts to find reference tutorial for it, I found out following tutorial.
http://blogs.claritycon.com/blog/2012/11/blob-tracking-kinect-opencv-wpf/
The issue is that this example is built on Kinect sdk 1.8 . Because of that, some events and methods which are not supported in kinect sdk 2.0.
for eg.
private void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
(Error:The type or namespace name AllFramesReadyEventArgs could not be found(are you missing a using directive or an assembley reference?))
I tried to find out those events and methods new name for kinect sdk 2.0 but I didn't get anything.

You can use a different frame callback that listens to MultiSourceFrameReader. This can receive BodyFrameType, DepthFrameType, ColorFrameType, etc. simultaneously.
For example:
private void Reader_FrameArrived(object sender, MultiSourceFrameArrivedEventArgs e) {
using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame().BodyFrameReference.AcquireFrame()) {
// do something
}
using (DepthFrame depthFrame = e.FrameReference.AcquireFrame().DepthFrameReference.AcquireFrame()) {
// do something
}
}
To add a frame to this callback, instantiate a MultiSourceFrameReader reader object and do this:
this.reader.MultiSourceFrameArrived += Reader_FrameArrived;

Related

Errors when upgrading Vuforia in Unity from version 9 to version 10

The type or namespace name 'SmartTerrain' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'PositionalDeviceTracker' could not be found (are you missing a using directive or an assembly reference?)
These errors weren't in version 9 but in version 10 they are affecting project flow please help me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Vuforia;
public class ARManager : MonoBehaviour
{
public PlaneFinderBehaviour finder;
SmartTerrain smartTerrain;
PositionalDeviceTracker positionalDeviceTracker;
...........
tl;dr: These types don't exist anymore since they are not needed anymore.
I would start at Vuforia - Migration Guide for Vuforia Engine Unity Projects.
In general for any software library it is not unlikely that things and the API change between major versions - indeed such a breaking change is one of the main reasons to release a new major version at all!
This page documents the changes between Vuforia Engine version 9.8 and version 10 as the API has fundamentally changed. Use this overview to learn about the native changes and for migrating your existing projects to the new API.
So read up what to use instead or what changed in the API => what you have to change in your code to adopt - or stick to the version 9 if it worked for you and you don't need the newest features ;)
In your specific cases
Ground Plane
Some more advanced Ground Plane APIs have changed. Apps that were using not just the game objects above, but additional runtime scripting APIs might have to be adapted.
The Smart Terrain Tracker has been removed. It no longer needs to be managed manually. Consequently, checking for Ground Plane support at runtime has changed.
Vuforia Engine 9.8:
SmartTerrain smartTerrain = TrackerManager.Instance.GetTracker<SmartTerrain>();
if (smartTerrain == null)
Debug.Log("SmartTerrain returned null. GroundPlane not supported on this device.");
Vuforia Engine 10.0:
if (VuforiaBehaviour.Instance.World.AnchorsSupported == false)
Debug.Log("GroundPlane not supported on this device.");
and
Device Tracking
Access to device tracking has been simplified and is now available
centrally through VuforiaBehaviour.Instance.DevicePoseBehaviour.
Resetting Device Tracking
Vuforia Engine 9.8:
var deviceTracker = TrackerManager.Instance.GetTracker<PositionalDeviceTracker>();
deviceTracker.Reset();
Vuforia Engine 10.0:
VuforiaBehaviour.Instance.DevicePoseBehaviour.Reset();
Registering to updates to the device tracking status
Vuforia Engine 9.8:
private void Start()
{
DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);
}
void OnDevicePoseStatusChanged(Vuforia.TrackableBehaviour.Status status, Vuforia.TrackableBehaviour.StatusInfo statusInfo)
{
Debug.Log("OnDevicePoseStatusChanged(" + status + ", " + statusInfo + ")");
…
}
Vuforia Engine 10.0:
private void Start()
{
VuforiaBehaviour.Instance.DevicePoseBehaviour.OnTargetStatusChanged += OnDevicePoseStatusChanged;
}
void OnDevicePoseStatusChanged(ObserverBehaviour behaviour, TargetStatus targetStatus)
{
Debug.Log("OnDevicePoseStatusChanged(" + targetStatus.Status + ", " + targetStatus.StatusInfo + ")");
}
Enabling and disabling Device Tracking
Vuforia Engine 9.8:
public void ToggleDeviceTracking(bool enableDeviceTracking)
{
var posDeviceTracker = TrackerManager.Instance.InitTracker<PositionalDeviceTracker>();
if (enableDeviceTracking)
posDeviceTracker.Start();
else
posDeviceTracker.Stop();
}
Vuforia Engine 10.0:
public void ToggleDeviceTracking(bool enableDeviceTracking)
{
VuforiaBehaviour.Instance.DevicePoseBehaviour.enabled = enableDeviceTracking;
}

c# simple skype app throws COM exception

I am making my first Skype app that can simply message a user but when I debug I get a exception that crashes my app.
Here is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using skype_app;
using SKYPE4COMLib;
namespace skype_app
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
var oskype = new SKYPE4COMLib.Skype();
oskype.PlaceCall(textBox1.Text);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
var oskype = new SKYPE4COMLib.Skype();
oskype.SendMessage(textBox1.Text, textBox2.Text);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
}
}
i have use some extra references
references list:
Microsoft.Csharp
SKYPE4COMlib
SkypeDialoglib
system
system.core
system.data
system.data.DataSetEXTensions
system.deployment
system drawing
System.Windows.forms
System.xml.linq
Here is the exception i get:
System.RUntime.InteropServices.ComException : {"connection refused"}
So I guess my main question is why does my connection get refused when Skype dose not even open the dialogue asking if I want to allow the connection ?
The issue is that you're trying to debug in Visual Studio. Unfortunately, according to Skype themselves, they do not support using this API & debugging in VS:
Per the link:
The most comment cause for this is you are trying to debug the program
in Visual Studio. Going forward we will not be able to support using
the visual studio hosting process for debugging. You can turn it off
by:
Open your project in VS
Open your projects properies
click the debug tab
untick "use visual studio hosting process"
rebuild your application and begin debugging and it should work ok.
i face the same issue. this way i solved it.
here is my code
Skype skype;
skype = new SKYPE4COMLib.Skype();
Call call = skype.PlaceCall(txtPhonenNo.Text);
first thing login to skype and go to Tools > option > advanced settings
your screen would look like
click on manage other program's access to skype
then another window will come which will show all program name which try to access skype. if any exist just select all and remove it.
then run your program again and go to that screen where this option was available called click on manage other program's access to skype
click there and a windows will come which will display the name of your apps just select that name and click on change button then another window will come which looks like
in that window just select the option called allow this program to access skype then a dialog come on the skype window which looks like
where you need to click on allow access button and then your job will be done. hope this will help.

Cannot find ContentTypeReader

I have found a number of threads on this error but I haven't found a solution. I am using a number of class libraries from XNAExpert.com that are designed to animate a skinned mesh. I'm using XNA 4.0, Win Xp and programming games for Windows. Here is complete error:
Cannot find ContentTypeReader SkinnedModel.SkeletonReader, SkinnedModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
The tutorial can be found here . Here is the code from the reader class within SkinnedModel project:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
namespace SkinnedModel
{
public class SkeletonReader : ContentTypeReader<Skeleton>
{
protected override Skeleton Read(ContentReader input, Skeleton existingInstance)
{
List<Bone> boneList = input.ReadObject<List<Bone>>();
return new Skeleton(boneList);
}
}
}
Here is the code from the writer class from within SkinnedModelProcessor project:
[ContentTypeWriter]
public class SkeletonWriter : ContentTypeWriter<Skeleton>
{
protected override void Write(ContentWriter output, Skeleton value)
{
output.WriteObject(value.BoneList);
}
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return typeof(SkeletonReader).AssemblyQualifiedName;
}
}
As you can see the type returned is the Assembly Qualified Name for each reader...Is anyone aware of another reason why I may be having trouble?
Solution for me was to just delete the ContentTypeReader and create a new one.
My problem seemed to be caused by having a mirrored project (I had Windows game library and Windows Phone game library). On Windows client the ContentReader was successfully found, but not on the Windows Phone client.
As i read it the SkeletonReader is known to the SkeletonWriter. I cannot think of a valid way to setup the projects so that this is true.
Project Main (Links To Content)
SkeletonReader
Skeleton
Project Content (Links To ContentExtendion)
SkeletonFile (Has Processor set to SkeletonProcessor)
Project ContentExtendion (Cannot link circular)
SkeletonContent (Is Input For Writer)
SkeletonWriter
SkeletonProcessor
Look at your ProjectSetup i think your assemblies are not linked correctly.
And return a fixed string in GetRuntimeReader - if you setup the projects correctly you will loose the connection to the SkeletonReader.
There is a quite complete tutorial on the content pipeline on the interwebs.

How to write a hello world add-in for Win 7 Media Center

I want to write a simple hello world add in for Media Center on Windows 7, but I am having problems finding up to date functional documentation. I found this page: http://blogs.msdn.com/b/mcreasy/archive/2004/10/12/241449.aspx which looks to be exactly what I need. I implemented it and some of the interfaces it references are marked as obsolete, and even so when I try to launch it in media center is just pops up a dialog saying "unable to launch addin"
I updated the namespace interfaces from using Microsoft.MediaCenter.AddIn to using Microsoft.MediaCenter.Hosting which looks to be the up to date namespace according to the sdk docs, but I still have the same problem.
registering the assembly with the gac and with RegisterMCEApp both are successful, and I have unregistered and registered from both places in between builds.
I strongly signed the assembly with a .snk file and got the public key token to update the registration.xml
Can anyone either tell me what I am doing wrong or direct me to some up to date tutorial /docs?
Here is the little bit of code I have:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.MediaCenter.Hosting;
namespace MCPluginTakeTwo
{
public class HelloWorldAddIn: MarshalByRefObject, IAddInModule, IAddInEntryPoint
{
public void Initialize(Dictionary<string, object> appInfo, Dictionary<string, object> entryPointInfo)
{
}
public void Uninitialize()
{
}
public void Launch(AddInHost host)
{
}
}
}
Maybe looking at some open source mc plugins would help.
Here's another getting started tutorial, with some tips for getting started with Visual Studio 2010 (because the SDK only comes with VS 2008 templates).
http://david.gardiner.net.au/2010/10/writing-media-center-application-in.html

ASP.Net and Web Services

I have been searching for 4 days non stop. I am sleep deprived and going crazy. Can someone please help me or at least tell me what I'm doing wrong. This is my project
Develop a client web page app that uses the web service found at http://www.marksmerry.com/peanutbutter/WebService1.asmx.
The service generates a random number m
This service receives a guess , an integer between 1-100 inclusive. It returns a string:
low - if the guess is lower than m
equal – if the guess is correct
high - if the guess is higher than m
I have referenced the web service but I'm lost at the syntax or something please help me! This is what I have so far.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using localhost;
using System.Web.Services;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
localhost.WebService1 ws1 = new WebService1();
//What goes in this area. I have been searching and have tried all kinds of combination all have resulted in build errors
}
}
type ws1. and a list of methods will appear.
any service methods that were discovered by visual studio when you referenced the 'peanutbutter' webservice will be available to call on the proxy class (called WebService1 in your code example).
string result = ws1.Guess(42);
If you just type the url in the browser, it wil show you what methods it has.
http://www.marksmerry.com/peanutbutter/WebService1.asmx
I can see a web method Guess which takes an int.
As per your code, You can call it via
string result = ws1.Guess(10); // or input
When you added the reference you should have got the chance to give it a name. It's only semantics but it might be better to give it a different name from localhost.
Previous commentators have made good suggestions so I'd follow them.
Only thing I'd suggest is this.
string result = ws1.Guess("10"); //EDIT: this is wrong of course. It takes an int.
I did some work this morning using a web service.
myCoService.Service1 v24 = new myCoService.Service1();
System.Xml.XmlNode doc = v24.CreateSite(newSiteName);
Should be as simple as that.
If it isn't I'd have a look again at how you set up your web reference. Also please let us know what NET framework you are using.
I added a web Reference to a test project and a button on a page which fires this event.
protected void PeanutGuess_click(object sender, EventArgs e) {
PeanutButter.WebService1 pb = new PeanutButter.WebService1();
string response = pb.Guess(10);
lblResult.Text = string.Format("Response for 10 is " + response);
}
This works fine for me. I'm using VS2010 and the project uses Net Framework 3.5

Categories

Resources