static VALUE OpenVX_load(VALUE self, VALUE name) { vx_status status = VX_FAILURE; Check_Type(name, T_STRING); status = vxLoadModule(context, RSTRING(name)->ptr); REXT_PRINT("status = %d\n", status); return Qnil; }
int main(int argc, char* argv[]) { vxModule* module; vxSource* source; /* initialise a new AR Toolkit state */ art = artCreate(); /* set debugging */ artSetInteger(art, artDebug, 0); /* load a pattern onto a marker */ hiro_marker = artLoadMarker(art,"Data/patt.hiro",80.0); /* load the camera parameter */ artLoadCameraParameter(art,"Data/camera_para.dat"); /** register a module */ module = vxLoadModule(argv[1]); /** create a source from that module */ source = vxCreate(module); /** configure the source */ vxConfig(source, "v4lsrc ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=vxsink ! ffmpegcolorspace ! autovideosink"); /** start capturing */ vxStart(source,&vxCaptureCallback,0); while (vxOK == vxUpdate(source,vxNext)) { }; }
vx_status vxLoadKernels(vx_context c, vx_char *name) { vx_context_t *context = (vx_context_t *)c; vx_status status = VX_FAILURE; vx_char module[VX_INT_MAX_PATH]; vx_uint32 m = 0; vx_publish_kernels_f publish = NULL; sprintf(module, VX_MODULE_NAME("%s"), (name?name:"openvx-ext")); if (vxIsValidContext(context) == vx_false_e) { VX_PRINT(VX_ZONE_ERROR, "Context is invalid!\n"); return VX_ERROR_INVALID_REFERENCE; } for (m = 0; m < VX_INT_MAX_MODULES; m++) { if (context->modules[m].handle == NULL) { context->modules[m].handle = vxLoadModule(module); if (context->modules[m].handle) { vx_symbol_t sym = vxGetSymbol(context->modules[m].handle, "vxPublishKernels"); publish = (vx_publish_kernels_f)sym; if (publish == NULL) { VX_PRINT(VX_ZONE_ERROR, "Failed to load symbol vxPublishKernels\n"); status = VX_ERROR_INVALID_MODULE; vxUnloadModule(context->modules[m].handle); context->modules[m].handle = NULL; } else { VX_PRINT(VX_ZONE_INFO, "Calling %s publish function\n", module); status = publish((vx_context)context); if (status != VX_SUCCESS) { VX_PRINT(VX_ZONE_ERROR, "Failed to publish kernels in module\n"); vxUnloadModule(context->modules[m].handle); context->modules[m].handle = NULL; } else { strncpy(context->modules[m].name, name, VX_INT_MAX_PATH); context->numMods++; } } } else { VX_PRINT(VX_ZONE_ERROR, "Failed to find module %s in libraries path\n", module); } break; } else { VX_PRINT(VX_ZONE_CONTEXT, "module[%u] is used\n", m); } } if (status != VX_SUCCESS) { VX_PRINT(VX_ZONE_ERROR, "Failed to load module %s; error %d\n", module, status); } else { for (m = 0; m < context->numMods; m++) { VX_PRINT(VX_ZONE_INFO, "Module: %s\n", context->modules[m].name); } } return status; }