opencv3.0

KNN train() in cv2 with opencv 3.0

元气小坏坏 提交于 2019-12-02 18:14:48
I'm trying to run k-nearest neighbours using cv2 (python 2.7) and opencv 3.0. I've replicated the same error message using code like http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_ml/py_knn/py_knn_understanding/py_knn_understanding.html : import cv2 import numpy as np import matplotlib.pyplot as plt # Feature set containing (x,y) values of 25 known/training data trainData = np.random.randint(0,100,(25,2)).astype(np.float32) # Labels each one either Red or Blue with numbers 0 and 1 responses = np.random.randint(0,2,(25,1)).astype(np.float32) # Take Red families and plot them red =

What are the main references to the fish-eye camera model in OpenCV3.0.0dev?

。_饼干妹妹 提交于 2019-12-02 17:39:38
I am wrestling with the Fish-Eye Camera Model used in OpenCV 3.0.0.dev . I have read the documentation in this link several times, especially the "Detailed Description" part and formulas modeling fish-eye distortion. By now I have two concerns: Based on the projection models listed here and their conceptual explanations in " Accuracy of Fish-Eye Lens Model " By Hughes, I can't figure out which projection model has been used in the OpenCV implementation. Since the description is so concise, I need to know the main reference papers used by OpenCV developers for implementing fish-eye namespace,

Sorting points from distance to a given point x,y here in my case (x=0,y=o)

心已入冬 提交于 2019-12-02 16:44:56
问题 I would like to sort (shortest to longest) an array 'a' (as given below) to the distance from the origin or a point (in my case 0,0) and store it to a similar array type 'b' or replacing the array 'a' the below given points are 3d numpy array [[[ 510. 11.]] [[ 651. 276.]] [[ 269. 70.]] [[ 920. 26.]] [[ 513. 21.]] [[ 1197. 620.]] [[ 407. 268.]] [[ 452. 35.]] [[ 435. 3.]] [[ 520. 20.]] [[ 1151. 499.]] [[ 104. 26.]] [[ 754. 28.]] [[ 263. 111.]] [[ 731. 12.]] [[ 972. 200.]] [[ 1186. 614.]] [[ 437

Draw Longest Line in Contours OPENCV

情到浓时终转凉″ 提交于 2019-12-02 16:37:57
问题 I am using OpenCV and Python. I am trying to draw the longest line inside a contours. I have a contour named cnt . The image is binary, the inside of the contours is white and the outside is black. I would like to draw the longest line inside the white contours. I found how to draw lines using cv2.lines but I didn't find how to draw the longest one. Do you have any ideas? img_copy = cv2.dilate(copy.deepcopy(img), np.ones((2,2),np.uint8),iterations = 2) contours, hierarchy = cv2.findContours

what is the difference between OpenCV 2.4.11 and 3.0.0

隐身守侯 提交于 2019-12-02 16:17:11
The latest release of OpenCV shows 2.4.11 Feb,2015 which is more recent then 3.0.0 which is in Beta. What is the difference between them. Should I use OpenCV 2.4.11 over 3.0.0 as I have encountered few bugs in 3.0.0. How do their releases work? 3.0.0 should bring a lot of new features but it's currently beta and not the official release (can be unstable). Last official stable release was 2.4.11. Use the 3.0.0 if there is features you don't retrieve in 2.4.11 or if you are adventurous (3.0.0beta is great and the final release should come soon). If you want security with no additional needs, use

Converting opencv remap code from c++ to python

风流意气都作罢 提交于 2019-12-02 15:11:49
问题 I am trying to convert c++ opencv cv2.remap code to python. I am not getting any error but result is not as expected.I am getting zoomed image c++ code int main() { Mat img = imread("captcha1.jpg"); float phase = -0.8 * CV_PI; float omega = 2.0 * CV_PI / img.cols; float amp = 15; Mat_<Vec2f> proj(img.size()); for (int y=0; y<img.rows; y++) { for (int x=0; x<img.cols; x++) { float u = 0; float v = sin(phase + float(x) * omega) * amp; proj(y,x) = Vec2f(float(x) + u, float(y) + v); } } Mat corr;

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

南笙酒味 提交于 2019-12-02 12:53:15
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 in stitch2.jpg and later stitching stitch1.jpg and stitch2.jpg together Now i want to get the same

Draw Longest Line in Contours OPENCV

孤街浪徒 提交于 2019-12-02 11:14:15
I am using OpenCV and Python. I am trying to draw the longest line inside a contours. I have a contour named cnt . The image is binary, the inside of the contours is white and the outside is black. I would like to draw the longest line inside the white contours. I found how to draw lines using cv2.lines but I didn't find how to draw the longest one. Do you have any ideas? img_copy = cv2.dilate(copy.deepcopy(img), np.ones((2,2),np.uint8),iterations = 2) contours, hierarchy = cv2.findContours(copy.deepcopy(img_copy),cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) areas = [cv2.contourArea(c) for c in

Sorting points from distance to a given point x,y here in my case (x=0,y=o)

老子叫甜甜 提交于 2019-12-02 10:48:38
I would like to sort (shortest to longest) an array 'a' (as given below) to the distance from the origin or a point (in my case 0,0) and store it to a similar array type 'b' or replacing the array 'a' the below given points are 3d numpy array [[[ 510. 11.]] [[ 651. 276.]] [[ 269. 70.]] [[ 920. 26.]] [[ 513. 21.]] [[ 1197. 620.]] [[ 407. 268.]] [[ 452. 35.]] [[ 435. 3.]] [[ 520. 20.]] [[ 1151. 499.]] [[ 104. 26.]] [[ 754. 28.]] [[ 263. 111.]] [[ 731. 12.]] [[ 972. 200.]] [[ 1186. 614.]] [[ 437. 2.]] [[ 1096. 68.]] [[ 997. 201.]] [[ 1087. 200.]] [[ 913. 201.]] [[ 1156. 510.]] [[ 994. 230.]] [[

opencv creat an input text box in a GUI and read it

非 Y 不嫁゛ 提交于 2019-12-02 09:23:28
问题 Just wondering if there is any command in OpenCV to create an input "Text box" or"Edit text box" for a GUI in C++? Like name box (to enter a name) PS: I'm using Linux (Ubuntu) 回答1: As Miki says, there is no such facility in OpenCV itself, but there is nothing to stop you using Zenity or any of the alternatives, which work like this at the command line: zenity --title "Gimme some text!" --entry --text "Enter your text here" If it does what you want, you can integrate it into your C++ program