opencv3.0

how to track foreground in video and draw rectangle on it

无人久伴 提交于 2019-12-06 10:37:39
问题 im working in motion detection script that tracking pepole i used foreground function MOG2 and it work what i want to do in the next step is draw a rectangle in moving pepole but i get a error when i run it there are any ideas how to fix it ? the error: OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /home/shar/opencv/modules/core/src/array.cpp, line 2494 terminate called after throwing an instance of 'cv::Exception' what():

HSL range for yellow lane lines

吃可爱长大的小学妹 提交于 2019-12-06 09:31:57
I am currently working on simple lane detection and I have some trouble finding the range/input values for yellow colored lane lines. def color_filter(image): #convert to HLS to mask based on HLS hls = cv2.cvtColor(image, cv2.COLOR_BGR2HLS) lower = np.array([0,190,0]) upper = np.array([255,255,255]) yellower = np.array([40,70,60]) #NOT SURE WHAT TO PUT yelupper = np.array([50,90,65]) #NOT SURE WHAT TO PUT yellowmask = cv2.inRange(hls, yellower, yelupper) whitemask = cv2.inRange(hls, lower, upper) mask = cv2.bitwise_or(yellowmask, whitemask) masked = cv2.bitwise_and(image, image, mask = mask)

OpenCV 3.0 + Visual Studio Memory Leak Detector “false” positive

旧街凉风 提交于 2019-12-06 09:03:31
I would like to create project with enabled Visual Studio memory leak detector ( Memory Leak Detector ) It always worked fine and I could easily find memory leaks by running bunch of tests on my application and then checking the report. But after statically linking OpenCV 3.0 to my project I got some false positives. For instance the most frustrating error comes from StereoBMImpl::compute method and call: ocl::useOpenCL() After debugging I found the source of the "leak": TLSData<CoreTLSData>& getCoreTlsData() { static TLSData<CoreTLSData> *value = new TLSData<CoreTLSData>(); return *value; }

Python 2.7/OpenCV 3.3: Error in cv2.initUndistortRectifyMap . Not showing undistort rectified images

孤街醉人 提交于 2019-12-06 07:42:59
I want to distort and rectified my stereo images. For which I used Opencv 3.3 in Python 2.7. Code I used is : import cv2 import numpy as np cameraMatrixL = np.load('mtx_left.npy') distCoeffsL = np.load('dist_left.npy') cameraMatrixR = np.load('mtx_right.npy') distCoeffsR = np.load('dist_right.npy') R = np.load('R.npy') T = np.load('T.npy') imgleft = cv2.imread('D:\python\camera calibration and 3d const\left\left60.png',0) imgright = cv2.imread('D:\python\camera calibration and 3d const\Right/right60.png',0) R1,R2,P1,P2,Q,validPixROI1, validPixROI2 = cv2.stereoRectify(cameraMatrixL,distCoeffsL

attributeerror: module 'cv2.face' has no attribute 'createlbphfacerecognizer'

蹲街弑〆低调 提交于 2019-12-06 05:16:42
问题 So i'm doing a little personal project but i keep getting this error when I try to create the recognizer. i have opencv-contrib and everything. Does anyone know whats going on? code posted below import cv2, os import numpy as np from PIL import Image cascadePath = "haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cascadePath) recognizer = cv2.face.createLBPHFaceRecognizer() it gets caught on that last line. I've tried reinstalling all modules already. Not really sure

Wrong python packages path for opencv cmake installation

99封情书 提交于 2019-12-06 03:59:48
问题 I've been trying to follow the opencv installation steps from pyimagesearch.com with virtualenv. Everything works fine except for the packages path: it should be /Users/JLee/Envs/cv/lib/python2.7/site-packages but it's configured as lib/python2.7/site-packages In Python, import cv2 works well in the global setting but doesn't work in the 'cv' virtual environment. While following the steps from the site, I first proceeded without installing virtualenv, then realized I haven't installed it so I

OpenCV matchTemplate threshold values for different methods

此生再无相见时 提交于 2019-12-06 03:49:14
I searched a lot for finding the threshold values for the below mention methods. methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR', 'cv2.TM_CCORR_NORMED', 'cv2.TM_SQDIFF', cv2.TM_SQDIFF_NORMED'] I also tried to figure them out by myself but I could only find thresholds for 3 methods which have max value of 1.0. The other methods values were in range of 10^5. I would like to know the bounds of these methods. Can somebody point me in the right direction. My agenda is to loop through all the methods for template matching and get the best outcome.I went through the documentation

Object of abstract class type “cv::BackgroundSubtractorMOG2” is not allowed. all the methods are pure virtual

吃可爱长大的小学妹 提交于 2019-12-06 02:33:46
I develop the code in VS2015 + OpenCV3.0 in Windows 7 64bit. This is a demo code that I want have a try. And I have tried many demo but I was coming across the same problem: object of abstract class type "cv::BackgroundSubtractorMOG2" is not allowed. all the methods are pure virtual function. The demo code is: using namespace cv; using namespace std; int main() { VideoCapture video("1.avi"); Mat frame, mask, thresholdImage, output; //video>>frame; Ptr<BackgroundSubtractor> pMOG2; pMOG2 = new BackgroundSubtractorMOG2(); BackgroundSubtractorMOG2 bgSubtractor(20, 16, true); while (true) { video >

Python OpenCV video format play in browser

倖福魔咒の 提交于 2019-12-05 09:33:54
I'm trying to create a video from a sequence of images and display it in a browser but from some weird reason no matter what codec or file format I use I get the following error: No video with supported format and mime type found Here is my code: ready_images = [] import cv2 for img in videos['Images']: image = cv2.imread(img.fileName) ready_images.append(image) fourcc = cv2.VideoWriter_fourcc(*'MP4V') video_name = videos['Images'][0].gifLocationPath + "//" + videos['Name'] frame = cv2.imread(videos['Images'][0].fileName) height, width, layers = frame.shape video_name = video_name[:-4]+".mp4"

I wanted to add capturing image by using webcam to my PyQt gui window and webcam image will come on gui window

我与影子孤独终老i 提交于 2019-12-05 07:20:50
问题 I wanted to add the webcam image to my main GUI window and that image will send to the email id. If this is not Possible, I also want to save that image and that saved image will send to my email id and On the countdown to 3,2,1, smile it will click the image by webcam. Here, is my code: import sys from PyQt5 import QtCore from PyQt5 import QtWidgets, QtGui import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase