opencv3.0

OpenCV SVM Training Data

依然范特西╮ 提交于 2019-12-04 15:32:57
I would like to learn svm implementation by using opencv 3.00 library in C++ and Visual Studio 2013. My code: #include<stdio.h> #include<math.h> #include<opencv\cv.h> #include<opencv\highgui.h> #include<opencv2\objdetect\objdetect.hpp> #include<opencv2\highgui\highgui.hpp> #include<opencv2\imgproc\imgproc.hpp> #include<vector> #include <windows.h> #include <atlstr.h> #include <iostream> #include <sstream> #include <iomanip> #include <opencv2\imgproc\imgproc.hpp> #include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <opencv\cvaux.hpp> using namespace cv; using

Python: Print only one time inside a loop

我与影子孤独终老i 提交于 2019-12-04 14:49:28
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.createCLAHE(clipLimit = 15.0, tileGridSize=(8,8)) gray1 = clahe.apply(gray) but what I get in the shell is

Houghlines in android with opencv

牧云@^-^@ 提交于 2019-12-04 13:01:11
I am trying to make a perspective correction for quadrilateral objects using opencv3 . I managed to show the lines and also implemented the Houghlines using Imgproc.HoughLinesP() and tried to highlight the lines using Imgproc.lines() but output was no success. Below is my code and also I have attached my output image. Please let me know what is wrong happening and what should be done... Mat initImg; // initial image Mat greyImg; // converted to grey Mat lines = new Mat(); int threshold = 50; int minLineSize = 20; int lineGap = 10; initImg = Imgcodecs.imread(imgLoc, 1); greyImg = new Mat();

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

蹲街弑〆低调 提交于 2019-12-04 09:05:56
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 what else to do. The weird thing is it works on my laptop but not my desktop. They both have the same

How to compress png file with opencv in python?

此生再无相见时 提交于 2019-12-04 07:55:46
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 Miki 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 post mentions also to cast to int . I'm not sure if this is still needed: cv2.imwrite('compress_img1.png',

Wrong python packages path for opencv cmake installation

ぐ巨炮叔叔 提交于 2019-12-04 07:49:32
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 installed it later and followed the steps again. Could this be a problem? Python 2: -- Interpreter:

How to stitch 100s of images using OpenCV/JavaCV? Most of the current solutions leads to artifacts

邮差的信 提交于 2019-12-04 06:09:56
问题 I am trying to stitch a large number of images which have good amount overlap like these: ExampleImage1 and ExampleImage2. Firstly, i want a 1D line of a grass patch. Something like this: Result. This is a screenshot of the original result, the original picture is more than 2MB. Hence couldnt upload it. This was achieved by breaking down 300 images into small sets and stitching them. Like this example but in a larger scale with more heirarchies - 0.jpg,1.jpg,2.jpg images in stitch1.jpg, 2,3,4

Anaconda: cannot import cv2 even though opencv is installed (how to install opencv3 for python3)

老子叫甜甜 提交于 2019-12-04 01:47:15
I have anaconda (version: conda 4.2.9, python3) installed and am trying to do import cv2 when I get the following error: ImportError: No module named 'cv2' With conda search cv2 I get this: opencv 2.4.2 np15py26_0 defaults 2.4.2 np15py27_0 defaults 2.4.2 np16py26_0 defaults 2.4.2 np16py27_0 defaults 2.4.2 np17py26_0 defaults 2.4.2 np17py27_0 defaults 2.4.2 np15py26_1 defaults 2.4.2 np15py27_1 defaults 2.4.2 np16py26_1 defaults 2.4.2 np16py27_1 defaults 2.4.2 np17py26_1 defaults 2.4.2 np17py27_1 defaults 2.4.6 np16py26_0 defaults 2.4.6 np16py27_0 defaults 2.4.6 np17py26_0 defaults 2.4.6

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

空扰寡人 提交于 2019-12-03 21:44:28
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 from email import encoders import cv2, time DURATION_INT = 5 class MyMainWindow(QtWidgets.QMainWindow):

Opencv detect changes between two photos taken by different time

拥有回忆 提交于 2019-12-03 21:34:33
We have one original image / photo of the item. (ie sculpture). Time to time we are taking new photos of the item. Photo always taken same angle 90 degree to the item. but there will be some slightly movement up down / left right there will be different length of the same object ( we are taking with line camera and the object moving in front of it so time to time speed of the object changing so the final image will be longer than the original) Also lighting changes so colour and lightning also not same always. Time to time there will be a mud, different small objects on the item. I would love