Gordon999/Pi_LIbCamera_GUI

Beta issues and suggestions

Closed this issue · 22 comments

dbateman wrote...

Pi_LibCamera is interesting. I don't know why but adjusting the brightness seem to crash it. Maybe as its divided by 100 for the range. But it doesn't always crash.
Changing the gain limit to 20 works better. The HQ analog gain goes up to 16, then digital gain is added above that.
The HQ can handle video frames up to 50, so I made that change and 2028x1080 at 50fps worked when I added it. I did get some frame drops down to 24. So its not stable.
Adding up to 120 fps didn't work. So 90 fps might be the limit.
In the two empty blocks you could add -- denoise and -- sharpness. Those are the only other options I can see available in libcamera-still.
Ev for some reason didn't work for me. Changing it didn't do anything. I didn't inspect its tag though.

I was trying to add the raw tag, but didn't work. Using 'jpg -r' would save a jpeg and DNG file but then it locks up and doesn't leave the saving file screen. The correct tag might just be --raw. With out jpg, but that would need to be added as on alternative, as the file type doesn't recognize it.

Thanks for the feedback, expect a beta2 soon....

I also found that interval shooting wasn't working even though it looked ok.

For longer than 6 or 10 seconds, it might be useful to use the --immediate switch. Similar to the previous version.
This is the example given:
"Very long exposures
To capture very long exposure images, we need to be careful to disable the AEC/AGC and AWB because these algorithms will otherwise force the user to wait for a number of frames while they converge. The way to disable them is to supply explicit values. Additionally, the entire preview phase of the capture can be skipped with the --immediate option.

So to perform a 100 second exposure capture, use

libcamera-still -o long_exposure.jpg --shutter 100000000 --gain 1 --awbgains 1,1 --immediate"

I was surprised you need a bmp image for preview. When I tried to change that to speed it up, nothing worked. So I will have to remember to slow down with my sections. Libcamera also puts out way too much comments. That too might be slowing it down.

BETA 2 uploaded. Hopefully all your suggestions etc implemented.

added --denoise, --sharpness, -r (raw stills), --immediate, preview now jpg not bmp (before the sudo apt installs etc only bmp would work)

I have seen it lock up a couple of times BUT still haven't found the issue

I tested the last version I think with the -- fix.
It kicks out an error when you change the EV. It says there is a duplicate.
It also still doesn't do time lapse. Not sure why. It looked ok to me when I skimmed the code. I may need to see if its a saved file format issue.

You did fix the raw option. That works perfectly now. Also the updated preview is faster now that its jpg instead of bmp.
All the zoom and focus features work.

Mostly it works, except for the time lapse option.
I will have to play some more with it.

Thank you for this work.
David

I think l have fixed the timelapse, download again.

Can you give the exact error regards ev, it appeared to work for me.

The error for ev when set to -1 or -2 is:
Option --ev can not be specified more than once.

For me timelapse does work. But what I didn't notice is it only saves as 0001, 0002, ete. And then rewrites over those file names each time you run it. Thats why I didn't notice it.
But works if file format is jpg. Bmp and png work, but saves as really large jpegs. If set to raw, then no images or files are saved.

The long exposure mode works great.

BETA3 uploaded, hopefully RAW timelapse and --ev fixed.

BETA4 uploaded, some minor fixes, v1 camera limited to 1 second max (see https://forums.raspberrypi.com/viewtopic.php?t=323733 ). Hopefully last BETA version.

I had tested beta 3 and time lapse was fixed and raw was fully working.
It looked ok but didn't test all features.

BETA6 uploaded. Hopefully cured the lockups. You can't send the libcamera commands too fast. Holding the buttons down will increment / decrement but not send the command until released.

BETA8 uploaded. Using libcamera-still for the preview was far too slow, now uses libcamera-vid.

I get the following errors with the newest version opened in Thonny:

pygame 2.1.0 (SDL 2.0.14, Python 3.9.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/home/pi/Downloads/Pi_LIbCamera_GUIV8/PiLibCameraGUI.py", line 129, in
vwidth = vwidths[vformat]
IndexError: list index out of range

Delete /home/pi/PiLCConfig3.txt and run again. I had to reduce the number of video formats and l guess your config file has a larger number than that for vformat.

Yes that fixed it. All working, thank you.
I also can confirm it works using the 64bit Bullseye beta. I just tested that now. Its also much faster using the 64bit OS.

BETA10 uploaded. 'FAST' mode added, set Timelapse Interval to 0 and it will take images as quick as possible dependent on Mode, Shutter, V_FPS, V_Format etc when you click Timelapse capture, for the duration set.

Thanks you. I will have to test that. I can confirm that version 8 also worked on Buster with a compiled libcamera-still to a build folder. I just needed to change the address for libcamera-still in your script to the build folder.
The only thing I have seen is images saved in the zoom mode will be saved at the screen resolution, regardless of zoom settings. So all 800x600 at default or 640x430 if you change that. Not a big deal as I don't really use that feature. I just use focus, to focus than click out and take an image.
I don't think your script needs to be called beta. It seems to work well.
I do think libcamera needs to be called beta though, as it will frequently drop frames. However, it will usually recover from its problems.

Thanks for the feedback. Now v1.0.
Regarding the zoom save settings, yes this is limited to the preview size. 2 reasons - first I wanted to allow it to save cropped stills/videos, possible use was planetary images, and secondly it was the easiest method as saving stills and videos at the zoom resolutions will be more complicated !. It maybe possible in future if really necessary.
New items: If using the FAST capture set Interval to 0 and Duration as required. FAST uses libcamera-vid so not the highest quality but maybe useful. You can set the resolution by setting V-Format. If you change the V-Codec to mjpeg you can then save timelapses (and videos) at upto the camera full resolution. This will impact on saving speed.

PS. I haven't found a way of reading videos saved as mjpeg yet !! But this sounds promising https://forums.raspberrypi.com/viewtopic.php?t=325229

If you are using the script at 640x480 resolution then please try the V10a version which has some fixes. Hopefully Libcamera will get improved in the future to cure the poor 640x480 results.

Hello Gordon! Thanks for the great work!

This does almost everything that I need for my camera project. But I am using a Hyperpixel Square Screen.

I'd love to have the full size 4:3 preview in the center with controls above and below the preview.

I'm a complete novice, is there any chance that I could change the gui myself? I guess I just need some basic directions where to start and use this as a project to learn.

HI,
Sorry I've only just noticed your comment.
Moving the keys across the bottom is possible try the latest version and set

preview_width = 720
preview_height = 540

sq_dis = 1

Closed