OpenVIDIA : Parallel GPU Computer Vision |
|||||
![]() Home Features Screenshots & Videos Installation Instructions Quickstart Programming Example v0-0.07x Programming Example v0.8 Computer Vision with CUDA (new 1May08) Framebuffer Objects Download Papers Contributing sf.net project page
- Bugs
( 0 open / 0 total )
- Support Requests
( 1 open / 1 total )
- Patches
( 1 open / 1 total )
- Feature Requests
( 0 open / 1 total ) There are no public subprojects available
Related Projects
Reference Links gpu's arent just good for vision and computation - some clever folks have started using them for games as well. ;) har har linux-games.net 7 Years of Graphics Card History Page design based on Blosxom (which was used originally before the move to sourceforge). This page best viewed with Dillo, Lynx, w3m, Mozilla-Firefox, Galeon, Epiphany, konqueror . . . |
Programming with libopenvidia, version 0.8 and upThe following show how to use the current functions included in libopenvidia 0.8.0. Work is underway to include all the features of 0.07 into 0.8. The following examples are snippets from the example programs which can be found in /examples Click here for class documentation Additionally, note some objects are subclassed CommonC++ objects, and others from STL vectors and pairs. Firewire Image CaptureTypical usage://construct a 1394 capture object, using 320x240 resolution. // options are 640x480, 320x240, 160x120 Dc1394 CamSource(320,240);
// make a texture
glGenTextures(1, &tex); // texture
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, width,height, 0,
GL_RGB, GL_UNSIGNED_BYTE,NULL );
//start the camera capture
CamSource.start();
// rendering loop
while(1) {
//wait for a new frame to be captured.
// this can be removed if you dont mind re-using a previous frame.
CamSource.wait();
//lock the image data so it is not updated while we are capturing.
CamSource.lock();
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex);
glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0,0, width,height,
GL_RGB, GL_UNSIGNED_BYTE,CamSource.ptr());
//free the image data so it can be updated again.
CamSource.unlock();
//use the image... } Generic CG image processing using FBO_FilterTypical usage might look something like:
// Generate a texture to hold the input image
glGenTextures(1, &tex); // texture
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, width,height, 0,
GL_RGB, GL_UNSIGNED_BYTE, Im->rgb_data );
// Generate a texture to hold the output image. Set the output texture's
// internal format to the desired output precision
glGenTextures(1, &oTex); // texture
glBindTexture(GL_TEXTURE_RECTANGLE_NV, oTex);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, width,height, 0,
GL_RGB, GL_UNSIGNED_BYTE, NULL );
// Create the filter.
filter = new FBO_Filter(CG_PROFILE_FP30,argv[1], oTex, width, height);
...
// rendering loop
while(true) {
//apply the filter. fills in oTex
filter->apply( tex, false);
//show the resulting texture oTex
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, oTex) ;
// draw the 'tex' texture containing the framebuffer rendered drawing.
glBegin(GL_QUADS);
glTexCoord2f(0, height);
glVertex3f( 0.0, 1.0, d );
glTexCoord2f(0, 0);
glVertex3f( 0.0, 0.0, d );
glTexCoord2f(width, 0);
glVertex3f( 1.0, 0.0, d );
glTexCoord2f(width,height);
glVertex3f( 1.0, 1.0, d );
glEnd();
}
Detecting and extracting features in an imageFinds features in an image and returns unique vectors for each. Implemnetation is based upon SIFT keys. Typical usage:
//create the feature tracking object. give it the size of the images it will operate on. ft = new featureTrack(sourcewidth, sourceheight );
// make a texture
glGenTextures(1, &tex); // texture
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, sourcewidth,
sourceheight, 0, GL_RGB, GL_UNSIGNED_BYTE,NULL );
//rendering loop
while(1) {
//update the image frame...
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex );
glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0,0, sourcewidth, sourceheight,
GL_RGB, GL_UNSIGNED_BYTE, sourcedata );
// retrieve features from the image.
Scene *s = ft->getScene(tex);
// scene is a STL vector of features.
cerr<<"Scene with "<< s->features.size() <<" features.\n";
//operate on the scene, s
...
// toss the scene away after we're done to avoid memory leak
delete(s);
}
See /examples/feature.cc for an example of how to use the scene information to do a RANSAC motion estimation.
| ||||