How to take a photo without preview. Android. Xamarin. C# - c#

I have a sample code from xamarin.com:
How to click the Button and take a photo without preview?
Maybe you have an articles, or videos. I'm new at Xamarin, so it will be awesome, if i'll get as more details as possible.

This article will get you started with a stream of the camera to a surface in your app. It shows you how to get to the Camera class, which in turn has a TakePicture method that you could use for your problem.
Please also take a look at this answer on SO on a similar question (native Android, but the same concepts apply), which suggest showing the preview on a 1x1 surface because you can't really prevent the preview on Android as far as I know.
PS: don't forget to add the correct permissions in your manifest for Camera access.

Related

Avoid OK Retry button for Xamarin Camera

I am using the Camera code base from
https://github.com/rasmuschristensen/XamarinFormsImageGallery
to open camera, take picture and show in the gallery. In the droid project, after taking the picture, the dialog asks either to keep the photo or discard it using OK and Retry button. Is there anyway, I can avoid this step and go to next step.
Regards
Using the Media plugin you won't be able to do it. This plugin use the standard way of capturing photos in Android which rely on the device actual camera app. The save/retry functionality is part of the Camera App and we don't have access to it as this will be different between Android "providers" (Samsung, LG, Sony, etc)
One way to avoid this is capturing the photo within your own app using the SurfaceView and not using the camera app. I found this example but unfortunately is written in Java but I think it's not too hard to translate into Xamarin/C#.

How to use the Media Viewer in a WP8 app

I'm trying to add a media viewer page on my app (very similar to the photo app on WP), so my first idea was to open a new Pivot Page with one photo on each page, but it overload the memory when there is to much photos and I don't have the zoom in / zoom out fonctionnality.
Then I found this cool example provided by Microsoft who do exactly what I wanna do :
http://code.msdn.microsoft.com/wpapps/Basic-Lens-sample-359fda1b
The problem is, I've tried many things, but I can't get it to work. Do you have any idea how I could use this cool Media Viewer ? What classes should I import? How to implement it in my project?
The Media Viewer class is indeed not that simple!
I've also started to tweak it so it would fit my purpose, the solution isn't finished, but you can already take a look at it here: https://github.com/Depechie/ImageSliderMediaClass
I changed the class so that it would act as one horizontal image scrolling overview, without the zooming capability.

Metro MediaCapture MFT Effect Explaination

I'm trying to apply an effect on a mediacapture stream for a WPF app I'm porting over to Metro. In the WPF app I used Pixel shaders to modify a bitmap whose source was set to the stream of a webcam, but since effects have been dropped for Metro I'm looking for an alternative solution.
The best, and most Metro standards compliant, way of doing this that I've found is building my own MFTs and adding them to my MediaCapture element via the addEffectAsync() method. I've downloaded the MFTGrayscale and MediaExtension examples which show how to apply these effects to a MediaCapture element, but I'm having an issue understanding the actual C++ MFT code. Can someone point me to or give a decent walkthrough/explanation of how I'd go about building my own MFT effect from the ground up? I don't know too much C/C++, just enough to understand some of the example code. I'm really having trouble with the conceptual and architectural aspects of MFT, and hence am very confused by the source code.
Your help is very much appreciated.
EDIT:
Another option I'd consider is using SharpDX. However I'm having issues getting a stream of the MediaCapture object to display on a xaml image element. Any help would be appreciated. Thanks.
You should absolutely have a look at the following git repo: https://github.com/mmaitre314/VideoEffect
It shows how to apply image effects from the Lumia Imaging SDK, Win2D, and DirectX HLSL pixel shaders to videos in Universal Store Apps for Windows Phone 8.1 and Windows 8.1.
Effects can be applied via MediaTranscoder, MediaComposition, MediaCapture, or MediaElement. And the binaries are available via NuGet.
I ended up getting answer on the MSDN forums. It's not an ideal answer, but it's what I'd been fearing all along.
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f3a6934e-df7a-44da-bfd8-7b95d494ff43/#90690f89-e57d-4043-9881-60fcc587f736
This is totally doable... I've just rewritten one of the MF transforms from the samples to use the Nokia Imaging SDK and apply filters in real-time to webcam video. You can see how I did it at the link below (plus download some source code). It's not exactly what you need to do, but in the wiki page I explain what you need to change from the boilerplate sample that MS provided.
http://developer.nokia.com/community/wiki/Template_universal_app_for_video_recording_with_MediaCapture_using_Imaging_SDK_Filters

Image gallery swipe UI in MonoTouch

I am looking to create a UI experience almost identical to swiping through images in the Camera Roll on the iPhone. I have 5 images that I simply want to be able to swipe through. This view will be the first view of a Tab Bar Controller that I have in place. This is my first iPhone (iOS) app attempt so if anyone feels this question needs to be broken down into smaller chunks, please let me know.
Here's an example of the paging control for MonoTouch I developed some time ago: https://github.com/escoz/monotouch-controls
Take a look at the PagedViewController. That code is actually used in my app, Quicklytics.
Use Pagecontroller.
In this example they have add label, instead of that you add your imageView.
EDIT:
For Monotouch.
The Photos module of Nimbus is exactly what you are looking for.
http://docs.nimbuskit.info/NimbusPhotos.html
The MonoTouch bindings can be found here.
https://github.com/theonlylawislove/MonoTouch.Nimbus

Using webcam's button in my own program

My webcam has a button, with which you take a photo of current frame
when using it's original software what came with it when I bought it.
Is there any way to use that button to take photos in my program.
I would be using C#.
I was thinking of using Windows Image Acquisition (WIA) or avicap32
for using webcam in my software.
Any help would be appreciated. Where do I start?
EDIT:
I see that you didn't understand me. I need to know if my phisycal camera button is pressed.
I am using DigiMicro 1.3 camera (Manufacturer is DNT), which isn't really a webcam but a USB microscope, but
it behaves like a webcam.
Does the camera actually require that the software be running when you press the button? I know some webcams implement this feature at the driver level. If that's the case, I don't think there's much you can do without interacting directly with the USB port, which would be incredibly difficult and likely not worth the trouble. I can't find any technical documentation on the vendor's website with that kind of information.
The "MicroCapture" software doesn't come with any DLLs that have exported functions, so P/Invoking doesn't appear to be an option. Unfortunately, I can't get the driver installed, so I can't check if it comes with any P/Invoke-able DLLs.
Sorry, but since there's no standard interface for that kind of functionality and the vendor doesn't provide any specific information on it, I don't think this is possible. I would suggest contacting DNT directly about it. They may have some component that will do what you need.
This Coding4Fun post guides you through pretty much everything you need to do to get started using WIA, including adding the reference to a project, displaying the select a device dialog, and of course actually taking the picture :P.
Coding4Fun - Look at me! Windows Image Acquisition
I suggest that you take a look at the DirectShow.NET library. It has great functionality for capturing images/videos off connected devices. It also comes with several samples to get you started quickly.

Categories