This starter kit flow demonstrates how to capture a static image from a video in a client side application and post it into Node-RED using FormData and Fetch. The image is then analyzed with Watson Visual Recognition and the result is displayed on the webpage.
For this starter kit to work, you need to install the following node from the Node-RED 'Manage Palette':
- node-red-contrib-file-buffer
- node-red-contrib-http-multipart
Demo Image App:
HTTP [get] /demo/image
- sets the app URL as a GET on xxxxx.mybluemix.net/demo/imageStyles
- CSS styles for the webpageJavaScript
- JavaScript for the webpageHTML
- HTML for the webpageHTTP Response
- ends HTTP request
Handle the Form:
HTTP In Multipart /post
- sets the HTTP POST call and adds 'image' as a fieldPre Recognition Processing
- sets msg.payload to the path the image will be sent onFile buffer
- puts the image file into a buffer so it able to be passed into Visual RecognitionVisual Recognition
- anaylzes an image to identify built in classes and a confidence scorePost Recognition Processing
- sets msg.payload as image classes to pass back into webpageHTTP response
- ends HTTP call