kennyvoo / SmartLib-Cz3002-

6 stars 0 forks source link

ZeroDivisionError: float division by zero #1

Open gigisu20 opened 9 months ago

gigisu20 commented 9 months ago

the part of the complier problem down below -------------------------------------------------------------------------------------------------------. (library) PS C:\Users\kitty\Desktop\library\CZ3002_Xeon\Detection_System> python Detection.py [ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-oduouqig\opencv\modules\videoio\src\cap_msmf.cpp (434) anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback [ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-oduouqig\opencv\modules\videoio\src\cap_msmf.cpp (434)anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback C:\Users\kitty\anaconda3\envs\library\lib\site-packages\google\cloud\firestore_v1\base_collection.py:295: UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead. return query.where(field_path, op_string, value) Traceback (most recent call last): File "Detection.py", line 208, in main() File "Detection.py", line 77, in main im = imutils.resize(im1, width=416) File "C:\Users\kitty\anaconda3\envs\library\lib\site-packages\imutils\convenience.py", line 87, in resize r = width / float(w) ZeroDivisionError: float division by zero


Hello,I would like to ask you the problem down below . Because I really want to successfully implement the system you wrote. But there are some problems now. I really need your help Since no one around me can solve this problem, I have been researching it for two weeks now hope you can help me soon. ---------------------------------------------------------------(i think the main problem ) im = imutils.resize(im1, width=416) r = width / float(w) ZeroDivisionError: float division by zero

kennyvoo commented 9 months ago

Hi, @gigisu20 I'll try my best to help you. this is a very old project. I can help you to rewrite it if you want. this code is very messy.
To debug your problem, can you do the following checks to see

  1. if you can get frame from camera

    
    
               cap = cv2.VideoCapture(CAMERA_IP[i])
               ret, frame = cap.read()
               if not ret:
                    raise(f'Error: failed to capture from {CAMERA_IP[i]}')
2.print the frame shape and the crop region 
```python
               ##Crop out seats images from the full picture
               for i in seatTemp:
                    print(frame.shape)
                    print(i["x1Img"],i["x2Img"],i["y1Img"],i["y2Img"])