urlcam
plantimager.urlcam Link
Camera Link
Camera(url)
Bases: AbstractCamera
Camera module fetching an image serve at given URL.
Notes
Image should be served as $url/scan.jpg
.
See Also
plantimager.hal.AbstractCamera
Examples:
>>> from plantimager.urlcam import Camera
>>> url = "http://192.168.0.1:8080"
>>> cam = Camera(url)
>>> img = cam.grab("img_001")
>>> arr = img.channel("rgb").data
>>> arr.shape
>>> image = Image.fromarray(arr)
>>> image.show()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
URL of the camera. |
required |
Source code in plantimager/urlcam.py
57 58 59 60 61 62 63 64 |
|
grab Link
grab(idx, metadata=None)
Grab a picture from the camera.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Id of the image |
required |
metadata
|
dict
|
Dictionary of metadata associated to the picture. |
None
|
Returns:
Type | Description |
---|---|
DataItem
|
The image data. |
Examples:
>>> from plantimager.urlcam import Camera
>>> url = "http://192.168.0.1:8080"
>>> cam = Camera(url)
>>> img = cam.grab("img_001")
>>> arr = img.channel("rgb").data
>>> from PIL import Image
>>> image = Image.fromarray(arr)
>>> image.show()
Source code in plantimager/urlcam.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|