The image is not provided by the camera but by a separate pipeline not connected to the camera component where I manually provide the image.
Code: Select all
//crop incoming 1280x720 to 1080x720 with an x offset of 100pixels
MMAL_ES_FORMAT_T* input_format = input_port->format;
mmal_format_copy(ispComponent->input[0]>format, splitterComponent->output[1]->format);
input_format->encoding = MMAL_ENCODING_I420;
input_format->encoding_variant = MMAL_ENCODING_I420;
input_format->es->video.width = VCOS_ALIGN_UP(1280, 32); // width needs to be a multiple of 32
input_format->es->video.height = VCOS_ALIGN_UP(720 16); // height needs to be a multiple of 16
input_format->es->video.crop.x = 100; // <-- This parameter is not being being used when I crop the image
input_format->es->video.crop.y = 0;
input_format->es->video.crop.width = 1080;
input_format->es->video.crop.height = 720;
Code: Select all
// scale down the 1080x720 image to 720x480
MMAL_ES_FORMAT_T* out_format = output_port->format;
mmal_format_copy(output_port->format, input_port->format);
out_format->encoding = MMAL_ENCODING_I420;
out_format->encoding_variant = MMAL_ENCODING_I420;
out_format->es->video.width = VCOS_ALIGN_UP(720, 32); // width needs to be a multiple of 32
out_format->es->video.height = VCOS_ALIGN_UP(480, 16); // height needs to be a multiple of 16
out_format->es->video.crop.x = 0;
out_format->es->video.crop.y = 0;
out_format->es->video.crop.width = 720;
out_format->es->video.crop.height = 480;
