Kinect touchable Surface - c#

I have a programming project using Kinect Xbox one sensor. The project is mainly about turning any surface into an interactive touchable screen. I have collected all the hardware including the projector. In addition, I have done my research and downloaded the related packets such as Visual Studio in order to start coding in C#.
So, my question here:
Is there any any library that I could use which may facilitate me to determine the angles/depth of the surface?
Plus, I don't have a fully vision of the steps which need to be done for the next steps, so I would really appreciate it if there is anyone could draw me a small map for me for this project.

If you have trouble with getting started with kinect go through this
Quick start series
and you also might want to capture the depth of objects. For that try to use Kinect's depth image streams and the sdk itself does not provide much happy methods. You will have to do some image processing on that gray scaled depth stream. Then you can find the edges of a single object in different depths.

Related

C# CNC CONTROLLER

I am trying to create a C# software that can control the CNC machines, First I am trying to create a 3d Space area in the PictureBox (or Pannel), I have gone through the internet and reached about this and I got one video. He made a 3D place in the form space, and it was a good tutorial but I don't know how to create a coordinate system in that space as you see in the image that I have given below.
Pls, Help me to do this.
enter image description here
enter image description here
If I get the proper solution for this, in the future I can develop this project.
Thank you, guys...
Update:
Actually, I have designed a C# program That controls the CNC machines,
For example, we can take UGS, There is much software out there but I need to create this in C#. The Only thing I am suffering here is the 3D coordinate system. How to create the Axis diagram in 3D.
Example: Planet Cnc's "Cnc USB Controller" I want to create this software in C#.
Thanks...
Build a CNC CAD programmer from skratch it's not a trivial activity.
You should be skilled in:
Math and Geometry in particular (vector/matrix calculus, base transformation, ...)
A language to comunicate with CNC (maybe G Code)
3D file formats
etc.
This is old, and you should have fixed the problem by now... but I hope to help someone in the future.
Have you seen Helix-toolkit? This library provides easy 3D camera and object controls for .Net Framework. I used this library in WPF C# for an application that generated G-Code for a CNC machine... this saved me in the simulation.
You can import 3D models (.3Ds or .obj) from your machine to 3D Panels (HelixViewport3D) and use them in the simulation or create meshes on demand in C#.
The documentation is simple, but on GitHub there are lots of examples.
Helix-toolkit on GitHub

different images from different point of view

I want different images to be displayed from different point of view. For the whole concept explaination please look at the images. they explain my idea/query!
As in the first image you see that there are three people at different angle looking at the monitor. Now i want the webcam to track the eyes and show the particular defined image to the user> For example: If user is at 45 degree angle then show image1.png
Depending upon the user's prespective of watching. The computer should show the image.
(the lady is the game character for representation purpose)
Can you please guide me on what steps can be taken to accomplish this? Is there any plugin available for unity that tracks faces? Please guide me
Also thanks for the compliments on my sketching skills xD
Stackoverflow is not really meant to recommend plugins, since the choice is usually opinion based so there is no exact answer.
That being said, on of the most common used API for computer vision (meaning interpreting images, including face recognition) is OpenCV, so that could be a good start for you to look at that.
And fortunately for you, there is a Unity plugin for OpenCV
It is too broad to give you more details about how it works here. You should try to make it work, and if you have a problem with your code, open a new question with the code portion that you struggle with.
PS: nice sketching skills
Perhaps easier option would be to use Kinect
(trying to detect face or eyes from that far might be shaky?)
With Kinect you can get skeletons for multiple people, and getting the angle between target and those kinect avatars would be easy.
If there is no space to put kinect in good position,
could consider placing it on the ceiling above (and then use depth data only to detect people in its view)
Only issue is that apparently Microsoft has stopped Windows kinect support,
so you would need to find 2nd hand versions.. (Unity Asset store still has some kinect plugins and examples available)
https://www.polygon.com/2018/1/2/16842072/xbox-one-kinect-adapter-out-of-stock-production-ended
Or look for kinect alternatives that work with unity, try RealSense cameras:
https://www.intel.sg/content/www/xa/en/architecture-and-technology/realsense-overview.html

Need to use Tiled Map editor with Unity 4.3.4

I shifted to unity few weeks ago. I am developing a 2D platformer. For creating the maps I am using Tiled map editor from www.mapeditor.org . I have created a basic map. Included the tileSheet png and the .tmx file (saved as XML) in the Assets of the project. I am able to read the XML , that is all the gid's. But I don't know how to access a particular portion(tile) from the tileSheet corresponding to a gid.
I think for this I need to load sprite in the memory and select a tile (by specifying Height and width and coords) from texture memory to display it on screen. As given here :http://gamedevelopment.tutsplus.com/tutorials/parsing-and-rendering-tiled-tmx-format-maps-in-your-own-game-engine--gamedev-3104
but its for flash , how I can achieve same thing in Unity using C#. Notice the copyPixel stuff in the flash code. I thought I could use ReadPixels but it is used for reading from screen only not the texture memory.
Thanks.
If you're working in Windows then the Tiled2Unity Utility sounds like it will fit your needs. It exports Object Layers and was made with Unity 4.3 features in mind.
(Full disclosure: I'm the author of Tiled2Unity)
EDIT: Tiled2Unity is available for Mac users as well now. There is a command-line version for Linux users. (all free)
If you can describe more carefully your problem and what you are trying to do, maybe myself or someone can help you better, for example what exactly do you mean by "load a sprite into memory"? Or "select a tile"? Copying pixel data is SLOWWW, and hopefully you don't mean to be doing this in real time.
Here is my real advice though:
Have you checked out UTiled? It does tiled maps in 2D in Unity so I think it already does what you want and it's free.
There is also UniTMX... free.
There is also 'Tiled Tilemaps'... which is like $2.
I also built a system that can also do what I think you are trying to do (your link is broken, so I can't be sure).
The system I built is called 'Tiled to Unity' (you can search it in youtube to see if it does what you want). It allows you to attach gameObjects to tiles and have tile variants, and can do 3D tiles.
Anyway, trying to roll your own pipeline from Tiled into Unity is a ton of work, and with these tools available, I think it is almost certainly unnecessary... That's just imo.

How to draw and process some 3D points?

I have some points like
1,2,3
1,1,1
2,3,4
2,5,6
9,10,2
66,43,23
I want to draw and see them in the page but I don't know how can I do this. I read a little about XNA but I think there is better way. Can you help me?
update
I want to simulate 3D points as 3DMax does. it means have a 3d shape and can look it in all degrees.
What you need is a 3d graphics drawing API.
There are 2 main ones:
OpenGL
Direct3D
OpenGL is cross platform and is used on mobile devices like Android and iPhone.
Direct3D is Microsoft specific and generally is for Windows platform only.
Don't overestimate the value of building a cross-platform app. If it's a small pet project and you're not planning to go cross platform in the future, don't choose a more difficult API just because it's cross platform.
Programming OpenGL quite easy to start with via GLUT from C++, and there are tons of simple examples on the web
You can also use Direct3D via XNA, which is also easy to start with. There are a huge number of XNA 4.0 tutorials on youtube (I haven't watched it, it just has a very green likes bar!) and also the msdn tutorials

Rendering graphics in C#

Is there another way to render graphics in C# beyond GDI+ and XNA?
(For the development of a tile map editor.)
SDL.NET is the solution I've come to love. If you need 3D on top of it, you can use Tao.OpenGL to render inside it. It's fast, industry standard (SDL, that is), and cross-platform.
Yes, I have written a Windows Forms control that wraps DirectX 9.0 and provides direct pixel level manipulation of the video surface.
I actually wrote another post on Stack Overflow asking if there are other better approaches: Unsafe C# and pointers for 2D rendering, good or bad?
While it is relatively high performance, it requires the unsafe compiler option as it uses pointers to access the memory efficiently. Hence the reason for this earlier post.
This is a high level of the required steps:
Download the DirectX SDK.
Create a new C# Windows Forms project and reference the installed
Microsoft DirectX assembly.
Initialize a new DirectX Device object with Presentation Parameters
(windowed, back buffering, etc.) you require.
Create the Device, taking care to record the surface "Pitch" and
current display mode (bits per pixel).
When you need to display something, Lock the backbuffer
surface and store the returned pointer to the start of surface
memory.
Use pointer arithmetic, calculate the actual pixel position in the
data based on the surface pitch,
bits per pixel and the actual x/y pixel coordinate.
In my case for simplicity I am sticking to 32 bpp, meaning setting a pixel is as simple as: *(surfacePointer + (y * pitch + x))=Color.FromARGB(255,0,0);
When finished drawing, Unlock the back buffer surface. Present the surface.
Repeat from step 5 as required.
Be aware that taking this approach you need to be very careful about checking the current display mode (pitch and bits per pxiel) of the target surface. Also you will need to have a strategy in place to deal with window resizing or changes of screen format while your program is running.
Managed DirectX (Microsoft.DirectX namespace) for faster 3D graphics. It's a solid .NET wrapper over DirectX API, which comes with a bit of performance hit for creating .NET objects and marshalling. Unless you are writing a full featured modern 3D engine, it will work fine.
Window Presentation Foundation (WPF) (Windows.Media namespace) - best choice for 2D graphics. Also has limited 3D abilities. Aimed to replace Windows Forms with vector, hardware accelerated resolution-independent framework. Very convenient, supports several flavours of custom controls, resources, data binding, events and commands... also has a few WTFs. Speed is usually faster than GDI and slower than DirectX, and depends greatly on how you do things (seen something to work 60 times faster after rewriting in a sensible way). We had a success implementing 3 1280x1024 screens full of real-time indicators, graphs and plots on a single (and not the best) PC.
You could try looking into WPF, using Visual Studio and/or Expression Blend. I'm not sure how sophisticated you're trying to get, but it should be able to handle a simple editor. Check out this MSDN Article for more info.
You might look into the Cairo graphics library. The Mono project has bindings for C#.
Cairo is an option. I'm currently rewriting my mapping software using both GDI+ and Cairo. It has a tile map generator, among other features.

Categories