asi_core.real_time.http_image_receiver¶
Attributes¶
Classes¶
Handles the image acquisition of an IP camera with http-API. |
|
Defines the acquisition of image series with different exposure times. |
|
Handles the acquisition of image series with an AXIS camera. |
|
Handles the acquisition of image series with a Mobotix camera. |
Module Contents¶
- asi_core.real_time.http_image_receiver.EXIF_KEYS¶
- asi_core.real_time.http_image_receiver.KNOWN_MOBOTIX_MODELS = ['Q71', 'Q26', 'Q25', 'Q24']¶
- asi_core.real_time.http_image_receiver.KNOWN_NIGHTIME_MODES = ['moon_detection', 'cloud_monitoring']¶
- asi_core.real_time.http_image_receiver.MOBOTIX_CAMS_SWITCH_SETTINGS_DAY_NIGHT¶
- asi_core.real_time.http_image_receiver.detected_local_tz = None¶
- class asi_core.real_time.http_image_receiver.ImageReceiver(http_snapshot, storage_path, location, sampling_time=timedelta(seconds=30), night_sampling_time=timedelta(seconds=60), timezone_images=detected_local_tz, nighttime_mode='moon_detection')¶
Handles the image acquisition of an IP camera with http-API.
- Parameters:
http_snapshot – str, http request sent to camera to get a snapshot
storage_path – path to which image series will be stored; folders for month, day, hour will be created
location –
dict, with fields indicating coordinates:
”lat” (decimal degrees, northing positive),
”lon” (decimal degrees, easting positive),
”alt” (meters)
sampling_time – datetime timedelta – temporal offset between image series
night_sampling_time – datetime timedelta – temporal offset between image series during nighttime
timezone_images – Specify pytz.timezone of the images and log file. If not provided computer timezone is used.
nighttime_mode – Acquisition mode used during nighttime. Optimized for different purposes: Moon detection, cloud detection, …
- min_sun_ele_exp = 0¶
- max_sun_ele_exp = 90¶
- min_moon_ele = 10¶
- min_moon_phase = 0.8¶
- http_snapshot¶
- storage_path¶
- sampling_time¶
- location¶
- timezone_images¶
- day_sampling_time¶
- night_sampling_time¶
- nighttime_mode = 'moon_detection'¶
- record_night_image = False¶
- midnight = None¶
- ephem_observer¶
- http_get_snapshot()¶
Sends an http request and extract binary JPEG from response
- Returns:
Binary encoded JPEG image
- store_img_to_path(ts, img, exp_time=0)¶
Stores an image record in the folder structure according to the convention below
- Parameters:
ts – datetime, timestamp at which the image was taken
img – binary encoded image (jpg)
exp_time – int, exposure time of the image (microseconds)
- record_continuously()¶
Once called, this function runs infinitely taking images at the defined sampling rate
- trigger_store_exposure()¶
Triggers, receives and saves a snapshot from the camera.
Exposure time etc. remain unchanged. Only a snapshot is requested and saved
- check_adjust_day_nighttime_settings()¶
Check sun elevation and if needed change camera settings which are different during day- and nighttime.
This is a dummy. Implemented for compatible cameras.
- prepare_image_acquisition()¶
Prepare image acquisition.
Check if conditions for recording images are met. Either for standard daylight images (depending on sun elevation) or nighttime images when there is (almost) full moon and the moon is above the horizon.
- Returns:
Boolean whether image should be recorded.
- class asi_core.real_time.http_image_receiver.SeriesReceiver(url_cam, storage_path, location, sampling_time=timedelta(seconds=30), night_sampling_time=timedelta(seconds=60), exposure_times=[80, 160, 320, 640, 1280], night_exposure_times=[80000], settling_time=timedelta(seconds=0.25), timezone_images=detected_local_tz, rel_threshold_exposure=0.1, safety_deadtime_between_exposure_series=timedelta(seconds=3), nighttime_mode='moon_detection')¶
Bases:
ImageReceiverDefines the acquisition of image series with different exposure times.
- Parameters:
url_cam – URL/ IP of the camera to be controlled
storage_path – see ImageReceiver
location – see ImageReceiver
sampling_time – see ImageReceiver
night_sampling_time – timedelta, sampling time used during nighttime
exposure_times – list, exposure times in microseconds. One snapshot per exp. time will be stored
settling_time – Time to wait until requesting an image from camera after setting new exposure time or after previous request
timezone_images – see ImageReceiver
rel_threshold_exposure – Relative deviation of exp. time. Image will be rejected if real exp. time deviates stronger from expected value
safety_deadtime_between_exposure_series – Cancel acquisition of exposure series if less than this time remains until end of sampling period
nighttime_mode – Acquisition mode used during nighttime. Optimized for different purposes: Moon detection, cloud detection, …
- exposure_times = [80, 160, 320, 640, 1280]¶
- night_exposure_times = [80000]¶
- url_cam¶
- settling_time¶
- rel_threshold_exposure = 0.1¶
- safety_deadtime_between_exposure_series¶
- abstractmethod set_exposure(exp_set)¶
” Request camera to change exposure time
- Parameters:
exp_set – Exposure time in microseconds
- trigger_store_exposure()¶
Records an image series with different exposure times
- get_real_exposure_properties(img)¶
Checks the exposure time noted in the EXIF header.
- Parameters:
img – Binary encoded jpeg image with EXIF header that contains actual exposure time
- Return exp:
int, read exposure time in microseconds
- class asi_core.real_time.http_image_receiver.AxisSeriesReceiver(url_cam, storage_path, location, user, password, **kwargs)¶
Bases:
SeriesReceiverHandles the acquisition of image series with an AXIS camera.
- Parameters:
url_cam – see SeriesReceiver
storage_path – see ImageReceiver
location – see ImageReceiver
user – name of user authorized to set exposure parameters
password – password of user
sampling_time – see ImageReceiver
exposure_times – see SeriesReceiver
settling_time – see SeriesReceiver
user – name of user authorized to set exposure parameters
password – password of user
- command_record = 'jpg/image.jpg?camera=1&overview=0&resolution=2016x2016&videoframeskipmode=empty×tamp=166279...¶
- authentication¶
- set_exposure(exp_set)¶
” Request camera to change exposure time
- Parameters:
exp_set – Exposure time in microseconds
- class asi_core.real_time.http_image_receiver.MobotixSeriesReceiver(cam_cfg, storage_path, **kwargs)¶
Bases:
SeriesReceiverHandles the acquisition of image series with a Mobotix camera.
- Parameters:
cam_cfg – dict with the keys - url_cam: see SeriesReceiver - location: see ImageReceiver - camera_model: one of the models specified in KNOWN_MOBOTIX_MODELS
storage_path – see ImageReceiver
sampling_time – see ImageReceiver
exposure_times – see SeriesReceiver
settling_time – see SeriesReceiver
- command_record = 'record/current.jpg'¶
- ir_cut_filter_status = 'unknown'¶
- exposure_settings¶
- exposure_status¶
- camera_type¶
- set_exposure(exp_set)¶
” Request camera to change exposure time
- Parameters:
exp_set – Exposure time in microseconds
- check_adjust_day_nighttime_settings(is_night)¶
Adapt exposure settings between day- and nighttime. So far only for one specific setup and camera type.
Time of day information is received via argument. Information if night- or daytime settings are actually set, is read from images (in image acquisition method). If set and required settings do not match, the parameters are written to the camera.
- Parameters:
is_night – Boolean, True if nighttime is present.
- get_real_exposure_properties(img)¶
Checks the exposure time and other parameters noted in the header of a Mobotix JPEG.
Mobotix JPEGs possess a specific header. This is fundamental for the function.
Exposure times of 1e4 seconds and more are not expected.
- Parameters:
img – Binary encoded mobotix jpeg image
- Returns:
int, read exposure time in microseconds