33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from cam_server.pipeline.data_processing import functions, processor
|
|
|
|
import sys
|
|
import json
|
|
|
|
from logging import getLogger
|
|
import numpy as np
|
|
|
|
def get_roi_projection(image, roi, axis):
|
|
x_start, x_stop, y_start, y_stop = roi
|
|
cropped = image[y_start:y_stop, x_start:x_stop]
|
|
project = cropped.sum(axis=axis)
|
|
return project.astype("int64")
|
|
|
|
def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata=None):
|
|
image = image.astype(int)
|
|
roi_signal = parameters.get("roi_signal")
|
|
roi_background = parameters.get("roi_background")
|
|
camera_name = parameters.get("camera_name")
|
|
project_axis = parameters.get("project_axis", 0)
|
|
|
|
projection_signal = get_roi_projection(image, roi_signal, project_axis)
|
|
projection_background = get_roi_projection(image, roi_background, project_axis)
|
|
|
|
# ret = processor.process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata)
|
|
# return ret
|
|
|
|
res = {
|
|
camera_name + ".projection_signal": projection_signal,
|
|
camera_name + ".projection_background": projection_background
|
|
}
|
|
|
|
return res |