Home Community Blog Buy Now
Blog

Misty Community Forum

Getting an image from Misty to send to API

Hello Misty Team,

I have followed this tutorial to using the FacePlusPlus API to detect emotions from Johnathon Training Mission: Coding Misty to Recognize Emotions

However, this has you post an image to Imgur, and then have FacePlusPlus grab the picture from there and send it to the FacePlusPlus API. What I want to do is just grab the image from Misty, and send the picture to FacePlusPlus without having to use the Imgur middleman. I have tried doing that, and got close however if I try to use the Base64 string route I get a 414 Error and it says that the URI is too long due to the Base64 string. Is there any other method I can try using to directly get the image from Misty?

Thanks!

Can you be precise about what you tried? Did you send a POST request to FacePlusPlus with the image data base64-encoded in the body (not the path)?

@slivingston I try to use the GetImage command on Misty to get an image and the Base64 string, when I try to perform a SendExternalRequest on the FacePlusPlus API to detect the emotion, I will try to add the generated Base64 string but it is too long and I get a 414 error saying that the URI is too long to complete the request.

I did it where I posted the image through Imgur, grab the link, and then once the emotion is predicted I perform a DELETE request on the image. However, I am just curious if there was a way to do this without Imgur?

Did you try to send the base64 encoded string via the request body? Use the arguments parameter of SendExternalRequest https://docs.mistyrobotics.com/misty-ii/javascript-sdk/api-reference/#misty-sendexternalrequest

to answer your question explicitly, there is a way to do it without Imgur: send the base64-encoded data in a request body with JSON format, i.e., Content-Type: application/json.

@johnathan tried this before (reported at https://community.mistyrobotics.com/t/training-mission-coding-misty-to-recognize-emotions/2401/15), but it appears that the relevant part of the Face++ API was broken. Perhaps Face++ fixed it now?