-
Hi, I am trying to reproduce and modify the classification example. I noticed that the model input is stored in the camera capture buffer 'cameraBuffer' with a size of CAM_WIDTH * CAM_HEIGHT, which is the same size as the image captured by the camera, i.e. 324 x 244×1. However, my model expects the input size to be 160 x 160×1, so how should I modify the code? Also, I would like to know if the model input data stored in 'cameraBuffer' has been pre-processed? For example, normalised and quantized. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To adapt the input size from 324x244 to the model’s expected 160x160, you can add a resizing step to the code after capturing the image. This resizing can be done by scaling down the 'cameraBuffer' using interpolation, such as nearest-neighbor or bilinear methods, to reduce it to 160x160 dimensions. Or you can do subsampling. Since GAP SDK does not have built-in resizing functions, you probably need to write a custom resizing loop that iterates over pixels, similar to other image-processing operations like demosaicking. Define the new 160x160 buffer and map pixels from the original 'cameraBuffer' into it according to the scaling factor. You should also be aware that GAP SDK offers a QQVGA mode, which captures images at 160x120. Regarding preprocessing, the GAP SDK’s 'cameraBuffer' likely contains raw pixel data directly from the camera without normalization or quantization unless specifically applied in your code, but it’s best to check code or ask GreenWaves on the GAP SDK repository.. To match your model’s input requirements, you may need to manually implement these steps. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply, it helps me a lot! |
Beta Was this translation helpful? Give feedback.
To adapt the input size from 324x244 to the model’s expected 160x160, you can add a resizing step to the code after capturing the image. This resizing can be done by scaling down the 'cameraBuffer' using interpolation, such as nearest-neighbor or bilinear methods, to reduce it to 160x160 dimensions. Or you can do subsampling. Since GAP SDK does not have built-in resizing functions, you probably need to write a custom resizing loop that iterates over pixels, similar to other image-processing operations like demosaicking. Define the new 160x160 buffer and map pixels from the original 'cameraBuffer' into it according to the scaling factor. You should also be aware that GAP SDK offers a QQVGA…