opencv3.0

how to scale a contour's height by a factor?

可紊 提交于 2019-12-25 08:07:27
问题 I am trying to scan a passport page using the phone's camera using OpenCV. In the above image the contour marked in red is my ROI (will need a top view of that). Performing segmentation I can detect the MRZ area. And the pages should have a fixed aspect ratio. Is there a way to scale the green contour using the aspect ratio to approximate the red one? I have tried finding the corners of the green rect using approxPolyDP , and then scaling that rect and finally doing a perspective warp to get

Caffe with OpenCV 3 and NVIDIA Digits: OpenCV version conflict (2.4 vs 3.0)

拈花ヽ惹草 提交于 2019-12-25 07:39:27
问题 Background: I wish to use both Caffe and Digits such that I can use Caffe within the Digits framework or external to it. However, for a particular project, I require that Caffe uses OpenCV 3 and not OpenCV 2.4, which Digits installs by default. This project uses Caffe external to Digits, and does not make any use of the Digits framework. It appears that by installing Digits, my OpenCV 3 installation was "clobbered" with OpenCV 2.4, which is now causing problems within my original Caffe

Unable to find mixed_sample.so

霸气de小男生 提交于 2019-12-25 00:15:08
问题 I'm trying to build tutorial-2-mixedprocess application (in android-studio) that came with the opencv-SDK 3.2.0. But my application crashes because of a missing mixed_sample library // Load native library after(!) OpenCV initialization System.loadLibrary("opencv_java3"); //This one is taken care in CmakeLists.txt Log.d(TAG, "Loaded the opencv"); //This line appears on the monitor System.loadLibrary("mixed_sample"); // C-R-A-S-H h h h I looked inside OpenCV-android-sdk/sdk/native/libs

OpenCV: Failed to load OpenCL runtime

≡放荡痞女 提交于 2019-12-24 17:31:40
问题 I am running a program in which I got the error on the title of my question. I have found an answer here that suggests to download OpenCV from github, then compile with ENABLE_OPENCL=OFF (using CMake) and use the built libs against the application. Or may be is there a way to set this flag in the program itself without modifying anything in OpenCV ? I wonder if it is possible to do that without having to remove and install again OpenCV-3.0 ? 回答1: I resolved the problem by running: sudo apt

OpenCV: Failed to load OpenCL runtime

寵の児 提交于 2019-12-24 17:30:34
问题 I am running a program in which I got the error on the title of my question. I have found an answer here that suggests to download OpenCV from github, then compile with ENABLE_OPENCL=OFF (using CMake) and use the built libs against the application. Or may be is there a way to set this flag in the program itself without modifying anything in OpenCV ? I wonder if it is possible to do that without having to remove and install again OpenCV-3.0 ? 回答1: I resolved the problem by running: sudo apt

OpenCV doesn't come with “external” libraries

无人久伴 提交于 2019-12-24 16:02:13
问题 I tried this example from the OpenCV website: import numpy as np import cv2 from matplotlib import pyplot as plt # changed the image names from box* since the sample images were not given on the site img1 = cv2.imread('burger.jpg',0) # queryImage img2 = cv2.imread('burger.jpg',0) # trainImage # Initiate SIFT detector sift = cv2.SIFT() # find the keypoints and descriptors with SIFT kp1, des1 = sift.detectAndCompute(img1,None) kp2, des2 = sift.detectAndCompute(img2,None) # FLANN parameters

bitwise_or Opencv Exception

為{幸葍}努か 提交于 2019-12-24 12:05:30
问题 I am trying to applying skeletonization on my image but it throws exception on bitwise_or function of opencv cv::threshold(input, input, 127, 255, cv::THRESH_BINARY); cv::Mat skel(input.size(), CV_8UC1, cv::Scalar(0)); cv::Mat temp(input.size(), CV_8UC1); cv::Mat element = cv::getStructuringElement(cv::MORPH_CROSS, cv::Size(3, 3)); bool done; do { cv::morphologyEx(input, temp, cv::MORPH_OPEN, element); cv::bitwise_not(temp, temp); cv::bitwise_and(input, temp, temp); cv::bitwise_or(skel, temp,

OpenCV get pixels on an circle

此生再无相见时 提交于 2019-12-24 10:17:13
问题 I'm new to OpenCV and I'm trying to get the pixels of a circle from an image. For example, I draw a circle on a random image: import cv2 raw_img = cv2.imread('sample_picture.png') x = 50 y = 50 rad = 20 cv2.circle(raw_img,(x,y),rad,(0,255,0),-1) cv2.imshow('output', raw_img) cv2.waitKey(0) cv2.destroyAllWindows() The output shows an image with a circle. However, I want to be able to get all the pixel on the circle back in the form of an array. Is there any way to do this? I know I can get the

Python OpenCV Error(-215) in VideoWriter.write

穿精又带淫゛_ 提交于 2019-12-24 09:59:08
问题 I am trying to a write a python3-opencv3 code to read the color video and convert it to grayscale and save it back. (Trying exercises to learn python & opencv) As I am working in ubuntu, I found out cv2.VideoCapture isColor flag will not work (it works only windows) import numpy as np import cv2 cap = cv2.VideoCapture('output.avi') ret, frame = cap.read() print('ret =', ret, 'W =', frame.shape[1], 'H =', frame.shape[0], 'channel =', frame.shape[2]) gray = cv2.cvtColor(frame, cv2.COLOR

Convert KNN train from Opencv 3 to 2

孤街浪徒 提交于 2019-12-24 05:59:42
问题 I am reading a tutorial for training KNN using Opencv. The code is written for Opencv 3 but I need to use it in Opencv 2. The original training is: cv2.ml.KNearest_create().train(npaFlattenedImages, cv2.ml.ROW_SAMPLE, npaClassifications) I tried using this: cv2.KNearest().train(npaFlattenedImages, cv2.CV_ROW_SAMPLE, npaClassifications) but the error is: Unsupported index array data type (it should be 8uC1, 8sC1 or 32sC1) in function cvPreprocessIndexArray The full code is here: https://github