RoadTest: Raspberry Pi HQ Camera
Author: surbhika
Creation date:
Evaluation Type: Development Boards & Tools
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: Raspberry Pi Camera Module V1 and V2
What were the biggest problems encountered?: Focusing the camera using VNC
Detailed Review:
Raspberry Pi HQ Camera flaunts the Sony IMX477R Image Sensor (back-illuminated, 12.3MP, 7.9mm sensor diagonal, 1.55um X 1.55 um pixel size).
(Datasheet of Sony IMX477R Image Sensor is attached for reference)
The image sensor is important because it directly influences how good or bad the final images will look. The MegaPixel (MP) rating is the number of light-sensitive sites (pixels) present on a given size of the image sensor. It determines how much we can practically scale-up the images without actually breaking them into pixels.
The back illumination technology is what allows to capture better photos in low lights.
Element14 sent me over this kit which consisted of:
The HQ Camera accepts CS-Mount lenses by default but is able to connect easily with CS-Mount lenses also using the supplied adapter.
So the 6mm lens provided in the kit uses the adapter while 16mm goes directly to the camera sensor.
Next, Setting up the camera is pretty quick:
Plug the ribbon cable right > go to raspberry pi interfaces > Enable the camera> already done!!
But we don't have any image yet..
So it is easy to find out in the first search that the raspberry pi comes with two popularly used packages, namely: raspistill and raspivid to handle images and videos respectively.
TBH, I was interfacing any camera for the first time with the pi. So i was expecting there would be some kind of GUI (given there is special connector on the board) already installed in my Pi. To flop the excitement, I could not find any Camera software GUI pre-packaged in the Raspbian OS.
Following line of code in the terminal window should get you the first image of the new Camera Sensor.
raspistill -o test.jpg
But this image would most probably be a blurred one if you've not already set the focus and aperture of the lens.
So was in my case. Because I typically access my raspberry pi using VNC (Virtual Network Computing) through my laptop, trying to preview the camera in VNC and be able to focus it through caused me a lot of effort before I finally gave in to set up a display to be able to focus the camera.
I couldn’t find any possible way to preview the camera and adjust the focus on a headless raspberry pi. I did not try live video streaming over WiFi because even if did work, this was a lot of pain to bear to just get the manual focus right. So, I just jumped over to the HDMI display and it worked as smoothly as it could be.
It was fair easy to follow the below few lines of code to preview the camera:
(It doesn’t require any extra library installation)
from picamera import PiCamera from time import sleep camera = PiCamera() try: camera.start_preview() sleep(10) camera.start_preview() finally: camera.close()
So I adjusted the focus and aperture of the camera sensor and could finally have my first crisp image from the HQ camera as follows:
Points for the feasibility of use: it was 3/5 for me (deduct each for display and GUI)
Following is a 12.33megapixels (4056 x 3040 pixels) highest resolution image of 6.9MB size on disk, through the HQ Camera + 16mm lens.
The colors are bright, crisp and the orange seems to be dying while capsicums look pretty fresh.
Quick Note: To get the highest resolution image/video, I had to increase the GPU memory.
I tried to capture the depth of resolution with the following image:
It is a hand-knitted pullover made by my mother and she said that using this camera image, one who is an expert in knitting can copy my knitting design. That sounded just like a compliment!! It's definitely a win for HQ Camera.
I originally planned to capture a beautiful sunrise time-lapse from my high balcony. But the winters and foggy weather in India nowadays removed beautiful from it and now it's just a time lapse video of sunrise to sunset.
Raspberry Pi HQ Camera + 16mm lens was used.
I tried to adjust the aperture somewhere mid-way so it doesn't kill all lightings during the night hours and also not give a completely white screen during the day. And for that matter, the camera performed well as you can see.
Considering 10s as a good sampling time to capture a beautiful sunlight/sunrise, one can create a timelapse of one's own using the following code:
from picamera import PiCamera from os import system from time import sleep camera = PiCamera() #camera.resolution = (1024, 768) camera.resolution = (2592, 1944) i=0 while True: camera.capture('image{0:04d}.jpg'.format(i)) i += 1 sleep(10) key = cv2.waitKey(1) rawCapture.truncate(0) if key == 27: break camera.close()
I suggest you watch the below video first and read the following content later to save yourself some spoiler.
I developed this project with my Laptop WebCam when I was learning image processing and OpenCV for the first time. I made several changes to the code to be able to deploy the same script to Raspberry Pi.
For this project, I have used the following items:
To simplify for those who have not already understood how I was able to do this, I took few frames of the background before I came in front of camera. Later I have deployed a color recognition code wherein the detected color (used for cloak) will be masked with background frame. It is pretty simple... right?
For those who wish to recreate this project, please find the code attached. And note that the video is recorded at 640x480 resolution.
Extra Tip:
For me, the range of hsv values that I needed to detect the cloak were following:
# You'll have to adjust following two lines as per your chosen color of cloak: lowerLimit = np.array([0,0,180]) upperLimit = np.array([180,70,255])
My experience to deploy the project from Windows-Webcam to Raspberry pi HQ Camera: