Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

[OpenCV]How to get the number of camera

  1. How to get the total number of camera?
  2. The following is my code, but i find that it will make the memory leak

    int CvCaptureCAM_DShow::getDeviceCount(){
    int deviceNumber = VI.listDevices(true);
    return deviceNumber;}
    
    
    int  cvGetDeviceCount_DShow(){
    CvCaptureCAM_DShow* capture = new CvCaptureCAM_DShow;
    
    int deviceCount = capture->getDeviceCount();
    
    delete capture;
    capture = NULL;
    
    return deviceCount;
    

    }

[OpenCV]How to get the number of camera

  1. How to get the total number of camera?
  2. The following is my code, but i find that it will make the memory leak

    int CvCaptureCAM_DShow::getDeviceCount(){
    int deviceNumber = VI.listDevices(true);
    return deviceNumber;}
    
    
    int  cvGetDeviceCount_DShow(){
    CvCaptureCAM_DShow* capture = new CvCaptureCAM_DShow;
    
    int deviceCount = capture->getDeviceCount();
    
    delete capture;
    capture = NULL;
    
    return deviceCount;
    

    }