Hyperpixel as digital viewfinder with PI HQ camera

Hello,

I purchased the Hyperpixel 4.0 that is connected to the PI-4B with a PI HQ Camera.

I would like to act the Hyperpixel as a viewfinder that projects the continously the videostream (image) like in a normal digital-camera. So far I only see projects in which photo’s are stored and finally looked-back (reviewed) on the screen.

The closed project I see is the the below one. In fact I want use that blue dot as well to start and stop recording of the videostream.

https://forums.pimoroni.com/t/raspi-camera-with-hyperpixel-and-blue-dot/6033

Finally I want to connect the HQ cam to a telecoop thats why I need contionious stream to see where i am pointing to.

Is there any link to a project or site achieves the above?

Thanks in advance, Anthony

Have a look at this, may be adaptable to work with the Hyperpixel
Overview | DIY WiFi Raspberry Pi Touchscreen Camera | Adafruit Learning System

Hello Anthony, nice to meet you, and welcome to the Forum!

I am the original author of the post you are referring to.

Two years ago I built a version 2 camera with RPi4-2GB/HQCamera/HyperPixel4.0Square

BlueDot trigger is always nice and easy solution on handheld HyperPixel projects, but for this camera sitting on a GorillaPod I needed something different, so I “developed” this script, scraped and stitched together from various sources.

The script uses a keyboard as a trigger for still images and timed video capture. The smaller the keyboard, the cooler your device. I use a Rii keyboard, but any keyboard wiil do!

Ok wait, this only works with RasPiOs Buster and older.

import sys, termios, tty, os, time
from picamera import PiCamera, Color

camera = PiCamera()
camera.start_preview()

def getch():
    fd = sys.stdin.fileno()
    old_settings = termios.tcgetattr(fd)
    try:
        tty.setraw(sys.stdin.fileno())
        ch = sys.stdin.read(1)

    finally:
        termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
    return ch

while True:
    char = getch()

    if (char == "1"):
        camera.stop_preview()
        camera.start_preview()
        camera.resolution = (3840, 2160)
        camera.iso = 200
        ts=time.strftime("%Y-%m-%d-%H%M%S", time.gmtime())
        camera.capture('/media/pi/KINGSTON/camera/img-'+ts+'.jpg')

    if (char == "2"):
        camera.stop_preview()
        camera.start_preview()
        camera.resolution = (3840, 2160)
        camera.iso = 100
        ts=time.strftime("%Y-%m-%d-%H%M%S", time.gmtime())
        camera.capture('/media/pi/KINGSTON/camera/img-'+ts+'.jpg')

    if (char == "3"):
        camera.stop_preview()
        camera.exposure_mode = 'auto'
        camera.start_preview()
        camera.resolution = (3840, 2160)
        camera.iso = 400
        ts=time.strftime("%Y-%m-%d-%H%M%S", time.gmtime())
        camera.capture('/media/pi/KINGSTON/camera/img-'+ts+'.jpg')

    if (char == "q"):
        print("stop")
        exit(0)

    if (char == "v"):
        camera.resolution = (1348, 762)
        camera.framerate = 25
        ts=time.strftime("%Y-%m-%d-%H%M%S", time.gmtime())
        camera.start_recording('/media/pi/KINGSTON/camera2/vid-'+ts+'.h264')
        camera.wait_recording(30)
        camera.stop_recording()
        camera.annotate_text_size = 60
        camera.annotate_background = Color('black')
        camera.annotate_foreground = Color('white')
        camera.annotate_text = ' Video ready! '
        time.sleep(2)
        camera.annotate_text = ''
        time.sleep(0.2)

As you can see, keys “1”, “2” and “3” just sets the camera ISO before capturing a still.
“v” captures a 30sec video
“q” quits

Set your paths accordingly

This will get you going and make a good starting point for your camera experiments, especially when mounting your camera stationary.
You can also install BlueDot on your Android device and use it as a remote for your camera.

The true video start/stop functionality would be your programming challenge?
If you do solve it, please share your solution!

I can post some pics of my camera, if you wish.

Let’s hear from you ok?

EDIT:
My RPi4 is running Buster and therefore a legacy Raspicam camera stack.

Now, my script has to be written using libcamera software. Hmm. Wait a minute… I’ll have to study this. There is no Python support using libcamera, which is disappointing.

I see I would have to build my camera anew starting with a fresh RasPiOs, see how HyperPixel install goes, and learning those “new” camera apps… I am so late with this thing! :D

Can’t help but wondering why would I ever want to use HyperPixel4 on Bullseye?
Buster is heavenly good for this particular combination of hardware.

Thank you for your fast response Alphanumeric. I wil have a good look.

I have a half dozen + camera setups using Raspberry Pi’s on the go here. 3A’s, 3B’s and 4B’s. Mostly V2 cameras and one HQ. I use MotionEye OS. It was the best I could find at the time, and free. Support has stalled lately, but its still usable.
My camera setups are all headless video streams over my LAN. It’s what works or me. I just want to keep an eye on what my dog is up to when outside on her rope etc.

Thanks to you as well, Thelittlemonkeyinme. This come close to my goal. I am quite busy now but will start to play with it when I have got more time.

My goal is to mount the HyperP4 + PI4 + HQCAM to a
I want with one screen push button to start a preview (continious image) to search for and to
to focus on the to be filmed / photographed target. With another button(s) I want to start and stop filming while I keep on seeing the realtme image on the Hyperpixel display. Because I need to focus on getting the target image on the screen, I probably do not wan to to make use of an addition keyboard. Maybe I want too much ;-)

Yes please submit a few of your pics.

Kind regards,

Anthony,

Hello everyone,

finally I found the time to study these things and succesfully built a functional/usable camera!

First thing for me to learn was that Hyperpixel4 driver installation method depends on the build year of the display board. Honestly, I tried 5+ times to get my Hyperpixel4Square working on latest Bullseye, adding .dtbos to the config.txt, until I realized I have a 2020(or earlier) Hyperpixel4 board. What a relaxing learning experience :)

Now I have a fully functional software setup on said hardware:

RPi4-2GB
Hyperpixel4 Square 2020(or earlier)
RPi HQ Camera with a focusable 16mm lens

Latest 64bit Raspberry Pi OS Bullseye

Bluedot

Picamera2 Python library

Note that this is not something you’ll have to install. It’s already built-in the OS.

Don’t forget to read the Picamera2 documentation:

That’s all you need to get started.


Using focusable lenses on any camera obviously needs a preview of some kind. The best would be a constant preview, right? With the old raspicam/picamera software the preview was always on top of everything on display screen, making it hard to work with. A while ago when testing…things, I managed to set the preview so the preview window was, like, floating left and Bluedot to its right, but only with my old Hyperpixel3.5 display, never with my HP4Sq.

Picamera2 introduces interesting new methods for camera preview, just read the manual.pdf

Here’s my first contribution for the new era of RPi photography with Hyperpixel displays. It uses the good old local MockBluedot touch trigger and a constant resizable and movable QT preview window! The script saves your images as .jpg’s onto your path destination.

@Anthony, this is just a very basic start for your camera application. Experiment, expand, have fun, and share what you learned!

#!/usr/bin/python3

import time
from bluedot import MockBlueDot
from signal import pause
from picamera2 import Picamera2, Preview

bd = MockBlueDot()
picam2 = Picamera2()

preview_config = picam2.create_preview_configuration(main={"size": (1920, 1080 )})
picam2.configure(preview_config)

picam2.start_preview(Preview.QT)

picam2.start()

def capture_still():
    ts = time.strftime("%Y-%m-%d-%H%M%S", time.gmtime())
    metadata = picam2.capture_file("/home/pi/camera/img-"+ts+".jpg")
    print(metadata)

bd.when_pressed = capture_still

bd.launch_mock_app()

pause()

P.S.
Pics still on the way
(My) keyboard -driven camera trigger script originates to:

It’s still excellent way to control things.

Thanks again ’ thelittlemonkeyinme’ for your contribution.
I really need to make time to spend some effort on this.
It was / is still outstanding on my list. Your code is a good basline for me to work from.

Kind regards - Anthony