HoloLens - Capturing photo when locatable camera is in VideoMode (streaming) - c#

I am trying to create a HoloLens application, which uses the built in WebCam to take photos and sends them to a rest interface for further face recognition. This is working well so far. To capture photos from the WebCam it needs to be in the PhotoMode.
The problem:
If I want now to present my application via live stream, the WebCam is set automatically to the VideoMode and capturing photos is not possible.
The locatable camera description https://developer.microsoft.com/en-us/windows/mixed-reality/locatable_camera_in_unity says:
"Only a single operation can occur with the camera at a time."
Since the application has to be presented to a great number of people it is absolutely essential to show it via live stream.
Does somebody have any general idea how to solve this problem, or maybe some hack to access the WebCam in PhotoMode simultaneously to the streaming?
Many thanks in advance!

This is possible if you can live with Preview Frames from the MediaCapture streams. Just start the video capture (layer on holograms if you need to), and then use the PreviewFrames as your 'photos'. This limits you to the resolution of the camera stream of course.
I was able to get this plugin working on a HoloLens. Had to use .Net instead of IL2CPP and I used 2017.4.22f1. At the very least the code shows how use MediaCapture and PreviewFrames to get a video feed from the camera for which you can grab the current frame to save as a photo. The sample doesn't do that last bit, but the bytes for the frames are being passed around, just need to make them available for your need. =)
https://github.com/VulcanTechnologies/HoloLensCameraStream

Related

get the image stream of the camera

I'm currently developing a windows phone 8.1 Silverlight in C#. I managed to get the stream of the camera and output it on the screen of the phone (using PhotoCamera). This app is about OCR so I need to get an image very frequently to perform operations on it (the goal is to detect a specific object but through the camera and not a picture). Does anyone have an idea about how to achieve that (-> a function from the API that sends you an image every so often)? There is a lot of Microsoft tutorial, but I can't find one about that particular usage.
Well this seems to be the tutorial I was looking for. Hopefully this will help other people with the same problem : https://msdn.microsoft.com/fr-fr/library/windows/apps/hh202982(v=vs.105).aspx .

Record video from camcorder in C#

I need to be able to record video from an external camera in a C# application.
Unfortunately a webcam is pretty much out of the question as the application will record outside and during the evening/night. That is why I was thinking of a camcorder since it also has manual control over exposure and focus, lower noise and better sensor.
So far I would use the AV/S-Video output from the camcorder and send the signal to a USB capture card (the computer is a laptop so no PCI-E cards).
How would I be able to access the video stream from the C# application, now that it comes from the capture card ?
Does my proposed system seem feasible (achievable, good video quality, good fps)? Does anybody have another working solution?
Thanks
This Code Project Article could be of a good starting point.
The Author mentions :
The main goal of the application was to make it flexible and
extensible. The application itself can communicate with any video
source – it may be an IP video camera or a server, it may be a local
camera attached to USB, it may be an MMS stream from a remote server,
or it may be any other video source. And more of it, the application
can work with all these video sources simultaneously, displaying them
all on a single screen.
The solution I used in the end was Microsoft Expression Encoder.

ASP.net - capture video with camera and play in web page

I want to capture video with webcam and play it live in my website.
I dont know what to do!
how can I do that?
With pure ASP.NET, you can't. You have several options and the only one that I am aware of in the .NET wheelhouse would be to use Silverlight (e.g. http://www.silverlightshow.net/items/Capturing-the-Webcam-in-Silverlight-4.aspx and http://forums.silverlight.net/t/145729.aspx)
Your other options would be to use Flash or purchase a third party component.
You can do this with the in development HTML5 video standards. I remember seeing a working demo of a webcam app like you're talking about in a presentation (Google's HTML can do that I think). Check these pages out for ideas/examples:
http://www.sitepoint.com/stream-your-webcam-to-a-browser-in-javascript/
http://www.iandevlin.com/blog/2012/06/html5/filtering-a-webcam-using-getusermedia-and-html5-canvas
http://www.webrtc.org/
https://wiki.mozilla.org/Platform/Features/Camera_API
If you want to display video from a single computer you control (like an old-school "webcam" page) then you'd write some local computer software (presumably using DirectShow or MediaFoundation) that captures frames from your camera and transfers them to your webserver and your page has a simple script that causes the image to be reloaded every second or so. It's not really video, but it's how webcam pages worked until recently.
Now, in 2012, you can serve video directly. You'd want to use something like Apple's "HTTP Video Streaming" where the camera's video stream (not individual frames) is saved into chunks a few seconds in length, then constantly pushed to the server. The webserver then serves a never-ending playlist that lists all of the video chunks just as they're made available, browsers then download the chunks as they're needed. This negates the need for a streaming media server (such as Microsoft's WMS or Adobe's Flash Media Server).

Save Kinect's color camera video stream in to .avi video

I want to save the video streams that is captured by Kinect's Color camera to .avi format video, I tried many ways of doing this but nothing was succeeded. Has anyone successfully done this? I'm using Kinect for Windows SDK and WFP for application development
I guess the easiest workaround would be to use a screen capture software like http://camstudio.org/.
There is also post with the same question her:
Kinect recording a video in C# WPF
As far as I understand you need to to save the single frames delivered by the kinect by into a video file. This post should explain how to do it How to render video from raw frames in WPF?.
You can use the AVIFile Windows API using interop:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd756808(v=vs.85).aspx
or you can use a wrapper like this one, done by Corina John
http://www.codeproject.com/Articles/7388/A-Simple-C-Wrapper-for-the-AviFile-Library

C# Microsoft LifeCam HD mjpeg capture

I have a Microsoft LifeCam HD-5000 webcams. According to AMCap, the camera outputs a MJPEG stream at 30fps at 720p. I want to capture each JPEG frame in a small application without doing any preview or decompression/transcoding to minimize CPU utilization to the minimum possible.
I'm a C# developer, but I'm new to DirectShow. Is there a simple way to capture the MJPEG stream frame by frame as its output from the camera in C#/.NET without decompressing it?
First of all, you might not need to use DirectShow to access your camera. Check out the OpenCV project, which has .net bindings available at opencvdotnet.
If you'd like to go the DirectShow route, then you'll need the .NET bindings, available at the directshownet project. I believe your best bet will be to create a filter graph that contains your webcam as a source filter, and a sample grabber as your destination filter. Documentation for the sample grabber is on MSDN. This will give you access to the raw data. You can also request a particular data format and use the DirectShow intelligent connect to fill in the filter graph with the right conversion filters.
That being said, I definitely recommend OpenCV over DirectShow. DirectShow is very general purpose, and probably does more than you need it to do. OpenCV can be used to quickly access your camera. Perhaps check out this stackoverflow question Webcam Usage in C# for some more information and answers.
With DirectShowNet, I could never access to a single frame and show it as Bitmap anywhere. In every project I just see converters, direct show to screen or streaming. How to capture the stream as single bitmap frames?
in the Directshow.net Download package, they have sample code and inside Capture there is a project DxSnap which connects to a webcam through directshow.net and snaps a picture from the stream. You can view it and use that as a starting place.

Categories

Resources