Plugin : output image + structure

benoitlahoz's picture

Hey !

I'm working on a OpenCV plugin and I (now, finally !) manage to output an image from it, but now I would like to output both image and structure but it doesn't work. I have this message :

-[HandTrackingPlugIn setOutputHands:]: unrecognized selector sent to instance

My image provider is kind of ugly and I'm afraid that is the reason, but... Here's the code :

Bla bla bla... 
 
 
               double centerX = ((r->x + r->width / 2) * scale);
                    double centroidX = (width / (double)[imgCV getSize].width * centerX) - (width / 2.f);
                    double centerY = ((r->y + r->height / 2) * scale);
                    double centroidY = (height / (double)[imgCV getSize].height * centerY) - (height / 2.f);
 
 
 
                    [hands addObject:[NSArray arrayWithObjects:
                                      [NSNumber numberWithDouble:centroidX], 
                                      [NSNumber numberWithDouble:centroidY],
                                      nil]];
                }
 
 
 
 
 
                cvClearMemStorage(cstorage);
                cvReleaseMemStorage(&cstorage);
                cvClearMemStorage(hstorage);
                cvReleaseMemStorage(&hstorage);
                [imgLittle release];
 
 
            }
 
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            glClearColor(0., 0., 0., 0.);
            glLoadIdentity();
 
            glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT);
            glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
 
            GLuint tex = [imgCV generateTextureInContext:cgl_ctx];
 
            self.outputImage =  [context outputImageProviderFromTextureWithPixelFormat:pixelFormat
                                                                            pixelsWide:[imgCV getSize].width
                                                                            pixelsHigh:[imgCV getSize].height
                                                                                  name:tex
                                                                               flipped:YES
                                                                       releaseCallback:textureReleaseCallback
                                                                        releaseContext:NULL
                                                                            colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)
                                                                      shouldColorMatch:YES];
 
 
 
            glPopClientAttrib();
            glPopAttrib();
 
 
            self.outputHands = hands;

Any idea of what's happening ? I'm very bad at understanding OpenGL and image providers...

Thank you !

benoitlahoz's picture
Re: Plugin : output image + structure

Oooppsss... Sorry... I was outputing an NSMutableArray...