2

I have installed the opencv on MacPro and am trying to write a program which allow me to activate the cam, it is only to test opencv it build successfully, however, the cam is not on and I receive this message

saved enable noise cancellation setting is the same as the default(=1) pentest[30782:364297] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data

my code is:

#include <iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
int main(int argc, const char * argv[]) {
    // insert code here...
    VideoCapture cap(0);
    while(true){
        Mat Webcam;
        cap.read(Webcam);
        imshow("webcam",Webcam);
    }
    return 0;
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Naif
  • 51
  • 1
  • What have you tried to solve this: `The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data)`? – asu Nov 11 '18 at 21:55
  • can you explain what do you mean? – Naif Nov 11 '18 at 22:13
  • The OS seems to indicate to you that your application should provide this information in particular. I don't know anything about macOS, but my point is that you should edit your post to explain what you have tried to do to solve this error and the problem you're encountering while trying to fix it. – asu Nov 11 '18 at 22:17
  • I meet the same problem today and solved with this method: https://stackoverflow.com/questions/53190412/accessing-webcam-in-xcode-with-opencv-c – bigphess Nov 21 '18 at 06:36

1 Answers1

0

I recently posted another answer that addresses this situation:

Put the Info.plist file with the desired NSCameraUsageDescription, NSMicrophoneUsageDescription (or others) with the assembled file from XCode (See screenshots below). For the Release and Debug versions.

Valery Gromov
  • 136
  • 2
  • 4