We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried this code.
int main( int argc, char * argv[] ) {
const char * video_sequence = argv[1]; CGuiModule gui( video_sequence );
if( !gui.Grab() ) { printf( "ERROR: input has no video\n" ); return 1; } vx_uint32 width = gui.GetWidth(); // image width vx_uint32 height = gui.GetHeight(); // image height
vx_context context = vxCreateContext(); vx_graph graph = vxCreateGraph(context); ERROR_CHECK_OBJECT( context ); ERROR_CHECK_OBJECT( graph );
vxRegisterLogCallback( context, log_callback, vx_false_e ); vxAddLogEntry( ( vx_reference ) context, VX_FAILURE, "Hello there!\n" );
vx_image images[] = { vxCreateImage(context, width, height,VX_DF_IMAGE_UYVY), vxCreateImage(context, width, height,VX_DF_IMAGE_U8), vxCreateImage(context, width, height,VX_DF_IMAGE_U8), }; for( vx_size i = 0; i < sizeof( images ) / sizeof( images[0] ); i++ ) { ERROR_CHECK_OBJECT( images[i] );
}
//The code to create virtual images that connect nodes vx_image virts[] = { vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT), vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT), vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT), vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT) };
for( vx_size i = 0; i < sizeof( virts ) / sizeof( virts[0] ); i++ ) {
ERROR_CHECK_OBJECT( virts[i] );
vx_node channelExtract_node = vxChannelExtractNode(graph, images[0],VX_CHANNEL_Y, virts[0]); vx_node Gaussian3x3_node = vxGaussian3x3Node(graph, virts[0], virts[1]) ; vx_node Sobel3x3_node = vxSobel3x3Node (graph, virts[1], virts[2], virts[3]); vx_node Magnitude_node = vxMagnitudeNode(graph, virts[2], virts[3], images[1]); vx_node Phase_node = vxPhaseNode (graph, virts[2], virts[3], images[2]);
ERROR_CHECK_OBJECT( channelExtract_node ); ERROR_CHECK_OBJECT( Gaussian3x3_node ); ERROR_CHECK_OBJECT( Sobel3x3_node ); ERROR_CHECK_OBJECT( Magnitude_node ); ERROR_CHECK_OBJECT( Phase_node );
ERROR_CHECK_STATUS( vxReleaseNode( &channelExtract_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Gaussian3x3_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Sobel3x3_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Magnitude_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Phase_node ) );
////Verify the graph ERROR_CHECK_STATUS( vxVerifyGraph (graph));
for( int frame_index = 0; !gui.AbortRequested(); frame_index++ ) { vx_rectangle_t cv_rgb_image_region; cv_rgb_image_region.start_x = 0; cv_rgb_image_region.start_y = 0; cv_rgb_image_region.end_x = width; cv_rgb_image_region.end_y = height;
vx_imagepatch_addressing_t cv_rgb_image_layout; cv_rgb_image_layout.stride_x = 3; cv_rgb_image_layout.stride_y = gui.GetStride(); vx_uint8 * cv_rgb_image_buffer = gui.GetBuffer(); ERROR_CHECK_STATUS( vxCopyImagePatch( images[0], &cv_rgb_image_region, 0, &cv_rgb_image_layout, cv_rgb_image_buffer, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST ) ); //Execute the graph synchronously ERROR_CHECK_STATUS(vxProcessGraph(graph)); vx_rectangle_t rect = { 0, 0, width, height }; vx_map_id map_id; vx_imagepatch_addressing_t addr; void * ptr; ERROR_CHECK_STATUS( vxMapImagePatch( images[1], &rect, 0, &map_id, &addr, &ptr, VX_READ_ONLY, VX_MEMORY_TYPE_HOST, VX_NOGAP_X ) ); printf("Value of ptr array is %d", *(int*)ptr); cv::Mat mat( height, width, CV_8U, ptr, addr.stride_y );
#if ENABLE_DISPLAY cv::imshow( "Magnplot", mat ); #endif
gui.Show(); if( !gui.Grab() ) { // Terminate the processing loop if the end of sequence is detected. gui.WaitForKey(); break; } }
vx_perf_t perfgraph = { 0 }; ERROR_CHECK_STATUS( vxQueryGraph( graph, VX_GRAPH_PERFORMANCE, &perfgraph, sizeof( perfgraph ) ) ); printf( "GraphName NumFrames Avg(ms) Min(ms)\n" "Graph %9d %7.3f %7.3f\n", ( int )perfgraph.num, ( float )perfgraph.avg * 1e-6f, ( float )perfgraph.min * 1e-6f );
ERROR_CHECK_STATUS( vxReleaseGraph(&graph)); for( vx_size i = 0; i < sizeof( images ) / sizeof( images[0] ); i++ ) { ERROR_CHECK_STATUS( vxReleaseImage( &images[i] ) ); } ERROR_CHECK_STATUS( vxReleaseNode( &channelExtract_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Gaussian3x3_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Sobel3x3_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Magnitude_node ) ); ERROR_CHECK_STATUS( vxReleaseNode( &Phase_node ) );
//ERROR_CHECK_STATUS( vxReleaseImage( &input_rgb_image ) ); ERROR_CHECK_STATUS( vxReleaseContext(&context));
return 0;
ERROR OK: FILE ../../tutorial_videos/PETS09-S1-L1-View001.avi 768x480 LOG: [ status = -1 ] Hello there!
LOG: [ status = -14 ] ERROR: agoVerifyGraph: kernel org.khronos.openvx.magnitude: invalid format for argument#2
ERROR: failed with status = (-14) at /home/openvx/openvx_tutorial/tutorial_exercises/Acsia/Acsia.cpp#97
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I tried this code.
int main( int argc, char * argv[] )
{
const char * video_sequence = argv[1];
CGuiModule gui( video_sequence );
if( !gui.Grab() )
{
printf( "ERROR: input has no video\n" );
return 1;
}
vx_uint32 width = gui.GetWidth(); // image width
vx_uint32 height = gui.GetHeight(); // image height
vx_context context = vxCreateContext();
vx_graph graph = vxCreateGraph(context);
ERROR_CHECK_OBJECT( context );
ERROR_CHECK_OBJECT( graph );
vxRegisterLogCallback( context, log_callback, vx_false_e );
vxAddLogEntry( ( vx_reference ) context, VX_FAILURE, "Hello there!\n" );
vx_image images[] = {
vxCreateImage(context, width, height,VX_DF_IMAGE_UYVY),
vxCreateImage(context, width, height,VX_DF_IMAGE_U8),
vxCreateImage(context, width, height,VX_DF_IMAGE_U8),
};
for( vx_size i = 0; i < sizeof( images ) / sizeof( images[0] ); i++ )
{
ERROR_CHECK_OBJECT( images[i] );
}
//The code to create virtual images that connect nodes
vx_image virts[] = {
vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT),
vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT),
vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT),
vxCreateVirtualImage(graph, width, height,VX_DF_IMAGE_VIRT)
};
for( vx_size i = 0; i < sizeof( virts ) / sizeof( virts[0] ); i++ )
{
}
vx_node channelExtract_node = vxChannelExtractNode(graph, images[0],VX_CHANNEL_Y, virts[0]);
vx_node Gaussian3x3_node = vxGaussian3x3Node(graph, virts[0], virts[1]) ;
vx_node Sobel3x3_node = vxSobel3x3Node (graph, virts[1], virts[2], virts[3]);
vx_node Magnitude_node = vxMagnitudeNode(graph, virts[2], virts[3], images[1]);
vx_node Phase_node = vxPhaseNode (graph, virts[2], virts[3], images[2]);
ERROR_CHECK_OBJECT( channelExtract_node );
ERROR_CHECK_OBJECT( Gaussian3x3_node );
ERROR_CHECK_OBJECT( Sobel3x3_node );
ERROR_CHECK_OBJECT( Magnitude_node );
ERROR_CHECK_OBJECT( Phase_node );
ERROR_CHECK_STATUS( vxReleaseNode( &channelExtract_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Gaussian3x3_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Sobel3x3_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Magnitude_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Phase_node ) );
////Verify the graph
ERROR_CHECK_STATUS( vxVerifyGraph (graph));
for( int frame_index = 0; !gui.AbortRequested(); frame_index++ )
{
vx_rectangle_t cv_rgb_image_region;
cv_rgb_image_region.start_x = 0;
cv_rgb_image_region.start_y = 0;
cv_rgb_image_region.end_x = width;
cv_rgb_image_region.end_y = height;
#if ENABLE_DISPLAY
cv::imshow( "Magnplot", mat );
#endif
vx_perf_t perfgraph = { 0 };
ERROR_CHECK_STATUS( vxQueryGraph( graph, VX_GRAPH_PERFORMANCE, &perfgraph, sizeof( perfgraph ) ) );
printf( "GraphName NumFrames Avg(ms) Min(ms)\n"
"Graph %9d %7.3f %7.3f\n",
( int )perfgraph.num, ( float )perfgraph.avg * 1e-6f, ( float )perfgraph.min * 1e-6f );
ERROR_CHECK_STATUS( vxReleaseGraph(&graph));
for( vx_size i = 0; i < sizeof( images ) / sizeof( images[0] ); i++ )
{
ERROR_CHECK_STATUS( vxReleaseImage( &images[i] ) );
}
ERROR_CHECK_STATUS( vxReleaseNode( &channelExtract_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Gaussian3x3_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Sobel3x3_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Magnitude_node ) );
ERROR_CHECK_STATUS( vxReleaseNode( &Phase_node ) );
//ERROR_CHECK_STATUS( vxReleaseImage( &input_rgb_image ) );
ERROR_CHECK_STATUS( vxReleaseContext(&context));
return 0;
}
ERROR
OK: FILE ../../tutorial_videos/PETS09-S1-L1-View001.avi 768x480
LOG: [ status = -1 ] Hello there!
LOG: [ status = -14 ] ERROR: agoVerifyGraph: kernel org.khronos.openvx.magnitude: invalid format for argument#2
ERROR: failed with status = (-14) at /home/openvx/openvx_tutorial/tutorial_exercises/Acsia/Acsia.cpp#97
The text was updated successfully, but these errors were encountered: