pageauc / speed-camera

A Unix, Windows, Raspberry Pi Object Speed Camera using python, opencv, video streaming, motion tracking. Includes a Standalone Web Server Interface, Image Search using opencv template match and a whiptail Admin Menu Interface Includes picam and webcam Plugins for motion track security camera configuration including rclone sync script. watch-app allows remotely controller camera configuration from a remote storage service name. Uses sqlite3 and gnuplot for reporting. Recently added openalpr license plate reader support.
Apache License 2.0
987 stars 173 forks source link

Please help #38

Closed jasonsuthers closed 5 years ago

jasonsuthers commented 5 years ago

Hi Claude

Thanks for this project, although ive been pulling my hair out all day

Fron GUI when i run pi@raspberrypi:~/speed-camera $ ./speed-cam.py

I get this following Error

Loading ...

speed-cam.py 9.4 written by Claude Pageau

Traceback (most recent call last): File "./speed-cam.py", line 216, in if not os.path.exists(DB_DIR): # Check if database directory exists File "/usr/lib/python2.7/genericpath.py", line 26, in exists os.stat(path) TypeError: coercing to Unicode: need string or buffer, tuple found pi@raspberrypi:~/speed-camera $

I have the following Dir /home/pi/speed-camera/data/speed_cam.db i also added /home/pi/speed-camera/database not sure if it should be there but i seen ref to it i think will ive been looking through code

Any help would be greatly appreciated

Thank You Jason

selbstmacher commented 5 years ago

I've got the same issue. If running this in a vmware machine with debian 10 64Bit. I already installed everything with user pi to ensure the paths are correct but it didn't help. I think it has something to do with python, on debian 10 both 3.7 and 2.7 are installed, but I'm not used to python.

jasonsuthers commented 5 years ago

I know why its causing the fault now after some reading , but i cant see were its actually broken if i can crack it i will let you know

pageauc commented 5 years ago

OK. I found some extra comma's in the config.py variable file in the # Sqlite3 Settings approx line 132. Not sure this is the problem but it would appear this may be a problem. You can download a new copy per below or edit your existing config.py. Try this and let me know. Claude ...

wget -O config.py

https://raw.github.com/pageauc/speed-camera/master/config.py

On Thu, Aug 29, 2019 at 5:29 PM jasonsuthers notifications@github.com wrote:

I know why its causing the fault now after some reading , but i cant see were its actually broken if i can crack it i will let you know

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/38?email_source=notifications&email_token=ABNPKZHBPMSE3UXL6CGQYKTQHA5SJA5CNFSM4IRIUSSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5P4HUA#issuecomment-526369744, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNPKZHTL6TCOT3NSMRL25DQHA5SJANCNFSM4IRIUSSA .

-- See my YouTube Channel at http://www.youtube.com/user/pageaucp

jasonsuthers commented 5 years ago

Hi Claude, that was the problem its all working fine now i just edited the file, you wont belive how many times ive looked at the section today and couldnt see the problem, although i know a lot more about python now :)

Thank You and best regards Jason

pageauc commented 5 years ago

Please Note I have released ver 9.5 that does not hard code the db directory but rather does a

DB_DIR_PATH = os.path.join(baseDir, DB_DIR)

You can upgrade to this ver 9.5 and edit config.py for and edit config.py variable below to be safe.

DB_DIR = "data"

The wayward comma's were my problem and did not show up in testing since I already had an active sqlite3 database path Regards Claude ...

Let me know how you are doing. I would be interested. Regards Claude ...

On Thu, Aug 29, 2019 at 8:11 PM jasonsuthers notifications@github.com wrote:

Hi Claude, that was the problem its all working fine now i just edited the file, you wont belive how many times ive looked at the section today and couldnt see the problem, although i know a lot more about python now :)

Thank You and best regards Jason

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/38?email_source=notifications&email_token=ABNPKZCVTCHSDHE3GCGJGTDQHBQRJA5CNFSM4IRIUSSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QFALY#issuecomment-526405679, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNPKZAALA5FPRKJUKPBTN3QHBQRJANCNFSM4IRIUSSA .

-- See my YouTube Channel at http://www.youtube.com/user/pageaucp

jasonsuthers commented 5 years ago

Hi Claude

Thanks im just working through bringing a IP Camera feed into the program, Ive managed with some success then managed to break it after making some changes im still learning python, When i have it running again i can share with you hopefully you can point me in the right dirrection

Regards Jason

selbstmacher commented 5 years ago

The fix also worked for me. IP camera is working just fine.

pageauc commented 5 years ago

Can you send me IP camera code changes or configuration you are using and model of IP camera . Great Appreciated Claude ...

On Mon, Sep 2, 2019 at 12:47 PM selbstmacher notifications@github.com wrote:

The fix also worked for me. IP camera is working just fine.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/38?email_source=notifications&email_token=ABNPKZGNNLKM64QMIWBHIUTQHU7TRA5CNFSM4IRIUSSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5WHXZI#issuecomment-527203301, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNPKZAH5DPQWWQZYKYYP3LQHU7TRANCNFSM4IRIUSSA .

-- See my YouTube Channel at http://www.youtube.com/user/pageaucp

selbstmacher commented 5 years ago

It worked pretty straight forward. I just entered the rstp url that was displayed from the tool "ONVIF Device Manager". I tried several rtsp streams all worked well. It was important to enter the correct width and height. Thats it, here is my configuration: `

Camera Settings

WEBCAM = True # Default = False False=PiCamera True=USB WebCamera

Web Camera Settings

WEBCAM_SRC = "rtsp://192.168.189.64/RtspTranslator.12/camera" # Default= 0 USB opencv connection number WEBCAM_WIDTH = 768 # Default= 320 USB Webcam Image width WEBCAM_HEIGHT = 272 # Default= 240 USB Webcam Image height `

pageauc commented 5 years ago

Wow. That is exactly what I have seen mentioned and what opencv also mentions for receiving an IP cam stream. Setting the camera width and height are also important. I will include this in the wiki and as a comment in the config.py. Maybe create a plugin. I still don't have an IP cam since I have more than enough RPI's.

Thanks Claude ...

On Mon, Sep 2, 2019 at 2:09 PM selbstmacher notifications@github.com wrote:

It worked pretty straight forward. I just entered the rstp url that was displayed from the tool "ONVIF Device Manager". It was important to enter the correct width and height. Thats it, here is my configuration: ` Camera Settings

WEBCAM = True # Default = False False=PiCamera True=USB WebCamera Web Camera Settings

WEBCAM_SRC = "rtsp://192.168.189.64/RtspTranslator.12/camera" # Default= 0 USB opencv connection number WEBCAM_WIDTH = 768 # Default= 320 USB Webcam Image width WEBCAM_HEIGHT = 272 # Default= 240 USB Webcam Image height `

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/38?email_source=notifications&email_token=ABNPKZFIFR7YWUXJJMVRS73QHVJGRA5CNFSM4IRIUSSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5WLDWY#issuecomment-527217115, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNPKZEVGLEOJEUP6P7WBE3QHVJGRANCNFSM4IRIUSSA .

-- See my YouTube Channel at http://www.youtube.com/user/pageaucp

jasonsuthers commented 5 years ago

Wow i was over complicating matters on my end , works perfectly :)

Regards Jason

selbstmacher commented 5 years ago

I don't know if this should be like this: image but I would expect that the rectangle is there where the motion is. Or is this like it should be?

pageauc commented 5 years ago

Send me a copy of your config.py file and plugin if you are using one. Thanks

On Tue, Sep 3, 2019 at 12:37 AM selbstmacher notifications@github.com wrote:

I don't know if this should be like this: [image: image] https://user-images.githubusercontent.com/40370373/64144511-27455100-ce15-11e9-869d-f3368a0d278a.png but I would expect that the rectangle is there where the motion is. Or is this like it should be?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/38?email_source=notifications&email_token=ABNPKZFEDF5MCMONCLN2HH3QHXSXXA5CNFSM4IRIUSSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5W7QDI#issuecomment-527300621, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNPKZE7HGYTSEFGEZYSQI3QHXSXXANCNFSM4IRIUSSA .

-- See my YouTube Channel at http://www.youtube.com/user/pageaucp

selbstmacher commented 5 years ago

Flipping had to be turned off. Now everything works perfect.