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
Copy file name to clipboardExpand all lines: content/hardware/05.nicla/boards/nicla-vision/tutorials/getting-started/nicla vision getting started.md
+47-5Lines changed: 47 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -46,19 +46,19 @@ Connect the Nicla Vision to your computer via the USB cable if you haven't done
46
46
47
47
Click on the "connect" symbol at the bottom of the left toolbar.
48
48
49
-

49
+

50
50
51
51
A pop-up will ask you how you would like to proceed. Select "Reset Firmware to Release Version". This will install the latest OpenMV firmware on the Nicla Vision. You can leave the option of erasing the internal file system unselected and click "OK".
52
52
53
53

54
54
55
55
Nicla Vision's green LED will start flashing while the OpenMV firmware is being uploaded to the board. A terminal window will open which shows you the flashing progress. Wait until the green LED stops flashing and fading. You will see a message saying "DFU firmware update complete!" when the process is done.
56
56
57
-

57
+

58
58
59
59
The board will start flashing its blue LED when it's ready to be connected. After confirming the completion dialog the Nicla Vision should already be connected to the OpenMV IDE, otherwise click the "connect" button (plug symbol) once again.
60
60
61
-

61
+

62
62
63
63
### 3. Preparing the Script
64
64
@@ -139,22 +139,64 @@ Connect your board to the OpenMV IDE and upload the above script by pressing the
139
139
140
140
Now the built-in LED on your Nicla Vision board should be blinking red, green and then blue repeatedly.
141
141
142
+
## Using the Nicla Visions Camera
143
+
144
+
You can easily access the camera on the Nicla Vision through OpenMV IDE. Below is a short script that will set up the camera and take an image. The board will blink it's LED to indicate when it will take the picture. The image can be seen in the frame buffer while the script is running.
145
+
146
+
```python
147
+
import pyb # Import module for board related functions
148
+
import sensor # Import the module for sensor related functions
sensor.set_pixformat(sensor.RGB565) # Sets the sensor to RGB
156
+
sensor.set_framesize(sensor.QVGA) # Sets the resolution to 320x240 px
157
+
sensor.set_vflip(True) # Flips the image vertically
158
+
sensor.set_hmirror(True) # Mirrors the image horizontally
159
+
160
+
redLED.on()
161
+
sensor.skip_frames(time=2000) # Skip some frames to let the image stabilize
162
+
163
+
redLED.off()
164
+
blueLED.on()
165
+
166
+
print("You're on camera!")
167
+
sensor.snapshot().save("example.jpg")
168
+
169
+
blueLED.off()
170
+
print("Done! Reset the camera to see the saved image.")
171
+
```
172
+
173
+
The camera that comes with the Nicla Vision supports RGB 565 images. That's why we use `sensor.set_pixformat(sensor.RGB565)`, enabling the camera to take an image with color. Then we need to set the resolution of the camera. Here we will use `sensor.set_framesize(sensor.QVGA)`.
174
+
175
+
Using `sensor.set_vflip` and `sensor.set_hmirror` will help us set the correct orientation of the image. If you hold the board with the USB cable facing down you want to call `sensor.set_vflip(True)`. The image will be mirrored, if you want the image to be displayed as you see it with your eyes, you want to call `sensor.set_hmirror(True)`.
176
+
177
+
Running this script in OpenMV will show the image that the camera is currently capturing in the top right corner, inside the frame buffer. The on board red LED will be on for a couple of seconds, then the blue LED will turn on, this indicates when the picture is about to be taken. A message will be printed in the serial terminal when the image is taken.
178
+
179
+

180
+
181
+
The image will be saved as "example.jpg" in the boards directory. It is also possible to save the image in a ".bmp" format. If you reset the camera by pressing the reset button the image file will appear in the boards directory.
182
+
142
183
## Using the Nicla Vision with Arduino IDE
143
184
144
185
As mentioned before, the Nicla Vision comes with OpenMV firmware pre installed. This makes it easier to use the board with OpenMV out of the box. It is possible to use the Nicla Vision with the Arduino IDE. First make sure that you have the latest core installed. To install the core navigate into **Tools > Board > Boards Manager...**, in the Boards Manager window search for **Nicla Vision MBED** and install it. When this core is installed and you have your board connected to your computer, put the board into bootloader mode. You do this by double pressing the reset button, located next to the LED.
145
186
146
187
The board should now be selectable in the Arduino IDE, allowing you to upload sketches to it.
147
188
148
189
## Conclusion
149
-
In this tutorial you learned how to use the OpenMV IDE with your Portenta board. You also learned how to control the Nicla Vision's RGB LED with MicroPython functions and to upload the script to your board using the OpenMV IDE.
190
+
In this tutorial you learned how to use the OpenMV IDE with your Nicla Vision board. You also learned how to control the Nicla Vision's RGB LED with MicroPython functions and to upload the script to your board using the OpenMV IDE.
150
191
151
192
### Next Steps
152
193
- Experiment with MicroPythons capabilities. If you want some examples of what to do, take a look at the examples included in the OpenMV IDE. Go to: **File > Examples > Arduino > ** in the OpenMV IDE.
194
+
- It is possible to use the board for more advanced image processing tasks. Be sure to take a look at our other tutorials if you want to learn more.
153
195
- Take a look at our other Nicla Vision tutorials which showcase its many uses. You can find them [here](https://docs.arduino.cc/hardware/nicla-vision#tutorials)
154
196
155
197
## Troubleshooting
156
198
157
199
### OpenMV Firmware Flashing Issues
158
200
- If the upload of the OpenMV firmware fails during the download, put the board back in bootloader mode and try again. Repeat until the firmware gets successfully uploaded.
159
-
- If the OpenMV IDE still can't connect after flashing the firmware, try uploading the latest firmware using the "Load Specific Firmware File" option. You can find the latest firmware in the [OpenMV Github repository](https://github.com/openmv/openmv/releases). Look for a file named **firmware.bin** in the PORTENTA folder.
201
+
- If the OpenMV IDE still can't connect after flashing the firmware, try uploading the latest firmware using the "Load Specific Firmware File" option. You can find the latest firmware in the [OpenMV Github repository](https://github.com/openmv/openmv/releases). Look for a file named **firmware.bin**.
160
202
- If you see a "OSError: Reset Failed" message, reset the board by pressing the reset button. Wait until you see the blue LED flashing, connect the board to the OpenMV IDE and try running the script again.
0 commit comments