Use just some part of sensor kinect - c#

I developed an application to use hands to move mouse cursor. But in the limits of computer screen, the cursor stay slow and run for other locations. I think that it is happens because I use all sensor of kinect. How I can use just part of sensor?

Not sure what kinect you use, but the kinect one cannt dissable certain streams.
Its goes all over USB3 to your PC, and its up to your code if you subscribe to those streams or not, but it is delivered anyway.
i'm not realy sure for the older kinect, but i assume its the same.
i have noticed that speed can depend a lot on the hardware, how your usb3 behaves.
i have a beast of a laptop i7 though a small industrial i5 outperforms it when running my kinect programs.
what you can do trough is drop frames, till your calculation is ready. that would keep most apps smooth working, if you dont want that try to create faster code you need roughly about 20ms to finish what you want to do till the next frame arives.

Try to see if you have this block of code where you can modify your application to your needs.
//Creates a new frame reader for correlating multiple frame sources.
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);

Related

Sony RemoteAPI delays after starting Liveview

Good worktime!
I'm writing C# warp around Sony Remote API, using Android test app as an example.
There became a problem with Liveview.
I start liveview streaming by the API method "startLiveview". Liveview data consumer works in a separate thread and it simply passes through frames if there's no time to draw them all (just like in the test app, as far as i understand).
However, after the startLiveview method is processed and fetching stream is started, the camera experience some difficulties with all other API commands processing in time.
E.g., after my warp discovers the camera and connects to it, performs startRecMode and so on, it can take pictures very fast. However, since liveview is started, the camera can't process all actTakePicture calls in time. There can be seconds or even dozens of seconds i have to wait before the shutter clicks.
I've tried to stop liveview before starting picture taking. It doesn't matter - stopLiveview command experiences the same problem, it takes even minutes to process it (there are minutes to return from System.Net.WebClient.UploadString).
I've tried to use startLiveviewWithSize instead of startLiveview and to pass the smallest size available (there is "M" with Sony A7R i'm using). No result.
What can i do to successfully stop the liveview or, as a max wish, to get rid of performance penalties when the liveview is on?
Thank you in advance!
p.S. Using MS VS 2010, .NET Framework 3.5, Sony ILCE Alpha 7R camera, all preprocessing settings found are switched off.

How to load 1000 push pins in nokia maps in small chunks

I am working on a window phone 8 app. Here I have to show around 1000 push Pins on a nokia map which I am able to show up. But my problem is that the push pins are taking a lot of time to load on tha map making abad user experience.
So Is there any method where I could load the pins in chunks so that the user experience becomes good.
Just load the push pins asynchronously...
http://msdn.microsoft.com/en-us/library/windows/apps/hh464924.aspx
rendering 1000 graphics on mobile device maybe be too much. Have you consider using any clustering to summerize close/overlapping features?
http://developer.nokia.com/Community/Wiki/HERE_Maps_API_-_How_to_cluster_map_markers
The basic way to do this is to:
- Add some pins
- wait a small amount of time
- repeat until all pins are loaded
When I did this previously (on WP7) it took some experimentation on how many pins to add and how long to wait to get values that "felt right".
Be aware that you may need to be careful with the threads you perform actions on. i.e. Don't do the waiting on the UI thread but you will need to be on the UI thread to do the adding of items/pins.
Also, be sure to test on actual low spec devices (i.e. Lumia 520) rather than the emulator to get a realistic understanding of the user experience.
As has been mentioned in other answers, having 1000 separate pins on the map is unlikely to be the best way to show information to the user or make best use of resources. There's very little point including pins outside of the visible area and when having lots of pins close together it can be hard to see or interact with specific pins.
By having clustering of pins in close proximity and adjusting which pins are displayed as the user pans and zooms around the map you may also avoid the issue of the time it takes to draw so many pins at once.

Is it possible to update more than 60 times per second with the XNA 4.0 Game class?

I'm having a problem with timing in XNA 4.0, writing in C# and using Visual Studio 2010 express.
I'm not writing a game exactly, but I'm trying to use XNA for it's simplified content pipeline, drawing, and timing. What I'm trying to do is write a program that can time a user's response to onscreen stimuli at very fine resolutions - less than 5 ms, ideally.
To do this, I need to call the update routine (so I can poll the keyboard) no less than once every 5 ms. Even in variable step timing, I can't get the timing below about 16 ms per call. This doesn't appear to have anything to do with the amount of processing that I do in my update and draw routines. I can comment out everything in both routines and the program still spends roughly 16.66 ms on each iteration.
In fixed step timing, I can set the target to about 60 iterations per second (16.66 ms between updates), but if I try to go any faster than that, the IsRunningSlowly flag is tripped, and the game seems to try to compensate - several iterations will run faster than 60 iterations per second, and then 1 iteration will run slower.
So I guess my question is this: is the 60 iterations per second the upper limit for XNA? Is it possible to circumvent it? Should I just ditch XNA altogether?
I really appreciate your time and knowledge. Thanks in advance.
The problem you are having is due to VSync. Disable it in XNA by adding this line to your game's constructor (assuming you have the default GraphicsDeviceManager graphics):
graphics.SynchronizeWithVerticalRetrace = false;
This will allow your game to run "fast as possible". This should be "good enough" for your purposes.
See this blog post for a description of timing in XNA.
If you wanted to get more fancy: For XNA on Windows I would consider using the Windows event loop and a high resolution timer directly. Note that Game in XNA (on Windows and Xbox 360) is entirely optional.
You'd want to move as many slow operations (eg: update and draw) and blocking operations (eg: vsync) off the main thread. Note that input in XNA can only be handled on the main thread. I think you can create the graphics device on a separate thread - although I have never tried it.
You should note that, if you are measuring reaction times, there is lag in between sending a "present" command to the GPU, and that content actually appearing on screen.
I'm not expert to XNA development, but, I know I have already similar "problem" in windows phone. (slowly problem).
When you have a lot of treatment, use multithreading programming,,
msdn : "Applications that use multithreading are more responsive to user input because the user interface stays active as processor-intensive tasks execute on separate threads. Multithreading is also useful when you create scalable applications, because you can add threads as the workload increases. "
Hope I help you...

Why is the kinect presentation that slow on my computer?

When using SimpleOpenNI and processing I had a smooth skeleton view, about 30fps. Using VC# and the skeletal tracking example it seems like about 10fps. As if something was blocking it.
Why is it that slow and how do I make it as fast as in processing?
pastebin.com/1La80sRU is the c# code basis - it is the original.
I have tried your code, and to me it seems fine. I am using an Xbox-360 Kinect and the FPS is just fine. It seems to stumble a bit when you are first detected, but that is expected since it then requires more data. A video of me doing this can be found here. It also seems that your Kinect needs to warm up (slower at beginning => gets faster later on). My video does not show that since I started recording after Kinect was warmed up.

How can I edit individual pixels in a window?

I want to create a simple video renderer to play around, and do stuff like creating what would be a mobile OS just for fun. My father told me that in the very first computers, you would edit a specific memory address and the screen would update. I would like to simulate this inside a window in Windows. Is there any way I can do this with C#?
This used to be done because you could get direct access to the video buffer. This is typically not available with today's systems, as the video memory is managed by the video driver and OS. Further, there really isn't a 1:1 mapping of video memory buffer and what is displayed anymore. With so much memory available, it became possible to have multiple buffers and switch between them. The currently displayed buffer is called the "front buffer" and other, non-displayed buffers are called "back buffers" (for more, see https://en.wikipedia.org/wiki/Multiple_buffering). We typically write to back buffers and then have the video system update the front buffer for us. This provides smooth updates, as the video driver synchronizes the update with the scan rate of the monitor.
To write to back buffers using C#, my favorite technique is to use the WPF WritableBitmap. I've also used the System.Drawing.Bitmap to update the screen by writing pixels to it via LockBits.
It's a full featured topic that's outside the scope (it won't fit, not that i won't ramble about it for hours :-) of this answer..but this should get you started with drawing in C#
http://www.geekpedia.com/tutorial50_Drawing-with-Csharp.html
Things have come a bit from the old days of direct memory manipulation..although everything is still tied to pixels.
Edit: Oh, and if you run into flickering problems and get stuck, drop me a line and i'll send you a DoubleBuffered panel to paint with.

Categories

Resources