neozhaoliang / surround-view-system-introduction

A full Python implementation for real car surround view system
MIT License
857 stars 303 forks source link

Run_Live_Demo.py does not work in Windows 10 #88

Closed lsieczka closed 4 months ago

lsieczka commented 4 months ago

Trying to get Run_Live_Demo.py to work in Windows 10 running Python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)], I have OpenCV 4.9.0.

When I run Run_Live_Demo.py, the attached webcam turns on, but I do not see a pop-up with a birds eye view of the car with my camera in it. I can run run_get_projection_maps.py and that works fine, but for some reason not Run_Live_Demo.py

My webcam is index 1. There are no errors - as far as I can tell.

Any ideas?

lsieczka commented 4 months ago

I tried the same code on Ubuntu 18.04.6 LTS using Visual Studio Code. I can view the camera (index 4) using your test_cameras.py utility and the camera works great. OpenCV is version 3.2.0 and Python is version 3.6.9

image

Thanks again, any help is appreciated.

neozhaoliang commented 4 months ago

Hi, do you mean that you have all four cameras correctly installed, and you can open each of them individually, but when running the run_live_demo.py, you cannot see the birdview image and no error is reported?

lsieczka commented 4 months ago

Hello! Yes, I have 4 web cameras plugged into a laptop. I used your tool to get their index numbers and was trying to run them in run_live_demo.py, but can't seem to get past that "Cannot open camera" error. All the cameras just say cannot open camera #.

Is there maybe a version of something I might have wrong?

neozhaoliang commented 4 months ago

By default the code opens your camera with libgstreamer, while the code in test_camera.py simply tries to open it using USB. You may need to set the parameter use_gst=True to False.

https://github.com/neozhaoliang/surround-view-system-introduction/blob/master/surround_view/capture_thread.py#L75

And this project cannot create the birdview if you haven't calibrated your cameras, and do the manual projection calibration step. Have you read the documentation?

lsieczka commented 4 months ago

I see. That completely makes sense. Would it be hard to modify the code to use an external http (IP Camera)? I would like to eventually use a URL like 'http://192.168.0.90/mjpg/video.mjpg'. The eventual goal of this would be to try using your code on a shiploader. It's a huge machine that loads vessels. image

neozhaoliang commented 4 months ago

The actual camera device doesn't make any difference: you just need to set the way how it's opened in the capture_thread.py.