Giter VIP home page Giter VIP logo

Comments (8)

Julius-ZCJ avatar Julius-ZCJ commented on May 10, 2024 1

Thank you for your reply. I modify it now, but I meet some other errors:
1).when I use NetGear frist demo, using sever and client in same container, I got this error:
AttributeError: 'NetGear' object has no attribute 'id' (this error raise in client)
2).when I use NetGear second demo, using server and client in differ container, using tcp connect, I got follow error:
zmq.error.ZMQError: Cannot assign requested address
ValueError: Failed to bind address: tcp://192.168.1.xxx: xxxx and pattern: 0! Kindly recheck all parameters.(this also raise in client)

it tell me my address is error, I can't connect my server ,what can I do to solve this problem?

from vidgear.

Julius-ZCJ avatar Julius-ZCJ commented on May 10, 2024 1

@abhiTronix Thank you vary much, I have solved this problem

from vidgear.

abhiTronix avatar abhiTronix commented on May 10, 2024

@Julius-ZCJ Thanks for reporting this bug. As temporary workaround Kindly remove flag attribute for now (as it's useless in current scenario) from **options dict which then becomes:

options = {'copy': False, 'track': False} //without `flag`

Also, I'm push fix for this bug in development branch shortly. Stay tuned.

from vidgear.

abhiTronix avatar abhiTronix commented on May 10, 2024

1).when I use NetGear frist demo, using sever and client in same container, I got this error:
AttributeError: 'NetGear' object has no attribute 'id' (this error raise in client)

@Julius-ZCJ This bug is already been fixed in the development branch, I'm posting related instructions shortly. As a workaround, you can enable logging=True in Netgear Class as follows:

client = NetGear(receive_mode = True, logging = True)

2).when I use NetGear second demo, using server and client in differ container, using tcp connect, I got follow error:
zmq.error.ZMQError: Cannot assign requested address
ValueError: Failed to bind address: tcp://192.168.1.xxx: xxxx and pattern: 0! Kindly recheck all parameters.(this also raise in client)

@Julius-ZCJ Kindly change address and port parameter to your Client's IP Address, you can use: hostname -I terminal command to know client's IP address and assign a unique Port address also.

from vidgear.

Julius-ZCJ avatar Julius-ZCJ commented on May 10, 2024

@abhiTronix I have successed in first demo ,but I'm failed in second demo.
I run server in container, which ip is 172.17.0.8. And the container host ip is 192.169.1.149,
I mount port is 5454->5454, and my pc ip is 192.168.1.189

I run client in my pc, my pc ip is 192.168.1.189. So, what ip i could used in server, what ip i could used in client? I first use 172.17.0.8, and run client in same container with same ip, and I successed.
But when I run server in container with ip 172.17.0.8, and run client in my pc with ip 192.169.1.149
I always failed. I have tried to using container ip in client but it also failed. what can I do to make container can connect my pc?

from vidgear.

abhiTronix avatar abhiTronix commented on May 10, 2024

but I'm failed in second demo.
I run server in container, which ip is 172.17.0.8. And the container host ip is 192.169.1.149,
I mount port is 5454->5454, and my pc ip is 192.168.1.189

I run client in my pc, my pc ip is 192.168.1.189. So, what ip i could used in server, what ip i could used in client? I first use 172.17.0.8, and run client in same container with same ip, and I successed.
But when I run server in container with ip 172.17.0.8, and run client in my pc with ip 192.169.1.149
I always failed. I have tried to using container ip in client but it also failed. what can I do to make container can connect my pc?

@Julius-ZCJ You have to use the Client's IP address on both client and server end, i.e 192.168.1.189 in your case since you are using this pc as a client.

from vidgear.

abhiTronix avatar abhiTronix commented on May 10, 2024

@Julius-ZCJ Kindly test development branch by strictly following steps and post your results here:

  1. Firstly, Kindly clone and install the testing branch as follows:
git clone git clone https://github.com/abhiTronix/vidgear.git
cd vidgear
git checkout testing
sudo pip install .
cd
  1. Then rerun the following updated algorithm for testing, but remember to change the IP address and port address with yours :

A. Server End:

Open the terminal on System-1 (Server) and execute the following python code. **Also, remember to write down the IP-address of Server by executing the command: 'hostname -I' and replace it in the following code:

# import libraries
from vidgear.gears import NetGear
import cv2

stream = cv2.VideoCapture('test.mp4') #Open any video stream

options = {flag : 0, copy : False, track : False}

#change following IP address '192.168.1.xxx' with yours
server = NetGear(address = '192.168.1.xxx', port = '5454', protocol = 'tcp',  pattern = 0, receive_mode = False, logging = True, **options) #Define netgear server at your system IP address.

# infinite loop until [Ctrl+C] is pressed
while True:
	try: 
		(grabbed, frame) = stream.read()
		# read frames

		# check if frame is not grabbed
		if not grabbed:
			#if True break the infinite loop
			break

		# do something with frame here

		# send frame to server
		server.send(frame)
	
	except KeyboardInterrupt:
		#break the infinite loop
		break

# safely close video stream
stream.release()
# safely close server
writer.close()

B. Client End:

Then open a terminal on the System-2(Client) and replace the IP address with Server's IP address and execute the following python code and see the output:

# import libraries
from vidgear.gears import NetGear
import cv2

options = {flag : 0, copy : False, track : False}

#change following IP address '192.168.1.xxx' with yours
client = NetGear(address = '192.168.1.xxx', port = '5454', protocol = 'tcp',  pattern = 0, receive_mode = True, logging = True, **options) #Define netgear client at Server IP address.

# infinite loop
while True:
	# receive frames from network
	frame = client.recv()

	# check if frame is None
	if frame is None:
		#if True break the infinite loop
		break

	# do something with frame here

	# Show output window
	cv2.imshow("Output Frame", frame)

	key = cv2.waitKey(1) & 0xFF
	# check for 'q' key-press
	if key == ord("q"):
		#if 'q' key-pressed break out
		break

# close output window
cv2.destroyAllWindows()
# safely close client
client.close()

from vidgear.

abhiTronix avatar abhiTronix commented on May 10, 2024

Successfully Resolved & Merged in commit: 48c6a69

from vidgear.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.