opencv haartraining didnt finish

Issue i use 1292 positive image its for face and 5712 negative image and this my code for harrtraining C:\opencv\build\x64\vc11\bin\opencv_haartraining.exe -data cascades -vec vector/facevector.vec -bg negative/bg.txt -npos 1033 -nneg 5712 -nstages 20 -nsplits 2 -nonsym -minhitrate 0.999 -maxfalsealarm 0.5 -mem

Continue reading

How to fill a polygon in OpenCV?

Issue The Python code given below draws a triangle, how can I fill it with a color inside? Or another easier way to draw a triangle in OpenCV? pts = np.array([[100,350],[165,350],[165,240]], np.int32) cv2.polylines(img,[pts],True,(0,255,255),2) Solution You have to use cv2.fillPoly(). Illustration

Continue reading

Python3 'cv2.resizeWindow('img', 500,500)' error

Issue I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\Desktop\Projects\Face Tracking\servo\face.py", line 27, in <module> cv2.resizeWindow(‘img’, 500,500) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1473: error: (-27:Null pointer) NULL window:

Continue reading

Python3 'cv2.resizeWindow('img', 500,500)' error

Issue I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\Desktop\Projects\Face Tracking\servo\face.py", line 27, in <module> cv2.resizeWindow(‘img’, 500,500) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1473: error: (-27:Null pointer) NULL window:

Continue reading

Python3 'cv2.resizeWindow('img', 500,500)' error

Issue I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\Desktop\Projects\Face Tracking\servo\face.py", line 27, in <module> cv2.resizeWindow(‘img’, 500,500) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1473: error: (-27:Null pointer) NULL window:

Continue reading

Error: (-215:Assertion failed) npoints > 0 while working with contours using OpenCV

Issue When I run this code: import cv2 image = cv2.imread(‘screenshoot10.jpg’) cv2.imshow(‘input image’, image) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) edged = cv2.Canny(gray, 30, 200) cv2.imshow(‘canny edges’, edged) _, contours = cv2.findContours(edged, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) cv2.imshow(‘canny edges after contouring’, edged) print(contours) print(‘Numbers of

Continue reading

Removing Horizontal Lines in image (OpenCV, Python, Matplotlib)

Issue Using the following code I can remove horizontal lines in images. See result below. import cv2 from matplotlib import pyplot as plt img = cv2.imread(‘image.png’,0) laplacian = cv2.Laplacian(img,cv2.CV_64F) sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=5) plt.subplot(2,2,1),plt.imshow(img,cmap = ‘gray’) plt.title(‘Original’), plt.xticks([]), plt.yticks([]) plt.subplot(2,2,2),plt.imshow(laplacian,cmap =

Continue reading