forked from manoharan-lab/camera-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdummy_image_source.py
More file actions
executable file
·64 lines (54 loc) · 1.75 KB
/
dummy_image_source.py
File metadata and controls
executable file
·64 lines (54 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2011-2013, Vinothan N. Manoharan, Thomas G. Dimiduk,
# Rebecca W. Perry, Jerome Fung, and Ryan McGorty, Anna Wang
#
# This file is part of HoloPy.
#
# HoloPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# HoloPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with HoloPy. If not, see <http://www.gnu.org/licenses/>.
"""
Simulate capturing images from a camera for development
.. moduleauthor:: Thomas G. Dimiduk <tom@dimiduk.net>
"""
import numpy as np
live = True
lastimage = (np.random.random((1024,1024))*256).astype('int')
frame_number = 1
stop_frame = np.Inf
def open_camera(format=None):
pass
def close_camera():
pass
def get_image():
global lastimage, live, frame_number, stop_frame
if live and frame_number < stop_frame:
lastimage = (np.random.random((1024,1024))*256).astype('uint8')
frame_number += 1
return lastimage
def get_frame_number():
global frame_number
return frame_number
def start_continuous_capture():
global live, frame_number, stop_frame
frame_number = 1
live = True
stop_frame = np.inf
def start_sequence_capture(n_frames):
global live, frame_number, stop_frame
frame_number = 1
live = True
stop_frame = n_frames+1
def stop_live_capture():
global live
live = False