[PYTHON] Updated the watching camera in my home: (2) I encountered a problem in the trial operation

Introduction

This article corresponds to Part 2 of here. If you are interested in the content, I would appreciate it if you could see other parts. (Writing sequentially ...)

wrap up

--Last time (hardware preparation), we finally succeeded in starting the watching camera using the long-sought Rasberry Pi! ――But a problem is discovered. What should I do: thinking: --Let's sort out the repair points.

What was the challenge

Sometimes the camera image cannot be acquired

I made it a specification to acquire an image once every few seconds, but sometimes the image was blacked out or an image with only a part of the angle of view stretched was acquired. I used Python3's Opencv-python library to capture camera footage, but the behavior may not be within the desired update interval. When I tried running the system on a notebook PC, the phenomenon was not reproduced, so I thought it was a hardware factor → performance problem. (We did not verify the factors any further)

HTTP server response is slow

As for the system configuration, we made it a specification to browse camera images by running an HTTP server on Raspberry Pi and accessing it from a smartphone etc. on hand, but when accessing from a smartphone, the response until the page is loaded Is unusually slow. (About 10 to 20 seconds)

When I tried running the system on a notebook PC, I didn't reproduce the phenomenon, so I thought it was a hardware factor → a performance problem. Currently, I use OpenCV only to get still images from the camera, so I think there are many points for improvement ... but I feel like I shouldn't touch it. Was: cry:

Image brightness is inappropriate

There were two problems.

--Because the brightness and white balance are readjusted each time an image is acquired, there are many unnecessary changes in the image between frames. As a result, it is difficult to see the movements of the child who really wants to pay attention. --The image update rate is fixed (1 second), but especially when it is dark, the brightness and white balance adjustments are not finished properly at that time, and only dark images can be taken. (For example, if you use the standard Raspberry Pi command raspistill to get a still image in the same environment, you can get an image with appropriate brightness.)

For the former, the image acquisition setting is fixed (calibration is not performed each time), and for the latter, the calibration mode is implemented.

Conclusion: Summary of issues and countermeasures

item Correspondence
Performance improvement All I want to do is get still images and HTTP server, so implement it with minimum specifications
Image brightness optimization Fixed image acquisition settings and implementation of calibration mode

The former has already been remade from scratch ...! ** If I remake it anyway, should I make it in another language I'm studying so that I can learn new things ...? I decided to refine it in Go language (continued). ** **

Recommended Posts

Updated the watching camera in my home: (2) I encountered a problem in the trial operation
Updated home watching camera: Summary
I tried the super-resolution algorithm "PULSE" in a Windows environment
I wrote the basic operation of Numpy in Jupyter Lab.
I made a surveillance camera with my first Raspberry PI.
I wrote a script that splits the image in two
I tried "Implementing a genetic algorithm (GA) in python to solve the traveling salesman problem (TSP)"
What I learned by writing a Python Pull Request for the first time in my life