python , opencv, image array to binary

I have a large image , using cv2 module in python and some coordinates i cropped the image: img = cv.imread(image_path) crop_img = img[y1:y2,x1:x2] cv.imwrite(cropPath, crop_img) now the crop_img is a numpy.ndarray type. then I save this ima...
more »

2017-10-04 13:10 (2) Answers

cv2.imshow() crashes on Mac

When I am running this piece of code on ipython (MacOS /python 2.7.13) cv2.startWindowThread() cv2.imshow('img', img) cv2.waitKey() cv2.destroyAllWindows() the kernel crashes. When the image appears, the only button that I can press is minimise (...
more »

2017-09-21 18:09 (2) Answers

Installing OpenCV 3 in Homebrew using libstdc++

I am installing Caffe on Mac OS X 10.11 El Capitan, which somehow requires that I install OpenCV with libstdc++. To do so, I did "brew update opencv" and adding the following lines below "def install" as mentioned on the Caffe website (http://caffe.b...
more »

2017-09-09 20:09 (1) Answers

Installing OpenCV 3 on mac won't install jar

I am trying to install OpenCV3 on mac using: brew tap homebrew/science brew install opencv3 --HEAD --with-java I would expect a jar lib in: /usr/local/Cellar/opencv/3.3.0_3/share/OpenCV But there in no jar in the whole project. (I also added -...
more »

2017-08-28 13:08 (0) Answers

Can't compile OpenCV in Xcode

I'm trying to use OpenCV and I just want to use UIImageToMat. ENV Xcode 8.3.3 Swift 3.0 OpenCV 3.2.0 ERROR Apple Mach-O Linker Error Group "UIImageToMat(UIImage const*, cv::Mat&, bool)", referenced from: clang: error: linker command faile...
more »

2017-08-17 03:08 (1) Answers

Opencv3.0.0 VideoCapture not working on Mac

cv2.Videocapture() works fine while using the camera,but while reading the local video, there is a WARNING: Couldn't read movie file Here is my test code: # -*- coding: utf-8 -*- import numpy as np import cv2 cap = cv2.VideoCapture('test2.avi') ...
more »

2017-08-16 05:08 (0) Answers

Installing OpenCV

I am on Mac OSX El Capitan and am trying to install opencv. I am using homebrew with this command. Sumant:Sumant$ brew install opencv The result is Warning: homebrew/science/opencv is already installed Even though it says that opencv ...
more »

2017-08-15 12:08 (1) Answers

No module named cv

I'm trying to run this script: I've never dealt with python before. First of all I had some syntax errors in the print lines. They were lacking parentheses...but I'm not sure if ...
more »

2017-08-14 15:08 (2) Answers

Using Numpy arrays for looping

How would one go about converting p = img.ptr<uchar>(row); which is written using OpenCV in C++, into OpenCV's Python bindings? From what I understand, since images are represented as NumPy arrays in OpenCV Python - does this mean that it coul...
more »

2017-08-12 12:08 (0) Answers

Using sklearn.metrics Jaccard Index with images?

I am trying to do some image comparisons, starting first by finding the Jaccard Index. I'm using the sklearn.metrics implementation of Jaccard Index Using the example below with just a small array of numbers, it works like expected. import numpy as ...
more »

2017-07-12 20:07 (2) Answers

How to centralize and resize digits using opencv?

I want to OCR some scanned forms (filled by hand). It is the first time I do something serious using computer vision. So far I'm able to locate the squares containing digits for a date field: Looking at the example handwritten digit dataset that c...
more »

2017-07-04 23:07 (2) Answers

gitignore not ignoring opencv2.framework

I am trying to make git ignore the opencv2.framework I have imported into my project. However, even though I am adding opencv2.framework into my .gitignore, every time I run git status on my terminal, all the opencv2.framework files are showing up as...
more »

2017-06-30 02:06 (1) Answers

imwrite 16 bit png depth image

I have the following code. I am trying to save a 16 bit depth image which I retrieve from Kinect v1 as a png file. I wrote the following code sample: def display_depth(dev, data, timestamp): global keep_runningp #cv2.imshow('Depth', fram...
more »

2017-06-17 17:06 (1) Answers