MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / readImage

Method readImage

recognition/scripts/drag_and_drop.py:248–258  ·  view source on GitHub ↗
(self, url)

Source from the content-addressed store, hash-verified

246 # reads an image from the url
247 # url : the location to the image (string, like 'http://www.*.jpg' or 'file:///home/*/.jpg'
248 def readImage(self, url):
249 if url.count('file:///'):
250 # get the image from the local directory
251 img = cv2.imread(url[url.find('file:///') + 7:])
252 else:
253 # get the image from the internet
254 response = requests.get(url)
255 data = numpy.fromstring(response.content, numpy.uint8)
256 img = cv2.imdecode(data, 1)
257
258 return img
259
260 def improve(self, rgb_image):
261 if numpy.amax(rgb_image) > 1:

Callers 1

dropEventMethod · 0.95

Calls 2

countMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected