import json
from logging import getLogger
import numpy
from cam_server.pipeline.data_processing import functions, processor
_logger = getLogger(__name__)


def process_image(image, timestamp, x_axis, y_axis, parameters, image_background_array=None):
    ret = processor.process_image(image, timestamp, x_axis, y_axis, parameters, image_background_array)
    ret["average_value"] = float(ret ["intensity"] ) / len(ret ["x_axis"])/ len(ret ["y_axis"])
    return ret
