cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

powerapps computer vision connector

 

Does anyone have a working example of using the Computer Vision API connector in PowerApps with the camera image control? I'm aware it's in preview, but presumably there's a reasonable use case for preview...

 

I have used Flow to achieve what I'm trying to achieve, I'm looking for an example that does not involve Flow or a custom connector.  If I have to use Flow or a custom connector then it seems the PowerApps connector is a bit redundant? at least a bit limited as far as the Camera control is concerned...

 

Kind regards,

 

RT

7 REPLIES 7
Community Support Team
Community Support Team

Re: powerapps computer vision connector

Hi @RusselThomas,

 

Could you please share a bit more about your scenario?

Do you want to analyze the image captured via Camera control using the Computer Vision API connector within your app?

 

I have made a test on my side, please take a try with the following workaround:4.JPG

 

 

Add a Camera control, Button control and a Gallery control within the screen. In addition, add the Computer Vision API connector as a data source within your app.

 

Set the OnSelect property of the Button control to following formula:

ClearCollect(ImageCollection,ComputerVisionAPI.AnalyzeImage("Image Content",{language:"en",visualFeatures:Camera1.Photo}))

Note: The Camera1 represents the Camera control within my screen. Using a collection to store the result the ComputerVisionAPI.AnalyzeImage function returns.

 

Set the Items property of the Gallery control to following formula:

ImageCollection

More details about the Computer Vision API connector, please check the following article:

Computer Vision API connector

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: powerapps computer vision connector

Thanks Kris, this is precisely the use case 🙂

 

I was battling to find out where to put the image content, and in what format - what I read about visualfeatures didn't really make me think it should go there...

 

Carlosag's reference

Parameters:

Name

Type

Summary

Required

Related Action

language

string

(Language)Values: [en, zh]

The service will return recognition results in specified language.

False

 

visualFeatures

string

(Visual Feature Options)

A string indicating what visual feature types to return. Multiple values should be comma-separated.

False

 

format

string

(Image Source)Values: [Image Content, Image URL]

Source of the image - either included or by reference url.

True

 

Image

AnalyzeImageParameterImage

 

 

True

 

 

and it doesn't even register on the MS Docs reference, although it's obviously in the object hierarchy:

vapi.PNG

I tried using your fomula, but I still get imageformat errors;

 

ComputerVisionAPI.AnaIyzeImage failed: {

"code": "InvalidlmageFormat",

"requestld": "70526a86-b4e5-4bbc-8ea4-0748c775cb2a",

"message": "Input data IS not a valid image."

 

Is yours working?

 

Kind regards,


RT

Community Support Team
Community Support Team

Re: powerapps computer vision connector

Hi @RusselThomas,

 

Just an update -- Please take a try with the following formula on your side:

ClearCollect(ImageCollection,ComputerVisionAPI.AnalyzeImage(Camera1.Photo,{language:"en",visualFeatures:"Tags"}))

Please check and see if the following article would help in your scenario:

https://westus.dev.cognitive.microsoft.com/docs/services/56f91f2d778daf23d8ec6739/operations/56f91f2...

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: powerapps computer vision connector

Busy going through the documentation, same error on the updated formula though.

From what I read somewhere yesterday, the vision service expects binary input - from what I can see, the camera puts out base64 encoded jpg....?

 

[Edit]

Also referenced in the link you sent;

 

  • For an image URL: Content-Type should be application/json
  • For a binary image data: Content-Type should be application/octet-stream or multipart/form-data
Community Support Team
Community Support Team

Re: powerapps computer vision connector

Hi @RusselThomas,

 

Yes, your are right. The image the the Camera control captured is a base64 Data URI, the format of the base64 Data URI as below:

data:[<media type>][;base64],<data>

Please check the following blog for more details:

https://medium.com/dtlpub/adding-camera-capability-to-the-powerapps-visitor-registration-app-e5f8402...

 

If you want to convert a base64 Data URL into an binary data, I afriad that there is no way to achieve your needs in PowerApps currently.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, you could consider take a try to pass the image (base64 Data URI) captured via the Camera control within your app to a Microsoft Flow, then within your flow, convert the base64 Data URI into an Binary data.

 

Please check and see if the following blog would help in your scenario:

https://www.techmikael.com/2017/05/an-even-more-clever-workaround-for.html

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Super User
Super User

Re: powerapps computer vision connector

Thanks Kris,

 

I use the Flow uritobinary expression often as it works well for saving images to SharePoint, but returning the binary to PowerApps and submitting it to the Computer Vision Connector hangs my studio session (using the "Respond to PowerApps" flow action).

 

Besides this, as I said initially - if I'm going to Flow once, then I may as well process everything (including the CVAPI call) from there and just return the results of the call to PowerApps (which I'm doing now anyway).  This then obviates the need for having the PowerApps CVAPI connector in my app - but then surely I'm missing a trick here somewhere otherwise why do we have the "Image Content" functionality in the connector?

 

 

I've also tried sending content from the image upload control and I get the same results, so at this point I'm pretty much back to my original question - can I use the PA Computer Vision connector for sending any image content from PA to the connector, or is it only useful for URL's of images stored somewhere else?  (Something I haven't tested yet, but I'm assuming that at least works)

 

Kind regards,

 

RT

Re: powerapps computer vision connector

@v-xida-msft, I coped your example, but I can see an error , "Invalid Image format", input data is not a valid image". Can you share your insights on this, Thanks

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 159 members 5,330 guests
Please welcome our newest community members: