Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need help to make my program. I have developed a form in C# that only has a textbox and a button to take a photo using the webcam and save it in the file path specified.
So I need a method to start the webcam, take a photo and save it in the file path and close the webcam immediately. No need to see what the webcam shows, just take the photo very fast and save it.
Any idea how I can do that? All comments are welcome. Thanks in advance.
Windows APIs to access a webcam are native, but you can use well known wrappers:
First, DirectShow.NET's DxSnap sample
Use DirectShow to take snapshots from the Still pin of a capture
device. Note the MS encourages you to use WIA for this, but if
you want to do in with DirectShow and C#, here's how.
Related on StackOverflow:
Photo and video with webcam using DirectShowLib-2005
Capturing frames from webcam using DirectShow.NET
DirectShowLib - Can't take more than one picture with webcam. Got "Insufficient system resources exist to complete the requested service" error
DirectShow Library-How to capture image using directshow library without showing the webcam live images on the PictureBox or Panel
Capturing a photo on x86 Atom Windows 8, DirectShow
Second, Media Foundation.NET which wraps Media Foundation API
See How to grab constant stream of bitmap images from webcam in c# for related references
Then, other libraries, that eventually wrap mentioned above APIs (including referenced by links above)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to develop code to read out positional data from a picture thats been loaded into the program.
F.E. : Imagine a picture with houses (red squares) connected with lines.
Now what i would need are the posotions of the houses and the lines in such a way that i can use that data and do more with it.
So : - Load Jpg (f.e) into the programm
- Read the picture and save postions
- Be able to work with the saved positional data.
My issue is that i struggle to find the right way to google this. Is it's as difficult as machine learing or is there a more simple way to solve this?
No need to get it explained, but more a place where i can start research this myself would be awesome!
If you want to find contours, you will be interested in Hough Transformation. Check the image on the bottom.
I recommeng getting a hang on OpenCV image processing library (more specifically the EmguCV which is a C# wrapper of OpenCV). It has a fairly big community and it's a project working for ages.
Generally contour recognition and line recognition algorithm are a good shot. You could add opencv to the search phrase.
If you want to detect lines, Canny edge detection would be a nice shot. Once again I recommend OpenCV for this task.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm playing around with the YouTube Live Stream API. That's working fine so far, but the next step is to stream the web cam data to YouTube via RTMP.
In the (excellent) documentation at Google Dev, it outlines the Life of a Broadcast. However, all steps are documented in detail, except the step I'm interested in:
Step 3.2: Start your video
Start transmitting video on your video stream.
I was able to use Open Broadcasting Software to stream to a manually created YouTube Live Event, but I have no idea how to do it from my Windows 10 App. I've looked at the MediaElement class, and was able to capture the web cam preview in my app. But I can only find methods to save as a file.
Also found information about FFMPEG, which should probably be able to do the job, but I cannot find a library / DLL to use FFMPEG in my App.
I just need some guidance where to look next, because now I'm just clueless what to do.
/edit: I came across MPlatform SDK, which sounds exactly what I want, but it costs $5000.... Not for a hobby :(
So, as you mentioned, FFmpeg does indeed support streaming (output) over RTMP. I'm not sure what you're trying to stream, since depending on that, the solution will be slightly more or less complex. Two basic cases:
if you're trying to stream an existing file or something from your screen, you can simply use ffmpeg as a command-line executable in your c# application.
if you're streaming custom bitmap data, it's a little bit more complex and you'll have to manually invoke libavformat/libavcodec.
So, first, get some Windows builds of FFmpeg, e.g. from zeranoe. If you're going to go route 1, just call ffmpeg.exe in your application and you're done. If you want to go route 2, load the relevant libraries into your project and follow tutorials about writing files using libavcodec/libavformat. I can give more details if you tell me what data you want to write. Then, just use either approach to open a rtmp:// output stream, and you should be good to go. (Use h264 as video codec and aac as audio codec, and make sure your build has x264 support, which zeranoe does.)
Just like #Ronald and #rogerdpack have stated - ffmpeg is probably your best bet.
Assuming you want to both capture and process the video before publishing it up to YouTube, take a hint from other pro software.
The live streaming application VMix which I am pretty sure is also written in .Net/WPF uses the following approach:
Captures the video stream using the windows DirectShow library Or any other method they support (They have many source types)
Processes the video internally using whatever filter they need - But basically they just manipulate frames / audio samples
Present the result A/V data stream as a virtual DirectShow capture device
Spin up ffmpeg as an child windows process with command line switches pointing it to capture from the virtual device and directing it to publish to whatever RTMP server
If you can get away with just using VMix - Go for it, It's quite cheap for it's basic edition. That's what I did anyway going the same path as you did.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to record video and audio, from the user's system using asp.net and save on the server.
Is there any simple solution?
I see this link Code to record from webcam or default video and audio devices in asp.net? but this is for Video Recording , i need just voice recording.
To record sound from a microphone in a web browser you need to use the getUserMedia() JavaScript API. However, this is a somewhat new API that still might change and as far as I know there is no support for this in Internet Explorer and Safari today.
Another option is to use a plugin. Both Silverlight and Flash will allow you to record sound from a microphone but this constrains you to another set of browsers.
Even if you combine both solutions, e.g. use getUserMedia() in Chrome, Firefox and Opera and Silverlight in desktop Internet Explorer and Safari you will not be able to record sound on an iPad with Safari.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to start a web project in which:
User first signs up.
Uploads his desired favorite image to website.
Selects which action, filter, plugin or even photo editing feature he wants to be applied to the image and the solution came to my mind is automating Photoshop, I mean user submits his request to the server and server opens up Photoshop and automatically applies the desired operation through Photoshop to the image uploaded by user and saves and returns back the result to the user.
Now the problem is that how can i do so and automate Photoshop through ASP.NET or PHP.
Any solutions appreciated.
The very first thing you need to check out is Adobe's licensing on using Photoshop in this fashion.
Once you've addressed any licensing concerns, it would be fairly straightforward to automate. You need to write the actual photoshop automation part using Adobe's ExtendScript (a flavor of javascript) to do the image manipulation you want. If you include the line '#target Photoshop' at the top of this script that should take care of making sure Photoshop is automatically launched when you execute your script from ASP.NET or PHP.
Chances are you'll want to pass parameters to your scripts - and the only way I am aware to do this would be to write them to a parameters.xml file in a predefined location so that the script can read them in from there. I do not think you can supply them directly when you call your script.
You won't have a good way to tell when Adobe is finished with the image. The best thought I can come up with off the top of my head is to predefine an image drop location and have ASP.NET/PHP poll for the resulting image occasionally. Depending on what you are doing, and what size images the manipulation could take a significant amount of time - you may want to come up with an alternative solution.
ETA: From .NET you can also automate photoshop more directly via its COM interface. You'll need to do a bit more research to get it working, but this link should get you pointed in the right direction.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I have an WPF application that starts a live tv recording using Windows Media Center, using the Windows Media Center SDK, waits 2 minutes and then plays the currently recording file (.wtv) in a WPF MediaElement. The problem is that the video visual will freeze and it is not consistent on when it happens. I have looked into it and discovered that the timeline is still moving so the MediaElement still thinks that the video is playing.
This happens only when trying to play a video file that is currently being recorded, previously recorded shows play just fine. Both Media Center and Media Player can play those files without any hiccups; it is only the WPF MediaElement that has this problem. Any help would be appreciated.
My guess is that the way the media element works is that it grabs the size of the file it's about to stream at the time you first play it and gets stuck after that. It's just a guess but I have no other information to go off of.
I do know that the MediaElement is really good at switching streams and resuming in those streams. Perhaps there is a work around you can find where every so often it will refresh the stream and resume from it's current position.
This sounds like an MS bug.
You could possible set up an HTTP proxy for the wtv file, then tell the MediaElement to play the stream and not give it the actual size. Its a lot of work but may just work.