Pictures taken by a UWP app on Raspberry PI/Windows IoT look all green, while everything is fine on regular Windows 10

DC Dweller 1 Reputation point

Hi all,

My robotics UWP application uses a web camera for vision. Photos are captured with pretty standard code:

ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateUncompressed(MediaPixelFormat.Bgra8);  
photoCapture = await mediaCapture.PrepareLowLagPhotoCaptureAsync(imageProperties);  
photo = await photoCapture.CaptureAsync();  
SWBitmap = photo.Frame.SoftwareBitmap;  
// Display photo  
if (SWBitmap.BitmapPixelFormat != BitmapPixelFormat.Bgra8 || SWBitmap.BitmapAlphaMode == BitmapAlphaMode.Straight)  
    SWBitmap = SoftwareBitmap.Convert(SWBitmap, BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied);  

The web camera looks like this:


These cameras usually produce 640x480 pixel images, and all was well on both Raspberry PI running the IoT, and regular Windows.

Recently, these types of cameras have started generating 1280x720 pixel images. The code above still generates perfect images on the regular Windows 10, but on Raspberry PI the image comes out all green:


Only the top few lines are colored while everything else below is green.

Does anyone have any ideas?

Thanks in advance.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,587 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor


    Welcome to Microsoft Q&A!

    Currently, Microsoft Q&A supports the products listed over here: supported topics (more to be added later on).

    Your issue seems to be more related to the Raspberry PI device and windows IOT which is not supported yet. You could ask about this issue in Windows IoT forum.

    Thank you.

    0 comments No comments

  2. Jiong Shi 1 Reputation point

    Dear friend,

    Maybe you can try to create JPEG pictures as follows:

    photoFile = await KnownFolders.PicturesLibrary.CreateFileAsync(
                        PHOTO_FILE_NAME, CreationCollisionOption.GenerateUniqueName);
                    ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateJpeg();
                    await mediaCapture.CapturePhotoToStorageFileAsync(imageProperties, photoFile);

    Please refer to this sample project on official Windows-iotcore-samples:

    Hope this will help you.

    0 comments No comments