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

The program is stuck at "Waiting for Connection" #9

Open
CodingMice opened this issue Jul 8, 2020 · 6 comments
Open

The program is stuck at "Waiting for Connection" #9

CodingMice opened this issue Jul 8, 2020 · 6 comments

Comments

@CodingMice
Copy link

I run the program following the "Quick Start", but when I click the "Start Thread" button, it seems that no response happen.

@TianxingWu
Copy link
Owner

Try to comment out the following line in SocketServer.cs

WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden

Then you should be able to see the error message sent by Python.

If it says "found no face" then, based on the previous enquiries I recieved, it might due to the wrong choice of the camera that you used to capture the video stream. To be specific, if you are using a plugged usb-camera rather than the built-in camera of the laptop, you should change the number "0" to "1" or others in the following line in visual_measurement.py:

cap = cv2.VideoCapture(0)

This error might also be caused by the revoking of permission of Python's access to camera or other reasons. Please feel free to sent more feedbacks if this solution doesn't work for you :)

@CodingMice
Copy link
Author

CodingMice commented Jul 9, 2020

Try to comment out the following line in SocketServer.cs

WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden

Then you should be able to see the error message sent by Python.

If it says "found no face" then, based on the previous enquiries I recieved, it might due to the wrong choice of the camera that you used to capture the video stream. To be specific, if you are using a plugged usb-camera rather than the built-in camera of the laptop, you should change the number "0" to "1" or others in the following line in visual_measurement.py:

cap = cv2.VideoCapture(0)

This error might also be caused by the revoking of permission of Python's access to camera or other reasons. Please feel free to sent more feedbacks if this solution doesn't work for you :)

Thank you to reply. I comment out the "WindowStyle" as your advise. I found that the error is the python has no module of "cv2". However, my system's python does has cv2 module. I could run in command line.

I use the full path of python. It can find the cv2 module. But new error happened. "SocketException: 由于套接字没有连接并且(当使用一个 sendto 调用发送数据报套接字时)没有提供地址,发送或接收数据的请求没有被接受。" It can not connect the socketServer.

@Arsennnic
Copy link
Contributor

Try to comment out the following line in SocketServer.cs

WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden

Then you should be able to see the error message sent by Python.
If it says "found no face" then, based on the previous enquiries I recieved, it might due to the wrong choice of the camera that you used to capture the video stream. To be specific, if you are using a plugged usb-camera rather than the built-in camera of the laptop, you should change the number "0" to "1" or others in the following line in visual_measurement.py:

cap = cv2.VideoCapture(0)

This error might also be caused by the revoking of permission of Python's access to camera or other reasons. Please feel free to sent more feedbacks if this solution doesn't work for you :)

Thank you to reply. I comment out the "WindowStyle" as your advise. I found that the error is the python has no module of "cv2". However, my system's python does has cv2 module. I could run in command line.

I use the full path of python. It can find the cv2 module. But new error happened. "SocketException: 由于套接字没有连接并且(当使用一个 sendto 调用发送数据报套接字时)没有提供地址,发送或接收数据的请求没有被接受。" It can not connect the socketServer.

Did you run the Python scripts in the virtual environment?

@RechieKho
Copy link

Hi, I met the same problem. And I fixed it thankfully. If you have your venv set up and install the cv version (my cv version is 3.4.0.12) as told, the problem may lie on the version of numpy.... try to uninstall numpy and pip install numpy==1.14.5.

What I suggest is run python visual_measurement.py on your own cmd so that you can get a clearer view on what happening

@RechieKho
Copy link

RechieKho commented Nov 28, 2020

Ok.... Let me specified all the step you might need to take.

  1. firstly, run python visual_measurement.py yourself on your own terminal. For me, the exception is the numpy.core.multiarray cannot be imported to cv.

if your exception is different:

  1. Tell us NOW.

else:

  1. In venv (use \YOURENV\Scripts\activate.bat if you are using window), uninstall numpy and install the right version using pip uninstall numpy & pip install numpy==1.14.5 (if your open cv is 3.4.0.12, else I really don't know sorry... maybe uninstall it and install the same version as mine?)

  2. redo first step. If still have problem, paste the exception to us and don't do step 4. else... you should get a window pop up in front of you with your gorgeous face in it.

  3. As soon as you see your face, close the windows and terminal, change the line 40 in SocketServer.cs to Execute("\"env\\Scripts\\activate.bat\" & cd PythonScript & python visual_measurement.py");// Execute python client script so that the python script run in your virtual environment. Then, immediately save it, start the game, and see your future waifu glaring at you.

If you successfully reach the final step and complete it, remember bring your future waifu and thank me.

@RechieKho
Copy link

This project is nice. Even though you are frowning in front of camera, the model still show happy expression

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

4 participants