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
2020-07-02T03:03:25.52+00:00

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:

11231-51mizw1z4sl-ac-sl1200.jpg

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:

11098-image.png

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.
39,798 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Li - MSFT 33,451 Reputation points Microsoft Vendor
    2020-07-02T04:35:14.237+00:00

    Hello,

    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
    2020-07-19T03:09:20.133+00:00

    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:
    RPiCognitiveService

    Hope this will help you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.