I am making windows phone app using nokia imaging sdk and example of app is this real time blend demo
I am trying to capture image with Image overlayed image i.e image with other image in top of it as in above example in live camera stream below is code i am trying to capture image with effect
CameraCaptureSequence cameraCaptureSequence = App.Camera.CreateCaptureSequence(1);
MemoryStream stream = new MemoryStream();
cameraCaptureSequence.Frames[0].CaptureStream = stream.AsOutputStream();
await App.Camera.PrepareCaptureSequenceAsync(cameraCaptureSequence);
await cameraCaptureSequence.StartCaptureAsync();
stream.Seek(0, SeekOrigin.Begin);
MediaLibrary library = new MediaLibrary();
library.SavePictureToCameraRoll("picture1.jpg", stream);
but the above code only saves image without effect, so how to capture images with live blended effects from camera.
Basically what you have to do is attach the same effects/filters that you had in the preview to a new image source taking the captured photo stream instead. And probably use a different renderer too.
Either that or set up a duplicate set of filters for the capture. There are reasons to, you could e.g. configure lower quality effects in the preview to help performance.
Related
So I am using Azure Cognitative Services, more specifically the Image Analysis service trying to get the colors for an image.
My problem is that the majority of my image is transparent so if I encode it as a jpeg it simply thinks Black is the dominant color and as a png it says White, regardless of other colors.
Is this intended, or am I failing in encoding the image correctly?
AzureVisionJson visionJson = null;
using (var memStream = new MemoryStream())
{
bodyColorBmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);
visionJson = AzureCognitiveOcr.MakeColorRequest(_azureVisionSubcsriptionKey, memStream);
}
Anyone have any idea if it's possible to get the Image Analysis to actually ignore the transparent pixels?
Im talking about this service:
https://learn.microsoft.com/bs-latn-ba/azure/cognitive-services/computer-vision/concept-detecting-color-schemes
I built a UWP XAML control that acts as a barcode/qrcode scanner using the zxing.net library (http://zxingnet.codeplex.com/). The control works fine, it previews the camera on the device and then captures a frame and let zxing process it. All a user has to do is to place it in a page and tell it what type of barcode to scan.
I am just facing one problem: How can I limit the scan area to the center of the captured frame? Sometimes there are multiple barcodes in the image and the library returns a result from one of the barcodes but I am interested in the barcode that is in the middle of the frame.
Is this possible with zxing.net? If so, how can I limit the scan area?
I don't know what code are you using. But I can give a hint based on my UWP barcode scanner
Inside CapturePhotoFromCameraAsync() Task you can find code that take "screenshot" frame from camera:
VideoFrame videoFrame = new VideoFrame(BitmapPixelFormat.Bgra8, (int)_width, (int)_height);
await mediaCapture.GetPreviewFrameAsync(videoFrame);
You can get there SoftwareBitmap and eben convert to WritableBitmap.
SoftwareBitmap sb = videoFrame.SoftwareBitmap;
WriteableBitmap bitmap = new WriteableBitmap(sb.PixelWidth, sb.PixelHeight);
But now there is another question how to crop WriteableBitmap (you can find solution on SO or MSDN - it's not short) and how to convert back to SoftwareBitmap.
Hi so I'm making an app for Windows 10 that requires a user to choose an image and it's going to crop the image to 310*128. I got the file picker code already. But I want to know how to actually crop and save the image and display in image box. I already have the xaml page done
With Lumia Imaging SDK you can both crop the selected image and resize the image. In this answer I assume you actually want to crop, but from the text I could just as well guess you really just want to resize.
For crop, use the CropEffect from Lumia.Imaging.Transforms. Set the CropArea property on it to the object, and then render it. If you are rendering straight to the XAML page I recommend using a SwapChainPanel object in XAML and a SwapChainPanelRenderer to render on it.
Given that you are loading a StorageFile and rendering to a SwapChainPanel your code might look like something like this:
StorageFile file = ...
using (var source = new StorageFileImageSource(file))
using (var crop = new CropEffect(source, new Rect(0, 0, 310, 128))
using (var renderer = new SwapChainPanelRenderer(crop, YourSwapChainPanel))
{
await renderer.RenderAsync();
}
The RenderTargetBitmap class worked with simple Canvas + InkManager (in Windows 8.1) to render ink strokes to an image.
UWP introduced InkCanvas and a new Inking API. However, it seems like the RenderTargetBitmap does not work with that. When I try to capture ink strokes with RenderAsync method, no ink strokes get rendered only other objects like Rectangle and so on.
Is it a bug or this new API is not meant to be used this way? If not, then how can I render an image out of InkCanvas?
Thanks!
Here is how I solved this issue with Win2D.
First of all, add Win2D.uwp nuget package to your project.
Then use this code:
CanvasDevice device = CanvasDevice.GetSharedDevice();
CanvasRenderTarget renderTarget = new CanvasRenderTarget(device, (int)inkCanvas.ActualWidth, (int)inkCanvas.ActualHeight, 96);
using (var ds = renderTarget.CreateDrawingSession())
{
ds.Clear(Colors.White);
ds.DrawInk(inkCanvas.InkPresenter.StrokeContainer.GetStrokes());
}
using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
await renderTarget.SaveAsync(fileStream, CanvasBitmapFileFormat.Jpeg, 1f);
Please try InkPresenter.StrokeContainer property
http://blogs.windows.com/buildingapps/2015/09/08/going-beyond-keyboard-mouse-and-touch-with-natural-input-10-by-10/
I'm able to show a video stream in a window. I'm using DirectShow VideoMixingRenderer9 in C#. I have created an Image with sometext in it. Now, how can I mix this image with the video stream so that both video stream and text is shown in the capture window. I tried with ISampleGrabber filter but it doesn't work with all video device and capture screan only shows the text with black background but no video stream. So I don't want to use ISampleGrabber filter.
IVMRMixerBitmap9 interface should help you, which is implemented by the VMR. This is the link to MSDN:
[http://msdn.microsoft.com/en-us/library/windows/desktop/dd390451(v=vs.85).aspx][1]
The bitmap needs to have alpha values so that it can be blended with the rendered video.