Exemple #1
0
static VALUE OpenVX_load(VALUE self, VALUE name)
{
    vx_status status = VX_FAILURE;
    Check_Type(name, T_STRING);
    status = vxLoadKernels(context, RSTRING_PTR(name));
    REXT_PRINT("status = %d\n", status);
    return Qnil;
}
Exemple #2
0
 static jboolean loadKernels(JNIEnv *env, jobject obj,
                             jstring nameStr)
 {
     const char *name = env->GetStringUTFChars(nameStr, NULL);
     vx_context context = (vx_context)GetHandle(env, obj, ContextClass, handleName);
     vx_status status = vxLoadKernels(context, (vx_char *)name);
     env->ReleaseStringUTFChars(nameStr, name);
     if (status == VX_SUCCESS)
         return true;
     else
         return false;
 }
//! [node]
vx_node vxXYZNode(vx_graph graph, vx_image input, vx_uint32 value, vx_image output, vx_array temp)
{
    vx_uint32 i;
    vx_node node = 0;
    vx_context context = vxGetContext((vx_reference)graph);
    vx_status status = vxLoadKernels(context, "xyz");
    if (status == VX_SUCCESS)
    {
        //! [xyz node]
        vx_kernel kernel = vxGetKernelByName(context, VX_KERNEL_NAME_KHR_XYZ);
        if (kernel)
        {
            node = vxCreateGenericNode(graph, kernel);
            if (vxGetStatus((vx_reference)node) == VX_SUCCESS)
            {
                vx_status statuses[4];
                vx_scalar scalar = vxCreateScalar(context, VX_TYPE_INT32, &value);
                statuses[0] = vxSetParameterByIndex(node, 0, (vx_reference)input);
                statuses[1] = vxSetParameterByIndex(node, 1, (vx_reference)scalar);
                statuses[2] = vxSetParameterByIndex(node, 2, (vx_reference)output);
                statuses[3] = vxSetParameterByIndex(node, 3, (vx_reference)temp);
                vxReleaseScalar(&scalar);
                for (i = 0; i < dimof(statuses); i++)
                {
                    if (statuses[i] != VX_SUCCESS)
                    {
                        status = VX_ERROR_INVALID_PARAMETERS;
                        vxReleaseNode(&node);
                        vxReleaseKernel(&kernel);
                        node = 0;
                        kernel = 0;
                        break;
                    }
                }
            }
            else
            {
                vxReleaseKernel(&kernel);
            }
        }
        else
        {
            vxUnloadKernels(context, "xyz");
        }
        //! [xyz node]
    }
    return node;
}
Exemple #4
0
int main(int argc, char *argv[]) {
    vx_status status = VX_FAILURE;
    vx_context context = vxCreateContext();

    if (argc < 2) {
        usage(argv[0]);
        goto relCtx;
    }

    vx_char *srcfilename = argv[1];
    printf("src img: %s\n", srcfilename);

    FILE *fp = fopen(srcfilename, "r");
    if (!fp) {
        goto relCtx;
    }

    char pgmstr[1024];
    unsigned int n;
    n = fread(pgmstr, 1, sizeof(pgmstr), fp);
    if (n != sizeof(pgmstr)) {
        goto relClose;
    }

    const char delim = '\n';
    const char *token = NULL;
    unsigned int width, height;

    // PGM P5 magic string
    token = strtok(pgmstr, &delim);
    // PGM author
    token = strtok(NULL, &delim);
    // PGM image size
    token = strtok(NULL, &delim);
    sscanf(token, "%u %u", &width, &height);
    printf("width:%u height:%u\n", width, height);

    status = vxGetStatus((vx_reference)context);
    if (status != VX_SUCCESS) {
        fprintf(stderr, "error: vxCreateContext\n");
        goto relClose;
    }

    vx_rectangle_t rect = {1, 1, width + 1, height + 1};
    vx_uint32 i = 0;
    vx_image images[] = {
            vxCreateImage(context, width + 2, height + 2, VX_DF_IMAGE_U8), // 0:input
            vxCreateImageFromROI(images[0], &rect),       // 1:ROI input
            vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 2:box
            vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 3:gaussian
            vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 4:alpha
            vxCreateImage(context, width, height, VX_DF_IMAGE_S16),// 5:add
    };

    vx_float32 a = 0.5f;
    vx_scalar alpha = vxCreateScalar(context, VX_TYPE_FLOAT32, &a);
    status |= vxLoadKernels(context, "openvx-tiling");
    status |= vxLoadKernels(context, "openvx-debug");
    if (status != VX_SUCCESS) {
        fprintf(stderr, "error: vxLoadKernels %d\n", status);
        goto relImg;
    }

    vx_graph graph = vxCreateGraph(context);
    status = vxGetStatus((vx_reference)context);
    if (status != VX_SUCCESS) {
        fprintf(stderr, "error: vxGetStatus\n");
        goto relKern;
    }

    ax_node_t axnodes[] = {
        { vxFReadImageNode(graph, srcfilename, images[1]), "Read" },
        { vxTilingBoxNode(graph, images[1], images[2], 5, 5), "Box" },
        { vxFWriteImageNode(graph, images[2], "ot_box.pgm"), "Write" },
        { vxTilingGaussianNode(graph, images[1], images[3]), "Gaussian" },
        { vxFWriteImageNode(graph, images[3], "ot_gauss.pgm"), "Write" },
        { vxTilingAlphaNode(graph, images[1], alpha, images[4]), "Alpha" },
        { vxFWriteImageNode(graph, images[4], "ot_alpha.pgm"), "Write" },
        { vxTilingAddNode(graph, images[1], images[4], images[5]), "Add" },
        { vxFWriteImageNode(graph, images[5], "ot_add.pgm"), "Write" },
    };

    for (i = 0; i < dimof(axnodes); i++) {
        if (axnodes[i].node == 0) {
            fprintf(stderr, "error: Failed to create node[%u]\n", i);
            status = VX_ERROR_INVALID_NODE;
            goto relNod;
        }
    }

    status = vxVerifyGraph(graph);
    if (status != VX_SUCCESS) {
        fprintf(stderr, "error: vxVerifyGraph %d\n", status);
        goto relNod;
    }

    status = vxProcessGraph(graph);
    if (status != VX_SUCCESS) {
        fprintf(stderr, "error: vxProcessGraph %d\n", status);
        goto relNod;
    }

    // perf timings
    vx_perf_t perf_node;
    vx_perf_t perf_graph;

    vxQueryGraph(graph, VX_GRAPH_ATTRIBUTE_PERFORMANCE, &perf_graph, sizeof(perf_graph));
    axPrintPerf("Graph", &perf_graph);

    for (i = 0; i < dimof(axnodes); ++i) {
        vxQueryNode(axnodes[i].node, VX_NODE_ATTRIBUTE_PERFORMANCE, &perf_node, sizeof(perf_node));
        axPrintPerf(axnodes[i].name, &perf_node);
    }
relNod:
    for (i = 0; i < dimof(axnodes); i++) {
        vxReleaseNode(&axnodes[i].node);
    }
    vxReleaseGraph(&graph);

relKern:
relImg:
    for (i = 0; i < dimof(images); i++) {
        vxReleaseImage(&images[i]);
    }
relClose:
    fclose(fp);
relCtx:
    vxReleaseContext(&context);

    printf("%s::main() returns = %d\n", argv[0], status);
    return (int)status;
}
Exemple #5
0
int main(int argc, char *argv[])
{
    vx_status status = VX_SUCCESS;
    vx_context context = vxCreateContext();
    if (vxGetStatus((vx_reference)context) == VX_SUCCESS)
    {
        vx_char implementation[VX_MAX_IMPLEMENTATION_NAME];
        vx_char *extensions = NULL;
        vx_int32 m, modules = 0;
        vx_uint32 k, kernels = 0;
        vx_uint32 p, parameters = 0;
        vx_uint32 a = 0;
        vx_uint16 vendor, version;
        vx_size size = 0;
        vx_kernel_info_t *table = NULL;

        // take each arg as a module name to load
        for (m = 1; m < argc; m++)
        {
            if (vxLoadKernels(context, argv[m]) != VX_SUCCESS)
                printf("Failed to load module %s\n", argv[m]);
            else
                printf("Loaded module %s\n", argv[m]);
        }

        vxPrintAllLog(context);
        vxRegisterHelperAsLogReader(context);
        vxQueryContext(context, VX_CONTEXT_VENDOR_ID, &vendor, sizeof(vendor));
        vxQueryContext(context, VX_CONTEXT_VERSION, &version, sizeof(version));
        vxQueryContext(context, VX_CONTEXT_IMPLEMENTATION, implementation, sizeof(implementation));
        vxQueryContext(context, VX_CONTEXT_MODULES, &modules, sizeof(modules));
        vxQueryContext(context, VX_CONTEXT_EXTENSIONS_SIZE, &size, sizeof(size));
        printf("implementation=%s (%02x:%02x) has %u modules\n", implementation, vendor, version, modules);
        extensions = malloc(size);
        if (extensions)
        {
            vx_char *line = extensions, *token = NULL;
            vxQueryContext(context, VX_CONTEXT_EXTENSIONS, extensions, size);
            do {
                token = strtok(line, " ");
                if (token)
                    printf("extension: %s\n", token);
                line = NULL;
            } while (token);
            free(extensions);
        }
        status = vxQueryContext(context, VX_CONTEXT_UNIQUE_KERNELS, &kernels, sizeof(kernels));
        if (status != VX_SUCCESS) goto exit;
        printf("There are %u kernels\n", kernels);
        size = kernels * sizeof(vx_kernel_info_t);
        table = malloc(size);
        status = vxQueryContext(context, VX_CONTEXT_UNIQUE_KERNEL_TABLE, table, size);
        for (k = 0; k < kernels && table != NULL && status == VX_SUCCESS; k++)
        {
            vx_kernel kernel = vxGetKernelByEnum(context, table[k].enumeration);
            if (kernel && vxGetStatus((vx_reference)kernel) == VX_SUCCESS)
            {
                status = vxQueryKernel(kernel, VX_KERNEL_PARAMETERS, &parameters, sizeof(parameters));
                printf("\t\tkernel[%u]=%s has %u parameters (%d)\n",
                        table[k].enumeration,
                        table[k].name,
                        parameters,
                        status);
                for (p = 0; p < parameters; p++)
                {
                    vx_parameter parameter = vxGetKernelParameterByIndex(kernel, p);
                    vx_enum type = VX_TYPE_INVALID, dir = VX_INPUT;
                    vx_uint32 tIdx, dIdx;

                    status = VX_SUCCESS;
                    status |= vxQueryParameter(parameter, VX_PARAMETER_TYPE, &type, sizeof(type));
                    status |= vxQueryParameter(parameter, VX_PARAMETER_DIRECTION, &dir, sizeof(dir));
                    for (tIdx = 0; tIdx < dimof(parameter_names); tIdx++)
                        if (parameter_names[tIdx].tenum == type)
                            break;
                    for (dIdx = 0; dIdx < dimof(direction_names); dIdx++)
                        if (direction_names[dIdx].tenum == dir)
                            break;
                    if (status == VX_SUCCESS)
                        printf("\t\t\tparameter[%u] type:%s dir:%s\n", p,
                            parameter_names[tIdx].name,
                            direction_names[dIdx].name);
                    vxReleaseParameter(&parameter);
                }
                for (a = 0; a < dimof(attribute_names); a++)
                {
                    switch (attribute_names[a].type)
                    {
                        case VX_TYPE_SIZE:
                        {
                            vx_size value = 0;
                            if (VX_SUCCESS == vxQueryKernel(kernel, attribute_names[a].tenum, &value, sizeof(value)))
                                printf("\t\t\tattribute[%u] %s = "VX_FMT_SIZE"\n",
                                    attribute_names[a].tenum & VX_ATTRIBUTE_ID_MASK,
                                    attribute_names[a].name,
                                    value);
                            break;
                        }
                        case VX_TYPE_UINT32:
                        {
                            vx_uint32 value = 0;
                            if (VX_SUCCESS == vxQueryKernel(kernel, attribute_names[a].tenum, &value, sizeof(value)))
                                printf("\t\t\tattribute[%u] %s = %u\n",
                                    attribute_names[a].tenum & VX_ATTRIBUTE_ID_MASK,
                                    attribute_names[a].name,
                                    value);
                            break;
                        }
                        default:
                            break;
                    }
                }
                vxReleaseKernel(&kernel);
            }
            else
            {
                printf("ERROR: kernel %s is invalid (%d) !\n", table[k].name, status);
            }
        }

        for (m = 1; m < argc; m++)
        {
            if (vxUnloadKernels(context, argv[m]) != VX_SUCCESS)
                printf("Failed to unload module %s\n", argv[m]);
            else
                printf("Unloaded module %s\n", argv[m]);
        }
exit:
        if (table) free(table);
        vxReleaseContext(&context);
    }
    return 0;
}
Exemple #6
0
static vx_status VX_CALLBACK vxHarrisInitializer(vx_node node, vx_reference parameters[], vx_uint32 num)
{
    vx_status status = VX_FAILURE;
    if (num == dimof(harris_kernel_params))
    {
        vx_image src = (vx_image)parameters[0];
        vx_scalar str = (vx_scalar)parameters[1];
        vx_scalar min = (vx_scalar)parameters[2];
        vx_scalar sen = (vx_scalar)parameters[3];
        vx_scalar win = (vx_scalar)parameters[4];
        vx_scalar blk = (vx_scalar)parameters[5];
        vx_array arr = (vx_array)parameters[6];
        vx_scalar num_corners = (vx_scalar)parameters[7];
        vx_context c = vxGetContext((vx_reference)node);
        vx_graph g = vxCreateGraph(c);
        vxLoadKernels(c, "openvx-extras");
        vxLoadKernels(c, "openvx-debug");
        if (g)
        {
            vx_uint32 i = 0;
            vx_int32 ds = 4;
            vx_scalar shift = vxCreateScalar(c, VX_TYPE_INT32, &ds);
            vx_image virts[] = {
                    vxCreateVirtualImage(g, 0, 0, VX_DF_IMAGE_VIRT), // Gx
                    vxCreateVirtualImage(g, 0, 0, VX_DF_IMAGE_VIRT), // Gy
                    vxCreateVirtualImage(g, 0, 0, VX_DF_IMAGE_VIRT), // Score
                    vxCreateVirtualImage(g, 0, 0, VX_DF_IMAGE_VIRT), // Suppressed
                    vxCreateVirtualImage(g, 0, 0, VX_DF_IMAGE_U8), // Shifted Suppressed Log10
            };
            vx_node nodes[] = {
                    vxSobelMxNNode(g, src, win, virts[0], virts[1]),
                    vxHarrisScoreNode(g, virts[0], virts[1], sen, blk, virts[2]),
                    vxEuclideanNonMaxNode(g, virts[2], str, min, virts[3]),
                    vxImageListerNode(g, virts[3], arr, num_corners),
#if defined(OPENVX_DEBUGGING)
                    vxConvertDepthNode(g,virts[3],virts[4],VX_CONVERT_POLICY_WRAP,shift),
                    vxFWriteImageNode(g,virts[4],"oharris_strength_power_up4.pgm"),
#endif

            };
            status = VX_SUCCESS;
            status |= vxAddParameterToGraphByIndex(g, nodes[0], 0); // src
            status |= vxAddParameterToGraphByIndex(g, nodes[2], 1); // str
            status |= vxAddParameterToGraphByIndex(g, nodes[2], 2); // min
            status |= vxAddParameterToGraphByIndex(g, nodes[1], 2); // sen
            status |= vxAddParameterToGraphByIndex(g, nodes[0], 1); // win
            status |= vxAddParameterToGraphByIndex(g, nodes[1], 3); // blk
            status |= vxAddParameterToGraphByIndex(g, nodes[3], 1); // arr
            status |= vxAddParameterToGraphByIndex(g, nodes[3], 2); // num_corners
            for (i = 0; i < dimof(nodes); i++)
            {
                vxReleaseNode(&nodes[i]);
            }
            for (i = 0; i < dimof(virts); i++)
            {
                vxReleaseImage(&virts[i]);
            }
            vxReleaseScalar(&shift);
            status |= vxVerifyGraph(g);
            VX_PRINT(VX_ZONE_INFO, "Status from Child Graph = %d\n", status);
            if (status == VX_SUCCESS)
            {
                status = vxSetChildGraphOfNode(node, g);
            }
            else
            {
                vxReleaseGraph(&g);
            }
        }
    }
    return status;
}
/*!
 * \brief An example of an super resolution algorithm.
 * \ingroup group_example
 */
int example_super_resolution(int argc, char *argv[])
{
    vx_status status = VX_SUCCESS;
    vx_uint32 image_index = 0, max_num_images = 4;
    vx_uint32 width = 640;
    vx_uint32 i = 0;
    vx_uint32 winSize = 32;
    vx_uint32 height = 480;
    vx_int32 sens_thresh = 20;
    vx_float32 alpha = 0.2f;
    vx_float32 tau = 0.5f;
    vx_enum criteria = VX_TERM_CRITERIA_BOTH;    // lk params
    vx_float32 epsilon = 0.01;
    vx_int32 num_iterations = 10;
    vx_bool use_initial_estimate = vx_true_e;
    vx_int32 min_distance = 5;    // harris params
    vx_float32 sensitivity = 0.04;
    vx_int32 gradient_size = 3;
    vx_int32 block_size = 3;
    vx_context context = vxCreateContext();
    vx_scalar alpha_s = vxCreateScalar(context, VX_TYPE_FLOAT32, &alpha);
    vx_scalar tau_s = vxCreateScalar(context, VX_TYPE_FLOAT32, &tau);
    vx_matrix matrix_forward = vxCreateMatrix(context, VX_TYPE_FLOAT32, 3, 3);
    vx_matrix matrix_backwords = vxCreateMatrix(context, VX_TYPE_FLOAT32, 3, 3);
    vx_array old_features = vxCreateArray(context, VX_TYPE_KEYPOINT, 1000);
    vx_array new_features = vxCreateArray(context, VX_TYPE_KEYPOINT, 1000);
    vx_scalar epsilon_s = vxCreateScalar(context, VX_TYPE_FLOAT32, &epsilon);
    vx_scalar num_iterations_s = vxCreateScalar(context, VX_TYPE_INT32, &num_iterations);
    vx_scalar use_initial_estimate_s = vxCreateScalar(context, VX_TYPE_BOOL, &use_initial_estimate);
    vx_scalar min_distance_s = vxCreateScalar(context, VX_TYPE_INT32, &min_distance);
    vx_scalar sensitivity_s = vxCreateScalar(context, VX_TYPE_FLOAT32, &sensitivity);
    vx_scalar sens_thresh_s = vxCreateScalar(context, VX_TYPE_INT32, &sens_thresh);
    vx_scalar num_corners = vxCreateScalar(context, VX_TYPE_SIZE, NULL);

    if (vxGetStatus((vx_reference)context) == VX_SUCCESS)
    {
        vx_image images[] =
        { vxCreateImage(context, width, height, VX_DF_IMAGE_UYVY),     // index 0:
        vxCreateImage(context, width, height, VX_DF_IMAGE_U8),       // index 1: Get Y channel
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),   // index 2: scale up to high res.
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8), // index 3: back wrap: transform to the original Image.
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),   // index 4: guassian blur
        vxCreateImage(context, width, height, VX_DF_IMAGE_U8),       // index 5: scale down
        vxCreateImage(context, width, height, VX_DF_IMAGE_S16), // index 6: Subtract the transformed Image with original moved Image
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_S16),  // index 7: Scale Up the delta image.
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_S16),  // index 8: Guassian blur the delta Image
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_S16), // index 9: forward wrap: tranform the deltas back to the high res Image
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),    // index 10: accumulate sum?
        vxCreateImage(context, width, height, VX_DF_IMAGE_U8),       // index 11: Get U channel
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),   // index 12: scale up to high res.
        vxCreateImage(context, width, height, VX_DF_IMAGE_U8),       // index 13: Get V channel
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),   // index 14: scale up to high res.
        vxCreateImage(context, width, height, VX_DF_IMAGE_UYVY),     // index 15: output image
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),   // index 16: original y image scaled
        vxCreateImage(context, width * 2, height * 2, VX_DF_IMAGE_U8),   // index 17: difference image for last calculation
                };
        vx_pyramid pyramid_new = vxCreatePyramid(context, 4, 2, width, height, VX_DF_IMAGE_U8);
        vx_pyramid pyramid_old = vxCreatePyramid(context, 4, 2, width, height, VX_DF_IMAGE_U8);

        vx_graph graphs[] =
        { vxCreateGraph(context), vxCreateGraph(context), vxCreateGraph(context), vxCreateGraph(context), };
        vxLoadKernels(context, "openvx-debug");
        if (vxGetStatus((vx_reference)graphs[0]) == VX_SUCCESS)
        {
            vxChannelExtractNode(graphs[0], images[0], VX_CHANNEL_Y, images[1]); // One iteration of super resolution calculation
            vxScaleImageNode(graphs[0], images[1], images[2], VX_INTERPOLATION_TYPE_BILINEAR);
            vxWarpPerspectiveNode(graphs[0], images[2], matrix_forward, 0, images[3]);
            vxGaussian3x3Node(graphs[0], images[3], images[4]);
            vxScaleImageNode(graphs[0], images[4], images[5], VX_INTERPOLATION_TYPE_BILINEAR);
            vxSubtractNode(graphs[0], images[5], images[16], VX_CONVERT_POLICY_SATURATE, images[6]);
            vxScaleImageNode(graphs[0], images[6], images[7], VX_INTERPOLATION_TYPE_BILINEAR);
            vxGaussian3x3Node(graphs[0], images[7], images[8]);
            vxWarpPerspectiveNode(graphs[0], images[8], matrix_backwords, 0, images[9]);
            vxAccumulateWeightedImageNode(graphs[0], images[9], alpha_s, images[10]);

        }
        if (vxGetStatus((vx_reference)graphs[1]) == VX_SUCCESS)
        {
            vxChannelExtractNode(graphs[1], images[0], VX_CHANNEL_Y, images[1]); // One iteration of super resolution calculation
            vxGaussianPyramidNode(graphs[1], images[1], pyramid_new);

            vxOpticalFlowPyrLKNode(graphs[1], pyramid_old, pyramid_new, old_features, old_features, new_features,
                    criteria, epsilon_s, num_iterations_s, use_initial_estimate_s, winSize);
        }
        if (vxGetStatus((vx_reference)graphs[2]) == VX_SUCCESS)
        {
            vxChannelExtractNode(graphs[2], images[0], VX_CHANNEL_Y, images[1]); // One iteration of super resolution calculation

            vxHarrisCornersNode(graphs[2], images[1], sens_thresh_s, min_distance_s, sensitivity_s, gradient_size,
                    block_size, old_features, num_corners);
            vxGaussianPyramidNode(graphs[2], images[1], pyramid_old);
            vxScaleImageNode(graphs[2], images[1], images[16], VX_INTERPOLATION_TYPE_BILINEAR);
        }
        if (vxGetStatus((vx_reference)graphs[3]) == VX_SUCCESS)
        {
            vxSubtractNode(graphs[3], images[10], images[16], VX_CONVERT_POLICY_SATURATE, images[17]);
            vxAccumulateWeightedImageNode(graphs[3], images[17], tau_s, images[16]);
            vxChannelExtractNode(graphs[3], images[16], VX_CHANNEL_U, images[11]);
            vxScaleImageNode(graphs[3], images[11], images[12], VX_INTERPOLATION_TYPE_BILINEAR); // upscale the u channel
            vxChannelExtractNode(graphs[3], images[0], VX_CHANNEL_V, images[13]);
            vxScaleImageNode(graphs[3], images[13], images[14], VX_INTERPOLATION_TYPE_BILINEAR); // upscale the v channel
            vxChannelCombineNode(graphs[3], images[10], images[12], images[14], 0, images[15]); // recombine the channels

        }

        status = VX_SUCCESS;
        status |= vxVerifyGraph(graphs[0]);
        status |= vxVerifyGraph(graphs[1]);
        status |= vxVerifyGraph(graphs[2]);
        status |= vxVerifyGraph(graphs[3]);
        if (status == VX_SUCCESS)
        {
            /* read the initial image in */
            status |= vxuFReadImage(context, "c:\\work\\super_res\\superres_1_UYVY.yuv", images[0]);
            /* compute the "old" pyramid */
            status |= vxProcessGraph(graphs[2]);

            /* for each input image, read it in and run graphs[1] and [0]. */
            for (image_index = 1; image_index < max_num_images; image_index++)
            {
                char filename[256];

                sprintf(filename, "c:\\work\\super_res\\superres_%d_UYVY.yuv", image_index + 1);
                status |= vxuFReadImage(context, filename, images[0]);
                status |= vxProcessGraph(graphs[1]);
                userCalculatePerspectiveTransformFromLK(matrix_forward, matrix_backwords, old_features, new_features);
                status |= vxProcessGraph(graphs[0]);
            }
            /* run the final graph */
            status |= vxProcessGraph(graphs[3]);
            /* save the output */
            status |= vxuFWriteImage(context, images[15], "superres_UYVY.yuv");
        }
        vxReleaseGraph(&graphs[0]);
        vxReleaseGraph(&graphs[1]);
        vxReleaseGraph(&graphs[2]);
        vxReleaseGraph(&graphs[3]);
        for (i = 0; i < dimof(images); i++)
        {
            vxReleaseImage(&images[i]);
        }
        vxReleasePyramid(&pyramid_new);
        vxReleasePyramid(&pyramid_old);
    }
    vxReleaseMatrix(&matrix_forward);
    vxReleaseMatrix(&matrix_backwords);
    vxReleaseScalar(&alpha_s);
    vxReleaseScalar(&tau_s);
    /* Release the context last */
    vxReleaseContext(&context);
    return status;
}