Skip to content

Portenta Vision Shield Camera demo not running #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hpssjellis opened this issue Dec 27, 2020 · 11 comments
Closed

Portenta Vision Shield Camera demo not running #112

hpssjellis opened this issue Dec 27, 2020 · 11 comments

Comments

@hpssjellis
Copy link
Contributor

Does anyone have the demo example running for the Portenta Vision Shield?

I had to send an integer to start for the demo to even compile.

cam.start(3000);

My issues are very similar to the issues with the ov7670 Camera and Java Processing program except those issues were solved by switching from Windows to Linux. For the Portenta both Windows and Linux seem to have the zigzag issue for me using the Portenta Vision Shield.

arduino-libraries/Arduino_OV767X#5

It feels like the buffer is not getting properly reset, or it is just the Processing program that can't read the serial information fast enough. Does anyone know of a different Processing program than https://processing.org/download/

@facchinm
Copy link
Member

The example not compiling is due to this 8911e84 (I'll fix the example by adding a sensible default timeout).
About the zigzag issue, are you sure you set the resolution right (Processing side)? The four extra pixels on both axis must be added unless you're cropping.
A screenshot after uncommenting cam.testPattern(true) would help too.

@hpssjellis
Copy link
Contributor Author

hpssjellis commented Dec 28, 2020

@facchinm

By the way in my download of Core 1.3.1 the extras folder did not come with the Camera demo like it did with 1.3.0. I will play with the idea of extra pixels for processing although the included Processing code see below, does not mention it.

// must match resolution used in the sketch
final int cameraWidth = 324;
final int cameraHeight = 244;
final int cameraBytesPerPixel = 1;

I will also load my cam.testpattern(true) although I remember it not being very interesting, skinny black and white lines.

@hpssjellis
Copy link
Contributor Author

hpssjellis commented Dec 28, 2020

@facchinm

I think the returned FRAME_BUFFER (uint8_t *)LCD_FRAME_BUFFER; from the cam.grab() is not being zeroed before being written to, my reasoning is that the cam.snapshot() works better (but only allows one picture, I can't seem to reset the camera in my main loop) and the test patterns seem fine, knowing that the Processes program works much better on Ubuntu than windows.

Ubuntu TestPattern
ubuntu-vision-shield-test-pattern

Windows Test Pattern (Even with the ov7670 camera I never got a great image using windows)
windows-vision-shield-test-pattern


P.S. I tried different:

cameraWidth = 328;    // 324
cameraHeight = 248;   // 244

Small changes to cameraWidth shifts the image diagonally
Small changes to cameraHeight seems to have minimal effects.


P.S.S. By the way: this camera is supposed to be square 324 x 324 not a regular VGA resolution.

https://www.arduino.cc/pro/hardware/product/portenta-vision-shield

The Vision shield comes with a 324x324 pixels camera module which contains an Ultra Low Power Image Sensor designed for Always-on vision devices and applications.


I am putting my testing files and images here

@hpssjellis
Copy link
Contributor Author

@facchinm @sebromero or anyone else. Does the Portenta Vision Shield using the camera library and Processes work for you? It is very close to working for me just wondering if I am getting the same results or if I have made a minor mistake.

I get the proper black and white image, just has a few layer issues. It would be really good for me to know that the basic example does work for someone else.

@pnndra
Copy link
Contributor

pnndra commented Jan 8, 2021

@hpssjellis the issue is not really with capture but rather with the way image is being transferred. very likely some character is being added or removed for some reason.
you're right in saying we don't zero the buffer before acquisition because that would really be a waste of CPU bandwidth.
the issue you're experiencing seems to be related to the windows counterpart that likely is handling the stream as an ASCII stream rather than binary and likely that is causing things like CR to be translated to CRLF, which would justify the stuff you're seeing that basically seems "random" insertion of bogus characters.
of course you should keep the resolution coherent with the one programmed on the camera otherwise image will be skewed horizontally.

@hpssjellis
Copy link
Contributor Author

Thanks @pnndra the windows CR issue probably explains why Processes works much better on Ubuntu than Windows. I might just start working with the images as they are as I am building machine learning apps using Edge Impulse so eventually the image will never actually be seen using a serial port as the ML program extracts information internally from each image.

@pnndra
Copy link
Contributor

pnndra commented Jan 11, 2021

@hpssjellis you will soon get something out of the box for your latter use case :). not asking you to wait but be aware we're on it.

@facchinm
Copy link
Member

Should be fixed by #122 and friends, feel free to reopen if the problem persists

@sebromero
Copy link
Collaborator

@hpssjellis We also updated the demo slightly. See here: #143

@gargoyle777
Copy link

hi, sorry to open this again.
I've been working on a windows pc, portenta H7 with a ethernet vision shield.
As them, i have the same zigzag error, i have tried both arduino Ide 1.8.x and 2, both updated. Exemples updated too.
I can see the proper image when i use openMV, but for a begginer like me it's getting hard to turn the portenta into an wifiAP and using multithreading with the modified python used in the openMV ide.
Any help would be appreciated.

@hpssjellis
Copy link
Contributor Author

@gargoyle777 I am working on these portenta vision shield examples, which uses a grayscale OLED (very fast) and make debugging much easier than the default examples. I hope it helps in some way.

https://github.com/hpssjellis/portenta-pro-community-solutions/tree/main/examples/dot3-portenta-vision-shields/dot35-camera-and-oled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants