Hi all,
I am new to OpenVX.
Issue:
I am facing problems in setting the graph parameters with the reference to the created graph.
My implimentation:
I am feeding the stream of frames from another application to my OpenVX graph. My graph just applies sobel3x3 filter on the input image. The output image from the graph will be dumped into a file or displayed on the screen.
Code:
/* function to create input image from the frame data received by other application */
vx_image create_image(frame_data_from_other_app_to_create_image)
{
[…]
vx_image image = vxCreateImageFromHandle(
context,
VX_DF_IMAGE_UYVY,
addrs,
data,
VX_IMPORT_TYPE_HOST);
[…]
return image;
}
/* function to create the graph */
vx_graph create_graph(vx_context context, vx_image input_img, vx_image output_img)
{
[…]
vx_node node[] = {
vxChannelExtractNode(graph, input_img, VX_CHANNEL_Y, virt_image[0]),
vxSobel3x3Node(graph, virt_image[0], virt_image[1], virt_image[2]),
vxMagnitudeNode(graph, virt_image[1], virt_image[2], virt_image[3]),
vxConvertDepthNode(graph, virt_image[3], output_img, VX_CONVERT_POLICY_WRAP, shift),
};
vxAddParameterToGraphByIndex(graph, node[0], 0); //input
vxAddParameterToGraphByIndex(graph, node[3], 1); //output
[…]
return graph;
}
/* function where we can access the incoming frame buffer (640x480) from another application */
func (frame_data_from_the_stream_640x480) // This function is invoked whenever there is new input frame from the other application. All the incoming frames are 640x480, UYVY color format
{
[…]
vx_image input = create_images(frame_data_to_create_image);
vx_image output = vxCreateImage(context, width, height, VX_DF_IMAGE_U8);
/* I want to create the graph only once and make use of it */
if(g_flag != TRUE) // g_flag will be initialized to FALSE when the application starts
{
vx_graph graph = create_graph(context, input, output);
g_flag = TRUE;
}
if(vxSetGraphParameterByIndex(graph, 0, (vx_reference)input) != VX_SUCCESS)
{
//handle error
}
if(vxSetGraphParameterByIndex(graph, 1, (vx_reference)output) != VX_SUCCESS)
{
//handle error
}
if(vxProcessGraph(graph) != VX_SUCCESS)
{
//handle error
}
[…]
}
Observation:
- When I try to access the data from the output image, there is no data in it, only the first output image will have graph processed data, rest all will have black pixels.
- I am not getting any error from vxSetGraphParameterByIndex(), vxAddParameterToGraphByIndex(), vxVerifyGraph() and vxProcessgraph() functions.
- The input image which will be fed to the graph is being created properly, I tried displaying the created input images on the screen and it works fine.
- If I release the graph and create it again for each incoming frame, everything works perfectly fine. But, I don’t want to do this.
My question:
- Am I setting the graph parameters properly?
- Any solutions or workarounds to solve this issue?
I am stuck with this issue from past 3 days, please help me.
Thanks in advance.
Kiran