You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Arduino + Processing sketch solution for streaming video from the Portenta Vision Shield, Nicla Vision and GIGA board is very unreliable. Problems include:
The current Arduino + Processing sketch is not fit for purpose. We need an alternative solution with the following four features:
Cross-platform
Resilient to errors
Simple to use, with minimal configuration by User
Light on CPU
Here are two different - yet complimentary - approaches to meet these needs
Approach 1: Barebones Arduino-Python script
The sketch will communicate at 9600 bps. This is very slow, and will have minimal demand on CPU resources ensuring that data is read in a timely manner from the serial port (arduino/arduino-ide#79). Of course, the resolution and frame per second will drop but as a test sketch this is fine to ensure maximum compatibility. The Serial.begin() method includes an option for defining a parity (based on the underlying mbed function), which should be utilised.
The packets from the Arduino board are then parsed by a Python script. This would make use of cross-compatible libraries for I/O.
The packet should also contain data specifying if the transmission is greyscale or RGB, so that the Python script can identify this. No OS specific routines should be avoided.
Approach 2: WebBLE Camera Dashboard
An alternative approach to send data from the camera to the PC (or any other compatible device) would be over WebBLE. We already have a successful implementation of this for the Nicla Sense ME (see @marqdevx 's tutorial here as well as @sebromero battery status indicator here). A single image would need to be split into smaller chunks, which are then reconstructed on the browser side. While support for WebBLE is limited mainly to Chrome, it is expected to grow. And it works across Windows, Linux and OSX without the need to defined a serial port. Device detection is intuitively done in the browser, where a human-readable name is assigned to the Arduino device.
(M)JPEG compression can allow for larger resolution/FPS together with some level of resilience to error. Native JPEG decompression algorithms is taken for granted in modern browsers. Note that WebBLE support is still experimental.
The text was updated successfully, but these errors were encountered:
@facchinm mentioned WebSerial to transfer data from the Arduino Camera to the computer. WebSerial can be over USB or Bluetooth, so is communication-method agnostic. This overcomes the packet size limitations of WebBLE and can use native features in the browser to display the image data. A Github io page could host the page.
A robust alternative was developed by @sebromero in #822 which meets the requirements specified in this issue 🎉 :
Cross-platform -> Build upon WebSerial JS (Approach 3) and can run in Google Chrome in Windows, Linux and Mac.
Resilient to errors -> Instead of continuous data transfer (which is problematic in Windows, see: Portenta Vision Shield Camera demo not running #112 (comment)) defines sendChunk() and sendFrame() methods. Additionally, sendCameraConfig() sends the IMAGE_MODE based on the specified platform.
Simple to use, with minimal configuration by User -> Compiler directives are used to identify the platform. Manual configuration needs to be made by (un)commenting lines since single platforms may have different cameras. This is currently the best workaround, since automatic detection of the camera is not possible.
Light on CPU -> Runs stable on Mac and OK on Linux. Some stability issues on Windows, but more a limitation of the OS. Runs continuously on the Nicla Vision without crashing.
Describe the problem
The Arduino + Processing sketch solution for streaming video from the Portenta Vision Shield, Nicla Vision and GIGA board is very unreliable. Problems include:
See @jacobhylen 's #673 (comment)
To reproduce
Expected behaviour
Regardless of what Arduino board is connected, you should see a stable video feed.
useGreyScale
value in Processing sketch without changing code #673 (comment).useGreyScale
boolean variable [AE-49] Colour mode mismatch between CameraCaptureRawBytes.ino and CameraRawBytesVisualizer.pde #662.Proposed Solutions
The current Arduino + Processing sketch is not fit for purpose. We need an alternative solution with the following four features:
Here are two different - yet complimentary - approaches to meet these needs
Approach 1: Barebones Arduino-Python script
The sketch will communicate at 9600 bps. This is very slow, and will have minimal demand on CPU resources ensuring that data is read in a timely manner from the serial port (arduino/arduino-ide#79). Of course, the resolution and frame per second will drop but as a test sketch this is fine to ensure maximum compatibility. The Serial.begin() method includes an option for defining a parity (based on the underlying mbed function), which should be utilised.
ArduinoCore-mbed/cores/arduino/Serial.cpp
Lines 91 to 101 in 8031008
The packets from the Arduino board are then parsed by a Python script. This would make use of cross-compatible libraries for I/O.
The packet should also contain data specifying if the transmission is greyscale or RGB, so that the Python script can identify this. No OS specific routines should be avoided.
Approach 2: WebBLE Camera Dashboard
An alternative approach to send data from the camera to the PC (or any other compatible device) would be over WebBLE. We already have a successful implementation of this for the Nicla Sense ME (see @marqdevx 's tutorial here as well as @sebromero battery status indicator here). A single image would need to be split into smaller chunks, which are then reconstructed on the browser side. While support for WebBLE is limited mainly to Chrome, it is expected to grow. And it works across Windows, Linux and OSX without the need to defined a serial port. Device detection is intuitively done in the browser, where a human-readable name is assigned to the Arduino device.
(M)JPEG compression can allow for larger resolution/FPS together with some level of resilience to error. Native JPEG decompression algorithms is taken for granted in modern browsers. Note that WebBLE support is still experimental.
The text was updated successfully, but these errors were encountered: