error: (-215) !empty() in function detectMultiScale

I had the same issue. I didn’t need to download anything else to solve this. CV2 had everything I needed. Instead of trying to figure out where the .xml files are and hard coding the values, I used a property given by cv2. From OP face_cascade = cv2.CascadeClassifier(‘haarcascade_frontalface_default.xml’) eye_cascade = cv2.CascadeClassifier(‘haarcascade_eye.xml’) Becomes face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades … Read more

How can I sharpen an image in OpenCV?

One general procedure is laid out in the Wikipedia article on unsharp masking: You use a Gaussian smoothing filter and subtract the smoothed version from the original image (in a weighted way so the values of a constant area remain constant). To get a sharpened version of frame into image: (both cv::Mat) cv::GaussianBlur(frame, image, cv::Size(0, … Read more

OpenCV in Android Studio

The below steps for using Android OpenCV sdk in Android Studio. This is a simplified version of this SO answer. Download latest OpenCV sdk for Android from OpenCV.org and decompress the zip file. Import OpenCV to Android Studio, From File -> New -> Import Module, choose sdk/java folder in the unzipped opencv archive. Update build.gradle … Read more