Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Last active March 19, 2023 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/f69f3ea0932be136dd61b81492dad64a to your computer and use it in GitHub Desktop.
Save Hermann-SW/f69f3ea0932be136dd61b81492dad64a to your computer and use it in GitHub Desktop.
GS camera preview corresponding to current GS camera crop settings
#!/bin/bash
if [[ "$1" == "--help" ]]; then echo Format: "$0" "[options]"; exit; fi
read -r w h dummy < <(libcamera-vid --list-cameras | \
tail -1 | cut -f2 -d/ | sed "s#x# #")
dummy=$dummy
libcamera-vid -t 0 --width "$w" --height "$h" --preview=0,0,"$w","$h" "$@"
@Hermann-SW
Copy link
Author

Hermann-SW commented Mar 19, 2023

$ shellcheck GScropView
$

If you changed GS camera crop settings, eg. with GScrop tool
https://gist.github.com/Hermann-SW/e6049fe1a24fc2b5a53c654e0e9f6b9c

then you might want to get camera preview with exactly that crop values for scene setup.
GScropView does set width, height and preview width and height accroding current crop settings.

Top window was displayed for 676x128, bottom window for 228x96 crop settings:

@Hermann-SW
Copy link
Author

Added "--help":

pi@raspberrypi4B2:~ $ ./GScropView --help
Format: ./GScropView [options]
pi@raspberrypi4B2:~ $ 

In "ssh -X" session, appending "--qt-preview" option allows to see libcamera-vid crop window preview remotely:

./GScropView --qt-preview

"--qt-preview" is needed in "ssh -X" session, but not if accessing remote Pi vncserver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment