Go to advanced search

by trlaing
Sat Feb 04, 2023 6:09 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

After fighting with some Python version and dependency issues (I'm not a coder!!!), I've got this far: [0:08:24.285458295] [1990] INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66 [0:08:24.409161126] [1991] INFO RPI raspberrypi.cpp:1425 Registered camera /base/soc/i2c0mux/i2c@1/imx708...
by trlaing
Fri Feb 03, 2023 8:29 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

Yes, of course. It's not the tidiest code as I've just been tweaking away at it, but here its: #!/usr/bin/python3 import time, os from datetime import datetime from libcamera import controls, Rectangle import numpy as np from picamera2 import Picamera2, MappedArray from picamera2.encoders import H26...
by trlaing
Thu Feb 02, 2023 11:20 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

I believe the following line achieves the above:

Code: Select all

cur = cur[:w * h].reshape(h, w)[300:428, 300: 540]
This is cropping the 480x640 numpy array to a 128x240 array below and left to the centre of the image. I think it is working...
by trlaing
Thu Feb 02, 2023 9:08 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

The next thing I would like to do is only focus on motion changes in a small portion of the video. Camera.png I presume that the following lines look for changes in the entire image area resized to 640x480 pixels? Or does it just use the centre 640x480 pixels? video_resolution = (1920, 1080) lsize =...
by trlaing
Tue Jan 31, 2023 12:48 pm
Forum: Python
Topic: Python2 code to Python3 conversion for Ultraship U2 v2 scales
Replies: 6
Views: 390

Re: Python2 code to Python3 conversion for Ultraship U2 v2 scales

I have got it working with Python3 by making the following changes: Line 51 from self._buf = '' to self._buf = ''.encode() Line 98 from self._buf = self._buf[self._buf.find('\x02'):] to self._buf = self._buf[self._buf.find('\x02'.encode()):] Line 105 from return result to return result.decode() New ...
by trlaing
Mon Jan 30, 2023 10:23 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

Okay. When I start the camera, this is the output: [0:05:34.543091014] [2332] INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66 [0:05:34.564807924] [2333] WARN CameraSensorProperties camera_sensor_properties.cpp:205 No static properties available for 'imx708_wide' [0:05:34.564866868] [...
by trlaing
Sat Jan 28, 2023 7:11 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

It should be fixed now. Try apt update/upgrade. The fixes are in libcamera0, python3-libcamera. Now the control accepts a list of tuple(s) of four integers: [ (x,y,w,h) ] measured in full-resolution pixels Usually, a single rectangle covering 1/12 - 1/4 of the total area gives best performance. Exa...
by trlaing
Fri Jan 27, 2023 10:16 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

libcamera-apps, libcamera-tools and python3-libcamera all updated today - is the AfWindows issue likely to be sorted? I'm scared to try it as my Raspberry Pi was crashing and I had to power off at the wall to restart it - don't like doing that!
by trlaing
Thu Jan 26, 2023 1:53 pm
Forum: Python
Topic: Python2 code to Python3 conversion for Ultraship U2 v2 scales
Replies: 6
Views: 390

Python2 code to Python3 conversion for Ultraship U2 v2 scales

Hi have a set of Ultraship U2 v2 scales that I am currently using Python 2 to read successfully, using the following code: #!/usr/bin/python import serial from ultraship_u2v2 import UltrashipU2v2 device = serial.Serial("/dev/ttyUSB0", 9600) scale = UltrashipU2v2(device) while True: print(&...
by trlaing
Wed Jan 25, 2023 7:11 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

So is there an apt picamera2 version we could go back to temporarily with setting AfWindows working? I looked back in github picamera2 repo history, and the answer seems to be no. I found a bad workkaround, not useful when wanting to change autofocus window from Pyth: execute "libcamera-vid -t...
by trlaing
Tue Jan 24, 2023 11:47 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

2. The focus in the image is not on the centre of the image, but on a shelf that is closer and makes the image very blurry. How can I make it focus on the centre of the image? That should be possible by setting "AfWindow" control with picamera2. I tried adding the line: picam2.set_control...
by trlaing
Tue Jan 24, 2023 11:06 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Re: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

Hi, thanks for the questions. 1. You can set the framerate to 15fps. I would do this after calling "configure", just before you call "start". picam2.set_controls({"FrameRate": 15}) 2. You might need to start continuous autofocus. In the same place add picam2.set_contro...
by trlaing
Tue Jan 24, 2023 9:50 am
Forum: Camera board
Topic: Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate
Replies: 25
Views: 1093

Raspberry Pi Python Picamera2 Motion Detection Camera Frame Rate

I am trying to write my own motion detection camera Python program for my Raspberry Pi for recording video when motion is detected. I have the following code using Python Picamera2: #!/usr/bin/python3 import time, os from datetime import datetime import numpy as np from picamera2 import Picamera2 fr...
by trlaing
Wed Jan 18, 2023 12:42 pm
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

Yes! Fresh install of image (2022-09-22-raspios-bullseye-arm64.img.xz), no further installs of picamera2 as it is included. The Python test code works fine (I do get an error "RuntimeError: Failed to reserve DRM plane", but I guess this is due to it being headless?). The image and video fi...
by trlaing
Wed Jan 18, 2023 12:04 pm
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

therealdavidp wrote:
Wed Jan 18, 2023 11:57 am
Yes. libcamera and Picamera2 work on 64-bit images.
Good, I'll write the latest 64-bit image and try it.
by trlaing
Wed Jan 18, 2023 11:53 am
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

I just had a thought - my Raspberry Pi 4 has Bullseye 64-bit on it... Should this work on 64-bit?
by trlaing
Wed Jan 18, 2023 11:21 am
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

I'm sorry it's proving difficult. But my advice is to install a fresh image, let it do its usual updates when it first boots, then touch/install absolutely nothing else, and it should just work. My original idea was to use it with the motion package, but it I couldn't get it to work with that eithe...
by trlaing
Wed Jan 18, 2023 11:04 am
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

Hard to know for sure what's happening. pip often installs packages in your home directory, so you may have something lurking there, or somewhere else. Maybe search for every "picamera2" folder on your system and delete anything that isn't the apt one? I don't suppose installing a clean i...
by trlaing
Wed Jan 18, 2023 10:37 am
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

Sounds like pip is spotting the apt installed version, and bailing out in a panic. You may have to track it down manually an delete it. Or perhaps try deleting the apt version, then delete the pip one, then re-install the apt one? sudo apt remove python3-picamera2 Reading package lists... Done Buil...
by trlaing
Wed Jan 18, 2023 10:31 am
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Re: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

Hi, not sure what's going wrong there. I'd remove the pip installation and just use the one from apt, I wonder if pip is giving you an old version? The most recent version is 0.3.8 which is what you should use. Can you confirm that you're getting libcamera and libcamera-apps all from apt as well an...
by trlaing
Wed Jan 18, 2023 9:53 am
Forum: Camera board
Topic: Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed
Replies: 12
Views: 297

Raspberry Pi 4 Bullseye Pi Camera Module 3 picamera2 configuration failed

I have a Raspberry Pi 4 with Bullseye and a Pi Camera 3 module. I can successfully take images using libcamera-jpeg and libcamera-vid, but cannot get Python picamera2 working. It is a headless Pi. I have installed picamera2 using the following commands: sudo apt install -y python3-picamera2 pip3 ins...
by trlaing
Tue Jan 17, 2023 1:30 pm
Forum: Troubleshooting
Topic: Is it possible to get a Pi Camera 3 working with Raspberry Pi 4 with Buster OS?
Replies: 6
Views: 381

Re: Is it possible to get a Pi Camera 3 working with Raspberry Pi 4 with Buster OS?

In theory you could get Buster working, but you'll need: an updated 5.15 kernel updated firmware if you want to use camera_auto_detect=1 updated libcamera updated libcamera-apps updated picamera2 rpi-update would be one approach for 1 & 2. The others you could build from source. The question is...
by trlaing
Fri Jan 13, 2023 2:37 pm
Forum: Troubleshooting
Topic: Is it possible to get a Pi Camera 3 working with Raspberry Pi 4 with Buster OS?
Replies: 6
Views: 381

Re: Is it possible to get a Pi Camera 3 working with Raspberry Pi 4 with Buster OS?

The Raspberry Pi Camera Module 3 will only work with Bullseye using libcamera (and not the legacy camera stack), specifically versions from January 2023 onwards. So why does the second link I provided say the following? Users running Buster will need to install one of the libcamera-apps packages fi...
by trlaing
Fri Jan 13, 2023 12:08 pm
Forum: Troubleshooting
Topic: Is it possible to get a Pi Camera 3 working with Raspberry Pi 4 with Buster OS?
Replies: 6
Views: 381

Is it possible to get a Pi Camera 3 working with Raspberry Pi 4 with Buster OS?

Hi, I recently purchased a Raspberry Pi Camera Module 3 from Pimoroni. The device I wish to use it with is a Raspberry Pi 4 8GB running Raspberry Pi OS (Raspbian GNU/Linux 10 (buster)) in an Argon One M.2 case. One function of this device is as a CCTV with a USB web cam using "motion" to c...
by trlaing
Sat Mar 05, 2022 9:31 am
Forum: Raspberry Pi OS
Topic: Private Internet Access VPN app find router external IP address
Replies: 4
Views: 287

Re: Private Internet Access VPN app find router external IP address

Good idea, thank you! I use the following code to acquire the current IP address of the url in Python3.7: import dns.resolver def getUrlIp(url): return dns.resolver.resolve(url, "A")[0].to_text() If the url contains a path, the following removes it: from urllib.parse import urlparse url_ne...

Go to advanced search