How do I connect to a USB webcam in .NET? [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I want to connect to a USB Webcam in .NET, specifically using C#. Being new to .NET I don't know what kind of support there is in the standard libraries for doing so. I found one example on the web that copies bitmaps through the clipboard, but that seems very hacky (and probably slow). Is there a better way?

You will need to use Windows Image Acquisition (WIA) to integrate a webcam with your application. There are plenty examples of this readily available. Here is a C# Webcam User Control with source.
Here are some more articles and blog posts from people looking to solve the same problem you are:
MSDN Coding4Fun: Look at me! Windows Image Acquisition
CodeProject: WIA Scripting and .NET
CodeProject: WebCam Fast Image Capture Service using WIA
clausn.dk: Webcam control from C# and WIA

Interesting side note, WIA isn't supported by Vista for doing Captures from Webcams anymore. They mainly targeted it towards Scanners and pulling stills from cameras.
Also, larger manufacturers like logitech have abandoned WIA is favor of DirectShow.

Here is nice example of doing this. It's using DirectShow.Net (http://directshownet.sourceforge.net/), which is propably better than using "clipboard" :D.
https://www.codeproject.com/Articles/18511/Webcam-using-DirectShow-NET

Theres a package with functions with a lot of things to do with computer vision systems called AForge. And they have an easy way to get webcam images from a USB camera if you're still looking.
Just check out the sample code for computer vision motion sensor example code. I'm sure you can pull out the function calls you need from it as I did.
[sorry to necro, but this could be of use to someone in the future]

On my computer, WIA was painstakingly sloooow... so i decided to give the Windows Multimedia Video Capture a try.
You can find a demo here.

It really depends on what you want to do. WIA is primarily for capturing stills from imaging devices, and DirectShow (used either through directshow.net or managed DirectX) is for access to fuller video features.
The other option is to create a WPF application. It has a huge amount of built in support for video (to the extent that having a looping video clip as a button is pretty trivial), and should be quick and easy to develop.

Related

Is it possible to integrate Google Earth in C# desktop application? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
For a C# desktop application I'm working on, i need (detailed / high resolution) air pictures.
I know we have Google Maps and Google Earth and some other services, and some show air images of very good resolution nowadays.
At the same time, I do not only need the images, but I need to control the zoom/rotation, and want some mechanism to measure distances in the imagery.
So what I need, is some air images API.
After some reaserch for data sources, I think the best options to get air imagery are:
Google Maps API
The downloadable desktop application Google Earth.
There are so many 'versions' of Google Maps / Google Earth. Some web based, some as a downloadable application.
I came to the conclusion that if I need the Google Maps API, and want an API key, I have to provide credit card information (even within the free quota). In the past you could get a free api key without providing credit card information. I don't have a credit card, and since it's not a commercial app I'm working on, it's going too far for me to apply for a credit card just for having access to the free quota of the API. It's a pity.
I managed to add a ChromiumWebBrowser control into my app, and embedded Google Maps in it. This means I embedded a webbrowser in my application, and loaded Google Maps into it like you would do when you just browse to maps.google.com. I could try to manipulate the javascript in my embedded webbrowser to control the maps app that's running in it, but this seems to be complex and cumbersome.
Another solution could be to use the downloadable Google Earth, if there's a plugin or something that can be controlled by my own code. This probably means Google Earth has to be installed on the computer, but that's OK.
So my goal is:
Get air pictures (with highest quality available from any source).
Creating an account/api key at some service and use some free plan is no problem, but credit card hassle to achieve this, is a problem.
Being able to not only get the imagery but also control it. Because just getting imagery can be achieved by the workaround (embed Google Maps in a webbrowser control, and hooking the webbrowser rendering).
Anyone who has experience with this, or what are the best options?
Especially if there are options to implement Google Earth into my own desktop application, and be able to control it.
You have a few options here. You can use:
Cesium
D3.js
Kartograph
If you want to go the Google Maps API route, you would have to call and process the requests by hand. You can use the C# WebRequest class to do this. You should read the documentation for the Google Maps Platform API, and you should be to send GET and POST requests with the WebRequest class.

kinect development with windows c# or c++? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm totally new to windows development.I'm coming from Objective-c but now i wanna start to develop for the solution Kinect-Windows. I have to choose between C++ and C# , one of this languages is more appropriate to kinect development? I'm inclined to C++ but i don't know if C# will made all things easier, maybe more support for kinect?
EDIT
Another question, i need to buy the Kinect window sensor ? Or to develop i can use a standard xbox Kinect sensor?
Assuming you are using the official Kinect SDK, it supports C++, C# and VB. Use the language which best suites your needs.
To answer your second question, you can use the Kinect for Windows sensor or the Kinect for Xbox 360 sensor. The choice is yours.
However, there are some notable differences. This blog post does a good job of explaining them. Below are the main features that the Windows sensors offers over the Xbox sensor, taken from the blog encase the link breaks in the future.
Near mode: Enables the camera to see objects as close as 40 centimeters
in front of the device without losing accuracy or precision, with
graceful degradation out to 3 meters.
Seated or “10 joint” mode: Skeletal tracking which provides the
capability to track the head, neck and arms of either a seated or
standing user.
USB cable: Ensures reliability across a broad range of computers and
improves coexistence with other USB peripherals.
Extended camera settings: Provides extra settings such as brightness,
exposure, etc. so you can tune it even more.
Kinect Fusion: Maps the environnement to 3D on the fly or lets you use
object replacement.
Handgrip: Hand detection enables you to implement gestures like
pinch-to-zoom, grab, etc. to improve your apps and build whole new
kind of applications.
Licensing: When you want to go public with you’re application you’ll need to use a Kinect for Windows. Kinect for Xbox 360 isn’t legal.

How can I learn a DirectShow programming? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm a .Net C# Developer. I want to develop the media programming about video/audio codec, capture media from source, etc. I'm going to use the DirectShow Lib, but I read it on MSDN, and I'm very confused, because I'm a beginner.
Do you have the best tutorials or some article that can make beginner understand to program in the DirectShow architecture? If so, please share them.
You will find these useful:
http://www.codeproject.com/KB/directx/PrgmngDirectShowappsCS.aspx
http://www.codeproject.com/KB/directx/directshowmediaplayer.aspx
http://www.codeproject.com/KB/directx/directshownet.aspx
http://www.codeproject.com/KB/directx/MPEG2_Capture_Device.aspx
Oh and these too:
http://www.codeproject.com/KB/audio-video/dshowencoder.aspx
http://www.codeproject.com/KB/directx/rendering.aspx
http://www.codeproject.com/KB/windows/samplegrabberfilter-wm6.aspx
http://www.codeproject.com/KB/audio-video/Tanvon_DirectShowFilters.aspx
Hope that helps.
Regards
Richard
Dude, IMO It's better develop direct show in C++, you just should learn how to create COM object and uninitialize it, C++ is faster, and current available library of direct show all are in c++, cases which are in code project in c# are good for learning basic of direct show, but they aren't practical solutions. they are COM wrapper to use them in C#, the speed is main concern and their speed in real time video analyzing is not good. the MSDN is best reference for working with directshow and there are good samples in SDK
Just read DirectShow SDK in MSDN from beginning. Then install GraphEditPlus, try building some graphs and then from File menu you can generate C# code which builds these graphs using DirectShowLib for .NET and see how it does it.

Looking for a good Dynamic Imaging Solution [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I work for a small E-Commerce shop and we are looking for a process that will handle resizing our product images dynamically. Currently our designers take high resolution photos, either provided by the manufactures or created in house, and alter them to fit various pages on our site. The designers are constantly resizing, cropping, altering compression levels, etc., of each product photo to fit the needs of the business. Being that our product line is updated frequently, this becomes a monotonous task.
Abobe Scene7 does exactly what we are looking to do and the images are served up from a CDN. Unfortunately we found it to be too expensive.
I'm curious to learn how others handle this process at their organizations. Does anyone know of any good 3rd party tools or other SAAS providers that can handle performing some basic image manipulation and serving them on the fly?
A lot of what you describe can be accomplished using components available in the .NET framework.
We've used the COM version of ImageGlue with great success and found it to be very stable and effective. When someone uploads an image through our admin site, I use ImageGlue to generate a thumbnail and resize the image before storing it. You could also do that dynamically by having your image tags refer to a url like
<img src="/services/image?id=1231231&w=200&keepAspect=1">
and have the Image page or service generate the image and stream it back to the browser.
This doesn't address issues like content delivery networks, but it's relatively inexpensive and might get you pointed in the right direction.
The ImageResizing.Net library offers Amazon CloudFront-compatible dynamic image resizing - you get instantly resized dynamic images, and the scalability and responsiveness of edge caching.
While the core library is MIT-free, the Cloud bundle costs $99 (but includes source code and redistribution rights).
There isn't a hosted service version yet, but there may be soon. Vote for the idea if you want it quicker.
-- The Author
Uploadcare is an IaaS solution for uploading images directly to the CDN, and crop, resize and transform uploaded images using URL commands:
https://uploadcare.com
For example, here is the full version of an image (which is quite heavy, 4034x2672px):
http://www.ucarecdn.com/6fdab0d5-5a07-4b34-8a3a-f61727972745/full.jpg
And here is a cropped and resized one:
http://www.ucarecdn.com/6fdab0d5-5a07-4b34-8a3a-f61727972745/-/crop/1000x1000/1300,1600/-/resize/300x/tree.jpg
More info: https://uploadcare.com/upload-api-cloud-storage-and-cdn/#crop-resize-and-transform-uploaded-images
Note: I am a co-founder :)
Webqem is an Australian based company that offers a SAAS solution to dynamic imaging at a very competitive rate.
Check out the website at http://www.maxoom.com.au, there are a number of videos showing how functions within the service work.
The easiest has to be http://getthumbsup.com. We use it in conjunction with imgur sideloading feature http://api.imgur.com/resources_anon#sideloading flawlessly and effortlessly.

Plotting with C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
C# seems to show some promise for scientific computing, but I found very little about one plotting 2D graphs, which is very important both for science student and scientists.
Is there a reliable, free, way to create publication quality 2D plot with C# ? And the capacity to save to several formats (png, eps, ...). Something similar to Python's matplotlib ?
There is OxyPlot which I recommend. It has packages for WPF, Metro, Silverlight, Windows Forms, Avalonia UI, XWT. Besides graphics it can export to SVG, PDF, Open XML, etc. And it even supports Mono and Xamarin for Android and iOS. It is actively developed too.
There is also a new (at least for me) open source .NET plotting library called Live-Charts. The plots are pretty interactive. Library suports WPF, WinForms and UWP. Xamarin is planned. The design is made towards MV* patterns.
But #Paweł Audionysos suggests not such a good performance of Live-Charts WPF.
ZedGraph is a good choice.
See Samples Environment for Microsoft Chart Controls:
The samples environment for Microsoft Chart Controls for .NET Framework contains over 200 samples for both ASP.NET and Windows Forms. The samples cover every major feature in Chart Controls for .NET Framework. They enable you to see the Chart controls in action as well as use the code as templates for your own web and windows applications.
Seems to be more business oriented, but may be of some value to science students and scientists.
gnuplot is an actively maintained program widely used in the scientific community. Normally plots are generated from data files which you can write out in your C# program, but it is also possible to call the gnuplot executable from C# and display the generated image in a C# picture box.
I started using the new ASP.NET Chart control a few days ago, and it's absolutely amazing in its capabilities.
Here is the link.
EDIT: This is obviously only if you are using ASP.NET. Not sure about WinForms.
I just wanted to supplement MajesticRa's recommendation of OxyPlot, and point out how OxyPlot can be used for a variety of plotting cases. The software is free and Open-Source, very polished, and allows for a variety of uses beyon normal 2D mapping.
I've been using OxyPlot for an unorthodox project, where I display (in WPF/C#) a map (Robotic Occupancy Grid) which I could overlay with LineSeries (Path Traveled) and PointSeries (Way Points). Using the OxyPlot ImageAnnotation feature I am able to display 60Hz Video within my OxyPlot, by periodically updating the ImageAnnotation on its own thread, while mapping Series of points overtop the video. The background video and points are even scalable and translatable.
Hopefully this is helpful for other looking to display plots overtop of images and videos.
NPlot is a pretty good simple open source 2D plotting API. Unfortunately, the web site is down. I don't know if this is just temporary or not. I haven't heard of any bad news. It may come back up.
http://www.nplot.com
Here is an article describing it:
https://web.archive.org/web/20210612110405/https://aspnet.4guysfromrolla.com/articles/072507-1.aspx
The previous article uses VB.NET, but obviously this will work with C#.
Again, not sure why nplot's site is not currently working but it is a somewhat popular plotting API that I've used in the past. I post it for your information and in case of the likely event nplot will be back up soon. :)
Edit:
Thanks to a Hosam Aly, it looks like the SourceForge project can still be accessed here:
http://sourceforge.net/projects/nplot

Categories