Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

detectMultiScale in Python

I am a newbie in Python. I have a OpenCV related issue. I have this simple code:

import sys
from matplotlib import pyplot
import cv2

im = cv2.imread("E:\\Face.jpg")

def plot_img(img):
    rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    pyplot.imshow(rgb)

if im.any():
    plot_img(im)

if im.any():
    classifier = cv2.CascadeClassifier()
    classifier.load("E:\\haarcascade_eye.xml")
    classifier.detectMultiScale(im)

but on line classifier.load("E:\haarcascade_eye.xml") I got the following error:

Exception has occurred: error
OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-d54til6p\opencv\modules\core\src\persistence.cpp:717: error: (-49:Unknown error code -49) Input file is invalid in function 'cv::FileStorage::Impl::open'
  File "D:\Tempx\PythonApplication1\PythonApplication1.py", line 18, in <module>
    classifier.load("E:\\haarcascade_eye.xml")

I have downloaded haarcascade_eye.xml from here: https://github.com/opencv/opencv/tree/master/data/haarcascades

What could be the problem ?

detectMultiScale in Python

I am a newbie in Python. I have a OpenCV related issue. I have this simple code:

import sys
from matplotlib import pyplot
import cv2

im = cv2.imread("E:\\Face.jpg")

def plot_img(img):
    rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    pyplot.imshow(rgb)

if im.any():
    plot_img(im)

if im.any():
    classifier = cv2.CascadeClassifier()
    classifier.load("E:\\haarcascade_eye.xml")
    classifier.detectMultiScale(im)

but on line classifier.load("E:\haarcascade_eye.xml") I got the following error:

Exception has occurred: error
OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-d54til6p\opencv\modules\core\src\persistence.cpp:717: error: (-49:Unknown error code -49) Input file is invalid in function 'cv::FileStorage::Impl::open'
  File "D:\Tempx\PythonApplication1\PythonApplication1.py", line 18, in <module>
    classifier.load("E:\\haarcascade_eye.xml")

I have downloaded haarcascade_eye.xml from here: https://github.com/opencv/opencv/tree/master/data/haarcascades

What could be the problem ?

detectMultiScale in PythonInput file is invalid

I am a newbie in Python. I have a OpenCV related issue. I have this simple code:

import sys
from matplotlib import pyplot
import cv2

im = cv2.imread("E:\\Face.jpg")

def plot_img(img):
    rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    pyplot.imshow(rgb)

if im.any():
    plot_img(im)

if im.any():
    classifier = cv2.CascadeClassifier()
    classifier.load("E:\\haarcascade_eye.xml")
    classifier.detectMultiScale(im)

but on line classifier.load("E:\haarcascade_eye.xml") I got the following error:

Exception has occurred: error
OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-d54til6p\opencv\modules\core\src\persistence.cpp:717: error: (-49:Unknown error code -49) Input file is invalid in function 'cv::FileStorage::Impl::open'
  File "D:\Tempx\PythonApplication1\PythonApplication1.py", line 18, in <module>
    classifier.load("E:\\haarcascade_eye.xml")

I have downloaded haarcascade_eye.xml from here: https://github.com/opencv/opencv/tree/master/data/haarcascades

What could be the problem ?