mmaitre314/VideoEffect

Barcode Detection in Windows 10 Phone Application

henrikselin opened this issue · 11 comments

Hi,

I am in the process of trying to get together a barcode reader as a proof of concept using a camera device on a phone running Windows 10 (Or rather one of the preview versions from Windows Insider) and I came across your project.

Given that it implements the ZXing library and that it is the only such implementation that I could find that worked well on 8.1, made a bit of an attempt to update it in order to see if it was feasible, but I was unable to get it to work

Have you given any consideration to what would be necessary to do in order to make the project run with Windows 10?

Not yet, in part because in win10 a good chunk of that library is obsolete. The OS added IBasicVideoEffect which enables most scenarios. You should be able to use that to get SoftwareBitmap from the camera preview video stream and then get a byte buffer to pass to zxing. One thing missing is down scaling to a smaller resolution (say 640x*), but you should be able to get started without that.

This did indeed seem to be the way to go. Thank you for the pointer :)

Hi mmaitre314, I am unable to use VideoEffect on Windows 10 anymore, I tried to use IBasicVideoEffect but I can not figure out how to change the output framesize for cropping effect, could you help me?

Changing the resolution might indeed not work with IBVE. I'll check when I am back from vacations in a week. In the mean time, to use the VideoEffects lib in Win10 apps the simplest is likely to fork the code, remove the NuGet package from your solution and add VideoEffect as a new project.

IBasicVideoEffect expects the same resolution in and out, so you won't be able to use it easily for cropping. There is a new VideoTransformEffect though that you can use (I believe on either MediaCapture or MediaTranscoder) that should make cropping very easy (as well as scaling, rotation, etc.).

Date: Sun, 16 Aug 2015 10:00:24 -0700
From: notifications@github.com
To: VideoEffect@noreply.github.com
Subject: Re: [VideoEffect] Barcode Detection in Windows 10 Phone Application (#15)

Changing the resolution might indeed not work with IBVE. I'll check when I am back from vacations in a week. In the mean time, to use the VideoEffects lib in Win10 apps the simplest is likely to fork the code, remove the NuGet package from your solution and add VideoEffect as a new project.


Reply to this email directly or view it on GitHub.

Right, I forgot about that one. It is GPU accelerated, so it should be much faster than the VideoEffect crop. On VideoTransformEffectDefinition it looks like the CropRectangle and OutputSize properties need to be set. Besides that it should be a drop-in replacement.

I will check it out and report the results. Thank you all.

Sent from Outlook

On Tue, Aug 18, 2015 at 11:33 AM -0700, "Matthieu Maitre" notifications@github.com wrote:

Right, I forgot about that one. It is GPU accelerated, so it should be much faster than the VideoEffect crop. On VideoTransformEffectDefinition it looks like the CropRectangle and OutputSize properties need to be set. Besides that it should be a drop-in replacement.


Reply to this email directly or view it on GitHub.

VideoTransformEffectDefinition only works with MediaTranscoder. It crashs MediaComposition and has no effect over MediaCapture.

As an observation for anyone that reads up on this thread, and then attempts to implement this as such: I was unable to get the above to work properly without implementing the Interface mentioned above (IBasicVideoEffect) in a separate project, which in turn was set up as a Universal Runtime Component. Anything else that I tried gave me an exception of the "Class not registered" variety

This leads me to a question, in case anyone feel inclined to answer. Do you have any good ideas regarding how to report back the string value that is detected to the main application? The interface contains a public enum MediaEffectClosedReason which I am able to use to tell the application that a barcode has been found, but I have not been able to send the actual value detected so far. If anyone has any nice ideas, then I am certainly listening

Hey Henrik. You can do this quite easily in IBasicVideoEffect using an IPropertySet that is passed in to the effect and can be used for two-way communication like you want. I have an example of doing this (2-way communication) in my media-contrib repo.
Relevant links: - SaturationEffect: https://github.com/jolson88/media-contrib/blob/master/Examples/ExampleEffectsLibrary/Effects/SaturationEffect.cs)- MainPage.xaml.cs (usage of SaturationEffect): https://github.com/jolson88/media-contrib/blob/master/Examples/CustomEffectsWithCapture/MainPage.xaml.cs
Date: Tue, 25 Aug 2015 00:37:27 -0700
From: notifications@github.com
To: VideoEffect@noreply.github.com
CC: jolson88@outlook.com
Subject: Re: [VideoEffect] Barcode Detection in Windows 10 Phone Application (#15)

As an observation for anyone that reads up on this thread, and then attempts to implement this as such: I was unable to get the above to work properly without implementing the Interface mentioned above (IBasicVideoEffect) in a separate project, which in turn was set up as a Universal Runtime Component. Anything else that I tried gave me an exception of the "Class not registered" variety

This leads me to a question, in case anyone feel inclined to answer. Do you have any good ideas regarding how to report back the string value that is detected to the main application? The interface contains a public enum MediaEffectClosedReason which I am able to use to tell the application that a barcode has been found, but I have not been able to send the actual value detected so far. If anyone has any nice ideas, then I am certainly listening


Reply to this email directly or view it on GitHub.

Added reference to IBasicVideoEffect in the Github doc.