Testing WIA without having a scanner/camera device - c#

I wrote a simple scanning code using WIA. I don't have a scanner device so I can't test it. Can I simulate a WIA device to testing it ?

This does definitely what you want: https://github.com/twain/wia-on-twain
I simulates a scanner and publishes a TWAIN and a WIA interface. Also the scanning of a graphical page is simulated, so you can try out different resolutions and colour schemes.

Not sure, but maybe http://scanworkssoftware.com/twainimporter.aspx will help you
or, Go to http://twain.org and under the "Fast Find" section click the last link titled "Sample Data Source & Application". This will install TWAIN 2.0 and a sample source named "TWAIN2 FreeImage Software Scanner" which has some basic scanning features. It does not have a driver interface but will let you preform scans and Get/Set some general properties.

With enough effort and the WIA SDK (and probably the Windows DDK as well) you probably can. But it will be a large amount of effort, especially compared to the price tag of a cheap scanner.
I'm assuming your time is worth something. If this is a hobby project, then compare the price of a cheap scanner to the time saved that can be spent working on the fun parts of the project. If this is a work project, then the time saved is more valuable to your customer than to you, but there should still be business case for buying hardware that will save more time than it cost.

I know this question is very old, but I'll post this as a reference.
Since Windows 10 Microsoft has made a GitHub repository with sample drivers, including the WIA ones:
https://github.com/Microsoft/Windows-driver-samples/tree/master/wia
I wasn't able to test them yet, but they should create a test device.

Well, try if this virtual webcam supports the WIA interface: http://www.soundmorning.com/
If so, you are all set and ready to go.
You can also search for "Fake webcam", there are many versions.

One thing to be concerned about is that all WIA drivers are not created equally. We recently had trouble using some Brother WIA drivers that were supposedly certified. The driver would not allow access to the feeder tray. We ended up having to write TWAIN integration also.

(1)
http://graphics.kodak.com/docimaging/US/en/Support_Center/Document_Scanners/Desktop/i65_Scanner/Support/Drivers_And_Downloads/i55_and_i65_Scanner_Driver/index.htm
InstallSoftware__v1.7.exe
(2)
http://sourceforge.net/projects/twain-samples/files/TWAIN%202%20Sample%20Application/
WIAonTWAIN_SDK.msi
(3)
For testing only you can also use the free demo version of the commercial file import TWAIN driver XPCTWAIN.
Product info: http://www.jse.de/products.html#xpctwain
Demo download: http://www.jse.de/download/setup_xd.exe
setup_xd.exe

Sounds like an occasion where writing the virtual device that is WIA compat might be the thing that needs to be given back to the community.

Related

Extract gps data storage

I am using dotSpatial labrary in c#, I only can read realtime data.
but my problem is this.. how could I extract gps data storaged in my usb-gps device (it is passive gps)?
device information
brand : landairsea
Model: Gps Tracking Key
webPage: http://www.landairsea.com/gps-tracker/gps-tracking-key
From looking at their user guide:
http://www.landairsea.com/downloads/past-track-10.pdf
You could use the past-track software to save the stored data as .las format.
I believe that DotSpatial has a LIDAR plug-in that can read .las files:
Dotspatial.Plugins.LiDAR
If you are asking how to write a C# replacement for the Past-Track program that connects directly to the USB however, I don't know exactly.
DotSpatial has a positioning library that is DotSpatial.Positioning that was originally ported from http://geoframework.codeplex.com/. It is possible that this utility will have the capability to connect to your device, but I think it would probably only support a limited subset of GPS devices, and I never used it myself at all.
Hopefully that information is a little helpful though and will point you in the right direction.
Edit:
I have downloaded the Past-Track 10 software that is designed to retrieve data from the unit. This in turn installed Antaris4 and u-blox5 USB drivers. I think this is half of what you will need to write a C# app that can talk to your GPS and do things in code. You can find the drivers on the web. I think I found it here:
http://www.driverguide.com/driver/detail.php?driverid=1869444
But make sure you find a version of the driver that matches your PC configuration (32/64 and correct operating system). Incidentally, that will probably mean you will need to make x86 and x64 builds for your C# app.
The next step is to find some documentation for it and then attempt to use the drivers from C#. So far I haven't found a good document showing how to work with the drivers, but I'm sure it exits. I will update with a link when I find it.

.NET BarCode Reader in WPF

I am trying to see whether its possible to read the barcode in WPF Applications without using any 3rd party tools. We built an application using WPF and they are not willing to buy any third party devices to read the barcode. Is there any other way to read the barcode data in WPF Applications using .NET APIS?
Note: I seen examples in .NET, but most of them using Barcode reader tool. I have seen examples in Android ZXing library does that with out any tools like barcode reader or scanner.
Any ideas or thoughts is greatly appreciated.
Thanks,
Ramesh
In order to shorten the discussion in comments and possibly help other people with similar problem, I will summarize it here.
It is not clear to me whether the real question you wanted to ask is "does .NET provide barcode reader class". If so, the answer is no.
Now, since WPF application is just a normal .NET application, for sure it is possible to implement barcode reading without 3rd party libraries. All the algorithms are public, there is plenty of open source implementation which can serve as reference, and .NET provides all you need to talk to the peripherals, acquire the image and analyze it. You "just" need to code it.
E.g. there is a C# port of ZXing, so you can take a look (though it looks like automatic translation from Java, so I wouldn't expect much idiomatic C# in there).
You also mention that your customers "are not willing to buy any third party devices". I am not sure if 'devices' was meant to read 'libraries'. If so, there are open source libraries which they (or you) don't have to pay, and commercial components usually provide royalty free licenses (e.g. the first one that google showed), which means that only you have to pay the development license, but your customer doesn't even know about it.

SilverLight: How to record a video from a web camera

I have searched how to use SILVERLIGHT to record video for days but got no luck.
Most articles related to SL only talk about how to record audio or snap a picture rather than recording a video file and save it somewhere.
And I found there is no resources about it on Internet(I am surprised!!!)!
So could you provide me an example code with proper explanation?
I am waiting for it.
PS: I do not want to use Flesh as none iPhone nor iPAD supports it.
Thanks
Fortunately, Mike Taulty's source code can easily be updated to work with Silverlight 5. You can download the fixed source code and try it out (Disclaimer: all code courtesy to Mike Taulty, I merely fixed SL5 compatability and ran a cleanup). Use your favorite diff tool to see the changes I made.
I have tested it, and it generates video files that can be viewed in VLC media player (after selecting build index to fix the corrupted index). As the file format is not 100% correct, the files can not be opened in Windows Media Player etc... but I'm sure that can be fixed.
You should, however, be aware of the fact that Silverlight is not supported on iPhone, iPad, Android, and Windows Phone (Windows Phone apps are made on a special version of Silverlight, but can not run Silverlight applications in the browser).
Unfortunately, after undergoing hundreds of hours researching on the possible solution, I finally found the answer in a book called: Pro Silverlight 4 in C# (Matthew MacDonale, APress).
According what is said on the page 436, although you can do it with Silverlight 4 (you have to write your own file header helper, store the row data as byte arrays and later on you have to convert them into a raw video data and what is worse is the audio and video are separated.), it is just not practical and worthy to do it. Because it requires reams of complex, handwritten code to convert it, and the conversion process is computationally expensive, which makes it extremely difficult to do in real time.
So I guess this would be the conclusion of my question. Now what seems still make sense for me is to find out why Microsoft doesn't support it and what is the new technology which is going to be used/ has been used to replace the SL.
Is it HTML5? But as far as I know, there is only a video tag in HTML which can only be used as a video player, but no tag to support to get the access of a web camera and save the captured video+audio at the same time as one file onto somewhere which could be a local hard drive or a network storage.
I hope all dear you could come up with some thoughtful advice.
I am going to leave this question un-answered for a few days to see whether there could be someone who can come up with some fantastic solution.
Thanks again.

Face detection for C# in ASP.NET

I'm looking for a specific form of facial recognition. I want to detect where all the faces are located (and that's all) on an image of students in a class-picture.
So in other words, I'm not trying to compare two faces and see if they match either.
How can I do this in C#? I can't seem to find any open-source projects on NuGet regarding this, and I've looked on CodePlex too.
My personal preference for any Computer Vision related needs is to use http://opencv.willowgarage.com/wiki/ , however, it isn't natively made for C#.
However, after a quick Google search, I found http://www.emgu.com/wiki/index.php/Main_Page which says "Emgu CV is a cross platform .Net wrapper to the Intel OpenCV image processing library. Allowing OpenCV functions to be called from .NET compatible languages such as C#, VB, VC++, IronPython etc. The wrapper can be compiled in Mono and run on Linux / Mac OS X."
Now that Face has retired since it was purchased by Facebook, I use Sky Biometry, which has a C# .NET API and is free.
It's cloud based and obviously requires an Internet connection, but who cares.
I recommend checking FaceRecognition.Net (https://github.com/takuya-takeuchi/FaceRecognitionDotNet) that is base on Face Recognition (https://github.com/ageitgey/face_recognition) that is implemented in Python. Both are Open Source with MIT license.
Another option is Cognitive Services – Face that is from Microsoft and you can use it from Azure directly or from a local Docker. Here you can find more about it: https://learn.microsoft.com/en-us/azure/cognitive-services/face/

What is a good api for mapping gps coordinates in c#?

I have a project that has a list of gps coordinates. I would like to find a way to make a simple map of those coordinates (possibly just one at a time). The map should have basic street info.
This part of our project is pretty simple so I don't think it needs to be an exceptionally feature rich product. This also means it shouldn't be really expensive.
What is a good product to achieve this?
edit: This is a desktop app where internet connectivity will probably not be available.
Google Maps is great for this.
If this is a desktop app with internet access you could still host an IE control and show it there.
EDIT: If this is a desktop app without internet access you'll have to buy something like Microsoft Streets & Trips. I don't know if it has reusable controls. You probably have to buy something more expensive to get that. Applications of this nature often fall under the category "GIS". Try searching Google for that.
Sharpmap is open source project written in C# and released under LGPL. To quote first line from page:
SharpMap is an easy-to-use mapping library for use in web and desktop applications.
I'd go with this solution
Map Rendering: SharpMap
Geometry operations: NetTopologySuite
Map data store: shapefiles in your file system or PostGis over PostgreSQL
Map data itself: the easiest way may be extracting from OpenStreetMaps data. Here, for example you can download shapefiles for your desired location
Everyting is open source (more or less, check the licenses) and works fine on windows.
Hope it helps
ESRI has an API. They have javascript, silverlight,wpf, and flash. they may have more. ESRI is pretty much the standard in mapping.

Categories