opencv3.0

how to limit number of faces detected by haar cascades

放肆的年华 提交于 2019-12-11 02:48:02
问题 I am using Haar cascade in an emotion detection system. Every video input I am giving to the model has only one face in it (It is a requirement). When I run Haar cascade model to detect faces, it has some false positives. Since I have only one face in the video, I want to take the most positive area detected and ignore all other detection. Is there a way to do that? 回答1: when you are calling detectMultiScale function, set the minNeighbours value to a high value to avoid false positives. Also,

Gtk+ 3 Error when compiling with OpenCV

筅森魡賤 提交于 2019-12-11 01:31:12
问题 I have recently built OpenCV 3 from source on linux. I am able to successfully compile and run OpenCV programs. I then downloaded Gtk+ 3 and all the required packages (GLib 2.52, Pango 1.40, Gdk-Pixbuf 2.36, ATK 2.24, GObject-Introspection 1.52). I am able to successfully compile and run this simple program compiling with: g++ -std=c++11 gtkexample.cpp `pkg-config --cflags gtk+-3.0` -o gtkexample `pkg-config --libs gtk+-3.0` Source code: #include <gtk-3.0/gtk/gtk.h> int main( int argc, char

Compile OpenCV - Python.h - Can't find Python.h

痞子三分冷 提交于 2019-12-11 01:21:38
问题 Im trying compile OpenCV 3.1.0 on a EC2 instance with ubuntu 14.04. But I log this error: Scanning dependencies of target opencv_python2 [100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o /home/ubuntu/opencv/modules/python/src2/cv2.cpp:6:20: fatal error: Python.h: No such file or directory #include <Python.h> ^ compilation terminated. make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1 make[1]: *** [modules/python2

No member named 'getMat' in 'cv::face::FaceRecognizer'

自古美人都是妖i 提交于 2019-12-10 21:54:41
问题 @interface FJFaceRecognizer () { Ptr<FaceRecognizer> _faceClassifier; } @property (nonatomic, strong) NSMutableDictionary *labelsDictionary; @end @implementation FJFaceRecognizer - (NSArray *)labels { On next line I get error message No member named 'getMat' in 'cv::face::FaceRecognizer' , when using OpenCV 3.0: cv::Mat labels = _faceClassifier->getMat("labels"); if (labels.total() == 0) { return @[]; } else { NSMutableArray *mutableArray = [NSMutableArray array]; for (MatConstIterator_<int>

undefined reference to 'cv::CascadeClassifier::detectMultiScale', but other lib linked properly

喜夏-厌秋 提交于 2019-12-10 18:52:01
问题 I am using NDK to perform some opencv functions to see if using c++ will speed up the processing (I used Java Wrappers in another project). All was compiling fine until I added the detectMultiScale function in my class where suddenly the linker failed and produced the undefined reference error . The error will go away if I commented out that line. I searched all over the net but no one seems to have the same problem aside from undefined reference to CascadeClassifier::detectMultiScale where

Build OpenCV 3.0 with OpenGL and GTK on LMDE2 (Debian 8.2)

a 夏天 提交于 2019-12-10 12:22:35
问题 I've built the opencv with cmake -DWITH_OPENGL=ON .. , but the output of the cmake tell me the OpenGL supported is NO . And I've checked the cmake cache to assure the WITH_OPENGL is ON . The GUI used is GTK+ 3.0, and the libgtkglext1-dev is installed. 回答1: After reading the cmake script cmake/OpenCVFindLibsGUI.cmake , I've found the related cmake codes: # --- GTK --- ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT) if(WITH_GTK AND NOT HAVE_QT) # ... if(WITH_OPENGL AND NOT HAVE

How to setup Allied Vision Camera Manta using OpenCV in Visual Studio

会有一股神秘感。 提交于 2019-12-10 10:58:57
问题 I have laptop with Windows 10 and Marvell Yukon 88E8072 PCI-E Gigabit Ethernet Controller. I have Allied Vision Manta camera connected to my laptop. I installed Visual Studio 2015 and also I installed Allied Vision SDK - Vimba Viewer. I am able to capture images with Vimba Viewer interface soo I know that camera is working ok. The problem is when I try to capture images in Visual Studio. I downloaded sample source code and with this code I am able to capture image from my webcam.This is code:

Cropping live video feed in OpenCV

别说谁变了你拦得住时间么 提交于 2019-12-09 19:34:38
问题 I have a live video feed that tracks green objects and draws a rectangle over the object's area. I'm curious as to how I would be able to crop the feed to only show the area that the rectangle encompasses. Here's the section of relevance: while True: (success, frame) = webcam.read() frame = imutils.resize(frame, width = 1000) hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv, greenLower, greenUpper) mask = cv2.erode(mask, None, iterations=2) mask = cv2.dilate(mask, None,

Python: Print only one time inside a loop

喜欢而已 提交于 2019-12-09 19:17:38
问题 I have a code where I want capture a video from a camera. I want to use Logging library of Python to get messages on the shell or export them to a text file. Here is a part of my code where inside the while loop I want to print Camera Opened Successfully import numpy as np import cv2 import logging as log cap = cv2.VideoCapture('5.mpg') while True: ret, image = cap.read() if ret == True: log.warning('Camera Opened Successfully') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) clahe = cv2

How to compress png file with opencv in python?

折月煮酒 提交于 2019-12-09 17:27:14
问题 I tried this code: compression_params = [cv2.CV_IMWRITE_PNG_COMPRESSION, 9] img = cv2.imread('img1.png', cv2.IMREAD_UNCHANGED) cv2.imwrite('compress_img1.png', img, compression_params) But I obtain this error: AttributeError: module 'cv2' has no attribute 'CV_IMWRITE_PNG_COMPRESSION' I'm working with python 3.5 and opencv 3.0 回答1: The name in OpenCV 3.0 is IMWRITE_PNG_COMPRESSION (without the CV_ prefix). So try: cv2.imwrite('compress_img1.png', img, [cv2.IMWRITE_PNG_COMPRESSION, 9]) This