Record a video of the filtered camera source

The Featured Discussion Board Post this week is Record a video of the filtered camera source started by Reactor15.

Reactor15 wants to know how to record a video of a filtered camera source. Lee McPherson provides him with a code sample in which one can adjust the recording settings for the particular device.

Reactor15 adds that he wants to use the ChromaKeyFilter, but it seemed to have no effect on the video when enabled. He thinks the alpha channel is being ignored. Lee does not think that those video formats (NV12 and YU2) have alpha channels, and clarifies that they use a luminance byte and two or more color bytes to construct an image. He adds that they are neither RGB nor RGBA.

Lee suggests using Blend Filter in combination with ChromaKeyFilter by running the ChromaKeyFilter on the input video, then blending that layer on top of a custom background that can be provided as another IImageConsumer. Reactor15 was able to get it working with a test ColorImageSource for the background, but wants to know how to pass a StorageFileImageSource from C# to C++. Yan Verdavaine clarifies that StorageFileImageSource implements IImageProvider, and hence he could pass it like a property. Reactor15 confirms this to be an acceptable solution.

We featured this discussion to highlight how helpful members of the community sort out issues to their final conclusions.

See About Featured Discussion Board Posts for more information.

Keep those interesting questions coming!

Image view undesirably cropped

The Featured Discussion Board Post this week is Image view undesirably cropped started by m.findlay93

m.findlay93 is trying to implement an Image View within a page for a Windows Phone application, but when it is deployed, the image gets cropped. He states his problem and provides a screen grab of the issue faced.

Ratish Philip admits to facing the same problem. When he removes CacheMode=”BitmapCache”, the cropping goes away but the zoom and pan performance is affected. He suspects a size limit to the image and recommends taking a look at the PhotoPage.xaml in the FilterExplorer project on the Nokia Developer Github repository.

Lee McPherson confirms that the size limit does exist. In WP7 it is 2048x2048 and 4096x4096 in WP8. He suggests loading the image using DecodePixenHeight or DecodePixelWidth to reduce the resolution. The drawback of this approach is that one would lose some resolution on zooming. The alternate and cleaner solution would be to use the Nokia Imaging SDK and follow articles in the Wiki that explain how to display high resolution images.

This discussion was selected for featuring because it highlights how it is possible to work around API limitations by using Nokia Imaging SDK for high resolution pictures.

Keep those interesting questions coming!

Creating CustomEffects in C++

The Featured Discussion Board Post this week is Creating CustomEffects in C++ started by leemcpherson.

Lee is attempting to convert one of his custom effects from a Managed language like C# to a more native language C++ for the Nokia Imaging SDK by following a Wiki article by SB Dev. While Lee’s C# version works fine, the C++ version throws a NullReferenceException.

In the course of discussion Lee and SBDev confirm that the original code in the wiki throws the same exception. Yan_ feels that since Lee gives CustomFilter directly to DelegateFiltering, there might be some unmanaged resources creating de-allocation issues. The allocated buffer is de-allocated when the garbage collector frees it, but that is not happening in this case. Hence manually freeing the resources might help. This suggestion worked for Lee.

This discussion was featured to highlight tricks for memory management when a large amount of memory is instantiated.

Keep those interesting questions coming!

See About Featured Discussion Board Posts for more information.

BitmapImage Memory Footprint

The Featured Discussion Board Post this week is BitmapImage Memory Footprint, started by Lee McPherson.

Lee is trying to reduce the memory that a 3000×4000 jpeg image would take when shown in full screen on Windows Phone, and was trying to determine if it is better to create a separate smaller thumbnail file and load it, or just load the original jpeg using DecodePixelWidth.

The discussion surfaced several ideas for handling large image files: João Cardoso recommended using the Nokia Imaging SDK, Vinay Patil suggested an example from MSDN on Limiting image size and Loukt highlighted the wiki article Memory-efficient Navigation in very High Resolution Images on Windows Phone.

Lee’s current implementation uses Scrollviewer and ViewportControl. After trying some of the suggestions, Lee accepted that the Nokia Imaging SDK might have been the best solution, and will consider it for the next iteration.

The discussion was selected for featuring because it highlights some of the possible problems and solutions for working with large image files.

See About Featured Discussion Board Posts for more information, and keep those interesting questions coming – that’s what a community is all about!