opencv3.0

opencv blend (overlay) two image with different channels

时光怂恿深爱的人放手 提交于 2019-11-28 06:06:23
问题 I want to overlay two images (maybe different format (channels) with opencv. Originally I use addWeighted, however, it fails on two images with different channels. Is there any way in opencv that can handle this case? Thanks 回答1: No , there is no API in OpenCV that offers this feature nativelly. On the other hand, there's nothing stopping you from writing your own code to do that. A few weeks ago a made some changes to a function I saw somewhere else on the Internet to be able to: Pass two

OpenCV: how to create .vec file to use with opencv_traincascade

喜你入骨 提交于 2019-11-28 06:05:14
问题 As I explained in my previous post here, I am trying to generate some cascade.xml files to recognize euro coins to be used in my iOS app. Anyway, I am founding many difficulties in understanding how to generate a .vec file to give as input to opencv_traincascade . This because I heard many dissenting views: someone told me that vector file must include only positive images containing only the object to recognize; someone else instead (and also as read in my tutorials) said that vector file

Is cv2.cv missing in OpenCV 3.0?

余生颓废 提交于 2019-11-28 00:19:41
问题 I've just installed OpenCV 3 on Win7 for using with Python 2.7. I've copied cv2.pyd to /DLLs. Unfortunately many examples I've tried, don't work, because cv2.cv seems to be missing in OpenCV3 Is there a replacement for it? Is there a table of new constant-names used to be declared in cv2.cv? Many thanks! 回答1: yes, the deprecated cv2.cv was removed in opencv3.0 something similar to: import cv2 help(cv2) will give you a (looong) list of the api's content. 回答2: To get old examples to work, you

OpenCV Error: (-215)size.width>0 && size.height>0 in function imshow

六月ゝ 毕业季﹏ 提交于 2019-11-27 23:25:57
I am trying to make a face tracker that combines Haar Cascade Classification with Lucas Kanade good feature detection. However, I keep getting an error that I cannot figure out what it means nor how to solve it. Can anyone help me here? Error: line 110, in <module> cv2.imshow('frame',img) error: /build/buildd/opencv-2.4.8+dfsg1/modules/highgui/src/window.cpp:269: error: (-215)size.width>0 && size.height>0 in function imshow Code: from matplotlib import pyplot as plt import numpy as np import cv2 face_classifier = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_default.xml') cap =

How to translate this image processing from Matlab to OpenCV?

瘦欲@ 提交于 2019-11-27 23:20:38
The link below use Matlab to remove non-text content from an image. I want to do the same thing with OpenCV in Java. I don't have a Matlab to try with and I am new to OpenCV. Though I know some basics about the theory behind the process, but it's kind of difficult to make the translation from Matlab language into OpenCV 3.0. And preferably in Java. http://www.mathworks.com/help/vision/examples/automatically-detect-and-recognize-text-in-natural-images.html ADD 1 - region detection with MSER (not resolved yet) For MSER detection, I can use the following code to detect the MSER keypoints. public

Opencv 3 SVM training

和自甴很熟 提交于 2019-11-27 20:28:40
问题 As you may know, many things changed in OpenCV 3 (in comparision to the openCV2 or the old first version). In the old days, to train SVM one would use: CvSVMParams params; params.svm_type = CvSVM::C_SVC; params.kernel_type = CvSVM::POLY; params.gamma = 3; CvSVM svm; svm.train(training_mat, labels, Mat(), Mat(), params); In the third version of API, there is no CvSVMParams nor CvSVM . Surprisingly, there is a documentation page about SVM, but it tells everything, but not how to really use it

OpenCV vs Matlab : Different Values on pixels with imread

醉酒当歌 提交于 2019-11-27 20:13:50
I have encountered a problem with the function imread() in Matlab (2014) and OpenCV (3.0) on Windows 7 with jpg files. I don't have the same values by reading the same file jpg and the same pixel. Here are my 2 codes : (OpenCV code followed by the Matlab code) and the values I have (mode debug to see in OpenCV, keyboard in Matlab) #include <opencv2\opencv.hpp> #include <cstdio> using namespace cv; using namespace std; int main() { Mat img = imread("test.jpg"); uchar pb = img.at<Vec3b>(0, 0).val[0]; uchar pg = img.at<Vec3b>(0, 0).val[1]; uchar pr = img.at<Vec3b>(0, 0).val[2]; int d = img.depth(

openCV 3.0 python LineIterator

谁都会走 提交于 2019-11-27 14:02:16
I want to use the LineIterator in openCV 3.0 using python, is it still available with openCV 3.0 built for python? It seems that the answers on the internet are all pointing to cv.InitLineIterator which is part of the cv module. I've tried importing this module but it seems like it is not included with the current build. Has it been renamed or strictly just removed? mohikhsan I've solved my own problem. Line iterator seems to be unavailable in the cv2 library. Therefore, I made my own line iterator. No loops are used, so it should be pretty fast. Here is the code if anybody needs it: def

Removing black background and make transparent from grabcut output in python open cv

廉价感情. 提交于 2019-11-27 12:56:50
I have been trying to remove the black background from the grabcut output using python opencv. import numpy as np import cv2 img = cv2.imread(r'myfile_1.png') mask = np.zeros(img.shape[:2],np.uint8) bgdModel = np.zeros((1,65),np.float64) fgdModel = np.zeros((1,65),np.float64) rect = (1,1,665,344) cv2.grabCut(img,mask,rect,bgdModel,fgdModel,5,cv2.GC_INIT_WITH_RECT) mask2 = np.where((mask==2)|(mask==0),0,1).astype('uint8') img = img*mask2[:,:,np.newaxis] cv2.imshow('img',img) cv2.imwrite('img.png',img) cv2.waitKey(0) cv2.destroyAllWindows() Above code I had written to save the grabcut output.

TypeError: Required argument 'outImg' (pos 6) not found

巧了我就是萌 提交于 2019-11-27 11:56:45
问题 When I run my python code import numpy as np import cv2 import matplotlib.pyplot as plt img1 = cv2.imread('/home/shar/home.jpg',0) # queryImage img2 = cv2.imread('/home/shar/home2.jpg',0) # trainImage # Initiate SIFT detector sift = cv2.xfeatures2d.SIFT_create() # find the keypoints and descriptors with SIFT kp1, des1 = sift.detectAndCompute(img1,None) kp2, des2 = sift.detectAndCompute(img2,None) # BFMatcher with default params bf = cv2.BFMatcher() matches = bf.knnMatch(des1,des2, k=2) #