/************************************************************************************************************
Execution Kernel
*************************************************************************************************************/
static vx_status VX_CALLBACK CV_fastNlMeansDenoisingColored_Kernel(vx_node node, const vx_reference *parameters, vx_uint32 num)
{
	vx_status status = VX_SUCCESS;


	vx_image image_in = (vx_image) parameters[0];
	vx_image image_out = (vx_image) parameters[1];
	vx_scalar H = (vx_scalar) parameters[2];
	vx_scalar H_COLOR = (vx_scalar) parameters[3];
	vx_scalar Template_WS = (vx_scalar) parameters[4];
	vx_scalar Search_WS = (vx_scalar) parameters[5];
	Mat *mat, bl;
	int search_ws, template_ws;
	float h, h_color;
	vx_float32 value_f = 0;
	vx_int32 value = 0;

	//Extracting Values from the Scalar into Ksize and Ddepth
	STATUS_ERROR_CHECK(vxReadScalarValue(H, &value_f));h = value_f;
	STATUS_ERROR_CHECK(vxReadScalarValue(H_COLOR, &value_f));h_color = value_f;
	STATUS_ERROR_CHECK(vxReadScalarValue(Template_WS, &value));template_ws = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(Search_WS, &value));search_ws = value;

	//Converting VX Image to OpenCV Mat
	STATUS_ERROR_CHECK(match_vx_image_parameters(image_in, image_out));
	STATUS_ERROR_CHECK(VX_to_CV_Image(&mat, image_in));

	//Compute using OpenCV
	cv::fastNlMeansDenoisingColored(*mat, bl, h, h_color, template_ws, search_ws);

	//Converting OpenCV Mat into VX Image
	STATUS_ERROR_CHECK(CV_to_VX_Image(image_out, &bl));

	return status;
}
Пример #2
0
/************************************************************************************************************
Execution Kernel
*************************************************************************************************************/
static vx_status VX_CALLBACK CV_Boxfilter_Kernel(vx_node node, const vx_reference *parameters, vx_uint32 num)
{
	vx_status status = VX_SUCCESS;

	vx_image image_in = (vx_image) parameters[0];
	vx_image image_out = (vx_image) parameters[1];
	vx_scalar scalar = (vx_scalar) parameters[2];
	vx_scalar S_width = (vx_scalar) parameters[3];
	vx_scalar S_height = (vx_scalar) parameters[4];
	vx_scalar A_X = (vx_scalar) parameters[5];
	vx_scalar A_Y = (vx_scalar) parameters[6];
	vx_scalar NORM = (vx_scalar) parameters[7];
	vx_scalar BORDER = (vx_scalar) parameters[8];

	Mat *mat, bl;
	int ddepth, W, H, a_x = -1, a_y = -1, border = 4;

	vx_int32 value = 0;
	vx_bool value_b, norm;

	//Extracting Values from the Scalar into Ksize and Ddepth
	STATUS_ERROR_CHECK(vxReadScalarValue(scalar, &value));ddepth = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(S_width, &value));W = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(S_height, &value));H = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(A_X, &value));a_x = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(A_Y, &value));a_y = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(NORM, &value_b));norm = value_b;
	STATUS_ERROR_CHECK(vxReadScalarValue(BORDER, &value));border = value;

	//Converting VX Image to OpenCV Mat
	STATUS_ERROR_CHECK(match_vx_image_parameters(image_in, image_out));
	STATUS_ERROR_CHECK(VX_to_CV_Image(&mat, image_in));

	//Compute using OpenCV
	Point point;
	bool Normalized;
	if (norm == vx_true_e) Normalized = true; else Normalized = false;
	point.x = a_x;
	point.y = a_y;
	cv::boxFilter(*mat, bl, ddepth, Size(W, H), point, Normalized, border);

	//Converting OpenCV Mat into VX Image
	STATUS_ERROR_CHECK(CV_to_VX_Image(image_out, &bl));

	return status;
}
/************************************************************************************************************
Execution Kernel
*************************************************************************************************************/
static vx_status VX_CALLBACK CV_sepFilter2D_Kernel(vx_node node, const vx_reference *parameters, vx_uint32 num)
{
	vx_status status = VX_SUCCESS;

	vx_image image_in = (vx_image) parameters[0];
	vx_image image_out = (vx_image) parameters[1];
	vx_scalar scalar = (vx_scalar) parameters[2];
	vx_matrix KERNELX = (vx_matrix) parameters[3];
	vx_matrix KERNELY = (vx_matrix) parameters[4];
	vx_scalar A_X = (vx_scalar) parameters[5];
	vx_scalar A_Y = (vx_scalar) parameters[6];
	vx_scalar DELTA = (vx_scalar) parameters[7];
	vx_scalar BORDER = (vx_scalar) parameters[8];

	Mat *mat, bl;
	int ddepth, a_x = -1, a_y = -1, border = 4;
	float delta = 0;
	vx_int32 value = 0;
	vx_float32 value_f = 0;

	//Extracting Values from the Scalar into Ksize and Ddepth
	STATUS_ERROR_CHECK(vxReadScalarValue(scalar, &value)); ddepth = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(A_X, &value)); a_x = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(A_Y, &value)); a_y = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(DELTA, &value_f)); delta = value_f;
	STATUS_ERROR_CHECK(vxReadScalarValue(BORDER, &value)); border = value;

	//Converting VX Image to OpenCV Mat
	STATUS_ERROR_CHECK(match_vx_image_parameters(image_in, image_out));
	STATUS_ERROR_CHECK(VX_to_CV_Image(&mat, image_in));

	//Compute using OpenCV
	Point point;
	point.x = a_x;
	point.y = a_y;
	Mat *kernelX, *kernelY;
	STATUS_ERROR_CHECK(VX_to_CV_MATRIX(&kernelX, KERNELX));
	STATUS_ERROR_CHECK(VX_to_CV_MATRIX(&kernelY, KERNELY));
	cv::sepFilter2D(*mat, bl, ddepth, *kernelX, *kernelY, point, delta, border);

	//Converting OpenCV Mat into VX Image
	STATUS_ERROR_CHECK(CV_to_VX_Image(image_out, &bl));

	return status;
}
/************************************************************************************************************
Execution Kernel
*************************************************************************************************************/
static vx_status VX_CALLBACK CV_warpPerspective_Kernel(vx_node node, const vx_reference *parameters, vx_uint32 num)
{
	vx_status status = VX_SUCCESS;

	vx_image image_in = (vx_image) parameters[0];
	vx_image image_out = (vx_image) parameters[1];
	vx_matrix KERNEL = (vx_matrix) parameters[2];
	vx_scalar A_X = (vx_scalar) parameters[3];
	vx_scalar A_Y = (vx_scalar) parameters[4];
	vx_scalar FLAGS = (vx_scalar) parameters[5];
	vx_scalar BORDER = (vx_scalar) parameters[6];

	Mat *mat, bl;
	int flags;
	int a_x = -1, a_y = -1, border = 4;
	vx_int32 value = 0;

	//Extracting Values from the Scalar into Ksize and Ddepth
	STATUS_ERROR_CHECK(vxReadScalarValue(FLAGS, &value)); flags = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(A_X, &value)); a_x = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(A_Y, &value)); a_y = value;
	STATUS_ERROR_CHECK(vxReadScalarValue(BORDER, &value)); border = value;

	//Converting VX Image to OpenCV Mat
	STATUS_ERROR_CHECK(match_vx_image_parameters(image_in, image_out));
	STATUS_ERROR_CHECK(VX_to_CV_Image(&mat, image_in));

	//Compute using OpenCV
	Mat *M;
	STATUS_ERROR_CHECK(VX_to_CV_MATRIX(&M, KERNEL));
	cv::warpPerspective(*mat, bl, *M, Size(a_x, a_y), flags, border);

	//Converting OpenCV Mat into VX Image
	STATUS_ERROR_CHECK(CV_to_VX_Image(image_out, &bl));

	return status;
}