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
960 stars 169 forks source link

search-speed / Not compatible with the major rewrite? #165

Open brewtide opened 5 months ago

brewtide commented 5 months ago

Hello! Love your software. I recently went to use the search function to see how well / if it would work for my use case, and unfortunately it didn't seem to work. (I've attached the end result at bottom),

I did see that many configuration variables had changed (since the 13* version...) and while not a programmer, managed to change how it doesn't work, but yet to get the search function to work!

I realize it was not fully completed / beta, but I was wondering if you had any suggestions? I may try to setup an instance of the older version of the software, and configure my image-size / position units into the old config, but have the images pull from the 13.* image creation location to see if that will work.

Again, thanks for your software -- I figured I'd reach out and ask if you had any suggestions since you were the creator! (And honestly, I'm not even sure if it 'worked' in the earlier speed-cam versions, but it seemingly did to some extent?)

search-speed.py ver 5.60 Loading Please Wait ..... Traceback (most recent call last): File "/home/bbrewer/speed-camera/./search-speed.py", line 76, in sw = 100 * image_bigger # default search rectangle Width ^^^^^^^^^^^^ NameError: name 'image_bigger' is not defined

######################################

Review Output

###################################### Press Enter to Return to Main Menu

SamDecrock commented 5 months ago

I've not tested the code, but from the looks of it I think you can fix it by replacing image_bigger with IM_BIGGER which changed name in the major update commit.

Update: I've run the code and you will need a few more changes:

# Initialize size of rectangle to crop for search matches
sw = 100 * IM_BIGGER  # default search rectangle Width
sh = 45 * IM_BIGGER  # default search rectangle height
crop_x_L = (MO_CROP_X_LEFT + 10) * IM_BIGGER
crop_x_R = (MO_CROP_X_RIGHT - 10) * IM_BIGGER
crop_y_U = (MO_CROP_Y_UPPER + 10) * IM_BIGGER
crop_y_D = (MO_CROP_Y_LOWER - 10) * IM_BIGGER

Not sure it works though as responds with:

Loading Target Search Image media/search/speed-5-20240323-1504239.jpg
ERROR: Problem Extracting search_rect from media/search/speed-5-20240323-1504239.jpg
ERROR: Problem Creating Search Rectangle.
       Cannot Search Match media/search/speed-5-20240323-1504239.jpg
brewtide commented 5 months ago

Hey, I appreciate it. I kind of rambled in my above original question, but like you, I had done those additional variable changes and ended up with the same result, which is where I was left stumped. (Not really a programmer). I didn't paste that output as I had done it a week before and couldn't fully remember the 'new error' I was getting.

I'll likely poke at this again this evening to see if I can figure it out -- Or I may just try to use one of the older versions (with old variables) but feed it my 'dataset'.

I was stuck at that point as well, and couldn't quite figure out steps beyond!