diff --git a/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/camera-to-bitmap-sd-card/content.md b/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/camera-to-bitmap-sd-card/content.md index fa4646c4e4..02c71097c7 100644 --- a/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/camera-to-bitmap-sd-card/content.md +++ b/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/camera-to-bitmap-sd-card/content.md @@ -44,14 +44,21 @@ Connect the Portenta Vision Shield to your Portenta H7 as shown in the figure. T #### The Camera -You will be using the **Himax HM-01B0 camera module** which has a resolution of 320 by 240 and the output data its in grayscale with 8 bits per pixel (bpp). It is important to have this in mind as the `.bmp` (bitmap) format has some needed configuration depending on the data being used. +The Vision Shield Rev.1 uses the **Himax HM-01B0 (320x240) camera module**, the Vision Shield Rev.2 uses the **Himax HM0360 (640x480) camera module**, both output data are grayscale with 8 bits per pixel (bpp). It is important to have this in mind as the `.bmp` (bitmap) format has some needed configuration depending on the data being used. Inside the sketch, you can use these libraries to access the camera APIs, also compatible with the [Arduino Nicla Vision](https://docs.arduino.cc/hardware/nicla-vision) ```cpp #include "camera.h" // Multi Media Card APIs -#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield + +//For the Vision Shield Rev.1 +#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.1 + +//For the Vision Shield Rev.2 +#include "hm0360.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.2 ``` +***Left uncommented the library of your Vision Shield version.*** + #### Bitmap File Format The bitmap binary file needs to contain some information in order to tell the computer for example the resolution of the picture and the bit-depth (bpp). Bit depth refers to the color information stored in the image. The higher the bit depth of an image, the more colors it can store. As the bit depth increases, the file size of the image also increases, because more color information has to be stored for each pixel in the image. @@ -80,7 +87,12 @@ First you need to include the needed libraries #include "FATFileSystem.h" // Mbed API for portable and embedded systems #include "camera.h" // Arduino Mbed Core Camera APIs -#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield + +/*-----Uncomment the library and class for your specific hardware-----*/ + +//#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.1 +// OR +#include "hm0360.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.2 ``` Then define the following objects with their respective constructor (`blockDevice` and `fileSystem` objects), needed for getting access to the SD Card and the file system. @@ -92,8 +104,17 @@ SDMMCBlockDevice blockDevice; mbed::FATFileSystem fileSystem("fs"); #include "camera.h" // Arduino Mbed Core Camera APIs -#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield -HM01B0 himax; + +/*-----Uncomment the library and class for your specific hardware-----*/ + +//#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.1 +//HM01B0 himax; + +// OR + +#include "hm0360.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.2 +HM0360 himax; + Camera cam(himax); FrameBuffer frameBuffer; // Buffer to save the camera stream @@ -288,8 +309,15 @@ SDMMCBlockDevice blockDevice; mbed::FATFileSystem fileSystem("fs"); #include "camera.h" // Arduino Mbed Core Camera APIs -#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield -HM01B0 himax; + +/*-----Uncomment the library and class for your specific hardware-----*/ + +//#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.1 +//HM01B0 himax; + +#include "hm0360.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.2 +HM0360 himax; + Camera cam(himax); FrameBuffer frameBuffer; // Buffer to save the camera stream diff --git a/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/getting-started-camera/content.md b/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/getting-started-camera/content.md index e62d43efca..d842eb86c9 100644 --- a/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/getting-started-camera/content.md +++ b/content/hardware/04.pro/shields/portenta-vision-shield/tutorials/getting-started-camera/content.md @@ -47,13 +47,23 @@ To capture the frames you will need to use the functions contained in `camera.h` ```cpp #include "camera.h" -#include "himax.h" +//For the Vision Shield Rev.1 +//#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.1 + +//For the Vision Shield Rev.2 +#include "hm0360.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.2 ``` +***Left uncommented the library of your Vision Shield version.*** + Next, let's initialize a camera object and a frame buffer of the size 320*240 (76'800 bytes). ```cpp -HM01B0 himax; + +//HM01B0 himax; // for Vision Shield Rev.1 + +HM0360 himax; // for Vision Shield Rev.2 + Camera cam(himax); #define IMAGE_MODE CAMERA_GRAYSCALE FrameBuffer fb(320,240,2); @@ -268,9 +278,15 @@ The `CaptureRawBytes.ino` Sketch. ```cpp #include "camera.h" -#include "himax.h" -HM01B0 himax; +/*-----Uncomment the library and class for your specific hardware-----*/ + +//#include "himax.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.1 +//HM01B0 himax; + +#include "hm0360.h" // API to read from the Himax camera found on the Portenta Vision Shield Rev.2 +HM0360 himax; + Camera cam(himax); #define IMAGE_MODE CAMERA_GRAYSCALE FrameBuffer fb(320,240,2);