Darkflow: How if running this program using ipwebcam camera

Created on 6 Mar 2018  路  2Comments  路  Source: thtrieu/darkflow

Any one kno, how if i try to running this program using camera webcam and the camera changin using third part of camera like ipwebcam maybe?
Please if you have answer. Thankyou

Most helpful comment

There is a simple but crude way, check the darkflow/net/help.py file, modify the camera function as below:
```
def camera(self):
file = self.FLAGS.demo
SaveVideo = self.FLAGS.saveVideo

if file == 'camera':
    file = 0
else:
    assert os.path.isfile(file), \
        'file {} does not exist'.format(file)

# modified by me#############################
# camera = cv2.VideoCapture(file)
# source is your ipwebcam source, e.g. this is `mine`
source = 'rtsp://admin:[email protected]//Streaming/Channels/1'
camera = cv2.VideoCapture(source)
# ##########################################

if file == 0:
    self.say('Press [ESC] to quit demo')
```

All 2 comments

There is a simple but crude way, check the darkflow/net/help.py file, modify the camera function as below:
```
def camera(self):
file = self.FLAGS.demo
SaveVideo = self.FLAGS.saveVideo

if file == 'camera':
    file = 0
else:
    assert os.path.isfile(file), \
        'file {} does not exist'.format(file)

# modified by me#############################
# camera = cv2.VideoCapture(file)
# source is your ipwebcam source, e.g. this is `mine`
source = 'rtsp://admin:[email protected]//Streaming/Channels/1'
camera = cv2.VideoCapture(source)
# ##########################################

if file == 0:
    self.say('Press [ESC] to quit demo')
```

@troydeng its works thankyou so much and this is my code
`def camera(self):
file = self.FLAGS.demo
SaveVideo = self.FLAGS.saveVideo

if file == 'camera':
    file = 0
else:
    assert os.path.isfile(file), \
    'file {} does not exist'.format(file)

#camera = cv2.VideoCapture(file)
source = 'http://192.168.43.1:8080/video?dummy=param.mjpg'
camera = cv2.VideoCapture(source)

if file == 0:
    self.say('Press [ESC] to quit demo')`
Was this page helpful?
0 / 5 - 0 ratings