SHARE
TWEET

Veehmot

a guest Mar 10th, 2009 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define WIDTH 640
  2. #define HEIGHT 480
  3.  
  4. #include <objbase.h>
  5. #include <atlbase.h>
  6. #include "optitrack.h"
  7. #import  "optitrack.tlb"
  8.  
  9. #include "cv.h"
  10. #include "highgui.h"
  11. IplImage *backbuffer = cvCreateImage( cvSize(WIDTH,HEIGHT), IPL_DEPTH_8U, 4 );
  12. IplImage *camBuffer = cvCreateImage(cvSize(WIDTH,HEIGHT),IPL_DEPTH_8U, 1);
  13.  
  14. void NeverCalledFunction(){
  15.         IplImage *tempImage = cvCreateImage(cvSize(camBuffer->width,camBuffer->height),camBuffer->depth, 3);
  16.         cvConvertImage(camBuffer, tempImage);
  17. }
  18. int main() {
  19.  
  20.         CoInitialize(NULL);
  21.  
  22.         CComPtr<INPCameraCollection> cameraCollection;
  23.         CComPtr<INPCamera>           camera;
  24.         CComPtr<INPCameraFrame>          frame;
  25.  
  26.         cameraCollection.CoCreateInstance(CLSID_NPCameraCollection);
  27.  
  28.         cameraCollection->Enum();
  29.  
  30.         long cameraCount  = 0;
  31.  
  32.         cameraCollection->get_Count(&cameraCount);
  33.  
  34.         if(cameraCount>0) {
  35.                 cameraCollection->Item(0, &camera);
  36.                 camera->Open();
  37.                 camera->Start();
  38.  
  39.                 while(true) {
  40.                         camera->GetFrame(0, &frame);
  41.                         if(frame!=0) {
  42.                                 camera->GetFrameImage(frame, camBuffer->width, camBuffer->height, camBuffer->widthStep, 8, (byte *) camBuffer->imageData);
  43.                                 frame->Free();
  44.                                 frame.Release();
  45.                         }
  46.                 }                      
  47.                 camera->Stop();
  48.                 camera->Close();
  49.  
  50.                 camera.Release();
  51.         }
  52.  
  53.         cameraCollection.Release();
  54.  
  55.         CoUninitialize();
  56.         return 0;
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top