Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-camera on Debian 11/RaspberryPi OS aarch64 #115

Closed
will-code-for-pizza opened this issue Jun 19, 2022 · 9 comments
Closed

Speed-camera on Debian 11/RaspberryPi OS aarch64 #115

will-code-for-pizza opened this issue Jun 19, 2022 · 9 comments

Comments

@will-code-for-pizza
Copy link

Hi all,
is there a possibility to run speed-camera on Debian 11 aarch64 ??

After successful install with speed-install.sh and some changes in config.py, I debugged my problem with

$ ./speed-cam.py
----------------------------------------------------------------------
speed-cam.py 11.23  written by Claude Pageau
Motion Track Largest Moving Object and Calculate Speed per Calibration.
----------------------------------------------------------------------
Loading  Wait ...
Traceback (most recent call last):
  File "/home/wartung/speed-camera/./speed-cam.py", line 339, in <module>
    from picamera.array import PiRGBArray
  File "/usr/lib/python3/dist-packages/picamera/__init__.py", line 72, in <module>
    from picamera.exc import (
  File "/usr/lib/python3/dist-packages/picamera/exc.py", line 41, in <module>
    import picamera.mmal as mmal
  File "/usr/lib/python3/dist-packages/picamera/mmal.py", line 49, in <module>
    _lib = ct.CDLL('libmmal.so')
  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libmmal.so: cannot open shared object file: No such file or directory

The libmmal.so error seems to be related to the non 64-bit functional picamera driver

raspberrypi/firmware#1558 (comment)

Under 64-bit 'libcamera' is recommended, but there is also a new version of 'picam' for 10 days, I will try out...
https://forums.raspberrypi.com/viewtopic.php?t=335832

Regards

@pageauc
Copy link
Owner

pageauc commented Jun 19, 2022 via email

@pageauc
Copy link
Owner

pageauc commented Jun 19, 2022 via email

@will-code-for-pizza
Copy link
Author

After a lot of tests, I can say, that the issue is related to Debian 11 and Python3 - also with 64 bit architecture.
Works like charm under Debian 10 32 bit

The only error I could find, was during installation script:

Package python3-imaging is not available but is provided by another package
referenced. This can mean that the package is missing, that it has been detached
or is only available from another source.
However, the following packages replace it:
   python3-pil

E: There is no installation candidate for package 'python3-imaging'.

@will-code-for-pizza
Copy link
Author

Sorry, I have to update this...

$ uname -a
Linux speedcam 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux


$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

$ ./speed-cam.py
----------------------------------------------------------------------
speed-cam.py 11.23  written by Claude Pageau
Motion Track Largest Moving Object and Calculate Speed per Calibration.
----------------------------------------------------------------------
Loading  Wait ...
----------------------------------------------------------------------
Note: To Send Full Output to File Use command
python -u ./speed-cam.py | tee -a log.txt
Set log_data_to_file=True to Send speed_Data to CSV File speed-cam.log
----------------------------------------------------------------------

Debug Messages .. verbose=True  display_fps=True calibrate=True
                  show_out_range=True
Plugins ......... pluginEnable=True  pluginName=picam240
Calibration ..... cal_obj_px_L2R=80 px  cal_obj_mm_L2R=4700 mm  speed_conv_L2R=0.21150
                  cal_obj_px_R2L=85 px  cal_obj_mm_R2L=4700 mm  speed_conv_R2L=0.19906
                  (Change Settings in /home/wartung/speed-camera/plugins/picam240.py)
Logging ......... Log_data_to_CSV=True  log_filename=speed-cam.csv (CSV format)
                  loggingToFile=True  logFilePath=speed-cam.log
                  SQLITE3 DB_PATH=/home/wartung/speed-camera/data/speed_cam.db  DB_TABLE=speed
Speed Trigger ... Log only if max_speed_over > 0 kph
                  and track_counter >= 6 consecutive motion events
Exclude Events .. If  x_diff_min < 1 or x_diff_max > 30 px
                  If  y_upper < 60 or y_lower > 17 px
                  or  x_left < 20 or x_right > 300 px
                  If  max_speed_over < 0 kph
                  If  event_timeout > 0.40 seconds Start New Track
                  track_timeout=0.00 sec wait after Track Ends (avoid retrack of same object)
Speed Photo ..... Size=960x720 px  image_bigger=3.0  rotation=0  VFlip=True  HFlip=True 
                  image_path=media/images  image_Prefix=speed-
                  image_font_size=12 px high  image_text_bottom=True
                  image_jpeg_quality=75  image_jpeg_optimize=True
Motion Settings . Size=320x240 px  px_to_kph_L2R=0.211500  px_to_kph_R2L=0.199059 speed_units=kph
                  CAM_LOCATION= None
OpenCV Settings . MIN_AREA=100 sq-px  BLUR_SIZE=10  THRESHOLD_SENSITIVITY=20  CIRCLE_SIZE=5 px
                  WINDOW_BIGGER=1 gui_window_on=False (Display OpenCV Status Windows on GUI Desktop)
                  CAMERA_FRAMERATE=30 fps video stream speed
Sub-Directories . imageSubDirMaxHours=0 (0=off)  imageSubDirMaxFiles=2000 (0=off)
                  imageRecentDir=media/recent imageRecentMax=300 (0=off)
Disk Space  ..... Disabled - spaceTimerHrs=0  Manage Target Free Disk Space. Delete Oldest jpg Files
                  spaceTimerHrs=0 (0=Off) Target spaceFreeMB=1000 (min=100 MB)

----------------------------------------------------------------------
Logging to File speed-cam.log (Console Messages Disabled)
OpenCV Error: Assertion failed (dims <= 2 && step[0] > 0) in locateROI, file /build/opencv-L65chJ/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp, line 949
Traceback (most recent call last):
  File "./speed-cam.py", line 2025, in <module>
    speed_camera()  # run main speed camera processing loop
  File "./speed-cam.py", line 1347, in speed_camera
    grayimage1, contours = speed_get_contours(image2, grayimage1)
  File "./speed-cam.py", line 1216, in speed_get_contours
    differenceimage = cv2.blur(differenceimage, (BLUR_SIZE, BLUR_SIZE))
cv2.error: /build/opencv-L65chJ/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:949: error: (-215) dims <= 2 && step[0] > 0 in function locateROI

@will-code-for-pizza
Copy link
Author

WEBCAM = True
WEBCAM_SRC = 0

These settings have no affect to the error

@pageauc
Copy link
Owner

pageauc commented Jun 19, 2022 via email

@will-code-for-pizza
Copy link
Author

Hi Claude, thanks for that statement.

The issue is, that I currently use Raspberry Pi OS Legacy Buster.
Yesterday I had serveral installations (from Raspberry Pi OS Lite Bullseye 64 bit down to my current installation Raspberry Pi OS Legacy Buster) and obviously, on Legacy Buster the installation process runs much better.

I have to mention, that my user accout is NOT 'pi', thats why I opened another ticket with "improvements".
I will do a totally fresh install of Raspberry Pi OS Legacy Buster, the 'pi' user and speed-cam and would document the remaining problems here.

Don't worry about... I know, this is a hobby project. I just want to give you some informations to improve some issues.
Regards
Will

@pageauc
Copy link
Owner

pageauc commented Jun 20, 2022 via email

@will-code-for-pizza
Copy link
Author

Closed to #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants