OpenCV read files in Swift IOS project

I am trying to read "classifications.xml" and "images.xml" from a tutorial which was working fine in a VisualStudio project. How do I point the C++ library in my Swift XCode project to the files now? Drag and dropping them into the project did not wo...
more »

2017-04-19 21:04 (1) Answers

python: cv2.threshold changes numpy to tuple

I process every frame in first function where i am usingcv2.threshold(self.res, 10, 255, cv2.THRESH_BINARY_INV) for preprocessing before detecting motion. In next function I am just counting number of black pixels and calculating average. I am giving...
more »

2017-04-18 23:04 (0) Answers

OpenCV python on MAC

import cv2 img = cv2.imread('mikrotik.jpg',0) cv2.imshow('image',img) cv2.waitKey(0)cv2.destroyAllWindows() I ran this code on my Pycharm on mac machine then get this error instead >/Users/briant/venv/bin/python /Users/briant/PycharmProjects/...
more »

2017-04-17 11:04 (0) Answers

How to store webcam video with OpenCV in Python

I've got a script in Python which reads out my webcam and shows it in a window. I now want to store the results, so following this tutorial I wrote the following code: import cv2 import imutils camera = cv2.VideoCapture(0) # Define the codec and cr...
more »

2017-04-17 11:04 (1) Answers

Smooth tracking in Python and Opencv

Hi Everyone i am newbie in Python and opencv, Can you guide me the best way to track human iris. I have created the ROI for iris but due to live stream when i pass the x and y co-ordinates of iris to it start to move randomly. This happens when next...
more »

2017-04-17 08:04 (0) Answers

Sample frames of video

I'm looking for a way in OS X/Python3.5 to take an .avi video file, subsample every 100th frame, and combine those frames into its own video. In my particular case the video is 30 seconds at 20fps, so the new video would only be 6 frames long (I wa...
more »

2017-04-08 06:04 (2) Answers

How to get chamerMatching to work on OSX?

I'm trying to use OpenCV's chamferMatching functionality to work on OSX, but getting an error about a failed attempt at freeing objects that weren't allocated (as far as I can tell): fs(58697,0x100b3c000) malloc: *** error for object 0x103800000: po...
more »

2017-04-08 02:04 (1) Answers

OpenCV maximum and minimum RGB value using mask

I need to get the minimum RGB value of a circle. How can I do like the average RGB value method (cv2.mean) appliying a mask? To get the average RGB value of a circle I'm doing: circle_img = np.zeros((circle_img.shape[0],circle_img.shape[1]), np.uint...
more »

2017-04-02 18:04 (1) Answers

Drawing in a video

I am doing an exercise in which the program has to follow that routine: when the user clicks on any point of a video, it gets that pixel and turns all pixels in a range of 5% into red. Since it is a video, I am saving the points (x,y) the user clicks...
more »

2017-04-02 17:04 (1) Answers

How to Align two images in OpenCV

I am new to OpenCV and I need some help .. Objective : I am trying to highlight the difference between two images Problem : If the images differ in the position , the program highlights the whole image How can I Align the images so that each fe...
more »

2017-03-31 21:03 (0) Answers

Generating nested Numpy Arrays

I'm trying to write a function that will take as input a numpy array in the form: a = [[0,0], [10,0], [10,10], [5,4]] and return a numpy array b such that: b = [[[0,0]], [[10,0]], [[10,10]], [[5,4]]] For some reason I'm finding this surprisingl...
more »

2017-03-30 19:03 (1) Answers

Open CV libgtk2.0-dev and pkg-config error mac

Hi I am fairly new to OpenCV and I am trying to get OpenCV demo-code for blur detection working on my mac but I get an error every time I run the code. Here is the code I try to run: # import the necessary packages from imutils import paths imp...
more »

2017-03-23 00:03 (0) Answers

Face Features Detection Using OpenCV Haar-cascades

I am using Java with OpenCV Library to detect Face,Eyes and Mouth using Laptop Camera. What I have done so far: Capture Video Frames using VideoCapture object. Detect Face using Haar-Cascades. Divide the Face region into Top Region and Bottom Regi...
more »

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

How to pass an image to a function?

Here is the code I used: import threading import cv2 def showimg(*a): cv2.imshow('img', a) cv2.waitKey(5) cv2.destroyAllWindows() def main(): img = cv2.imread('tree.jpg') t = threading.Thread(target = showimg, args = (img) ) ...
more »

2017-03-14 05:03 (1) Answers

Convert RGB image to index image

I want to convert a 3 channel RGB image to a index image with Python. It's used for handling the labels of training a deep net for semantic segmentation. By index image I mean it has one channel and each pixel is the index, which should starts with z...
more »

2017-03-12 18:03 (1) Answers

Inconsistent PIL.ImageTk.PhotoImage() performance

I am converting numpy arrays (webcamera footage loaded with OpenCV) into Tkinter PhotoImage objects to display them on Tkinter GUI. However, the function PIL.ImageTk.PhotoImage() experiences around 800 ms peaks that result in serious drops in frame r...
more »

2017-03-11 17:03 (0) Answers

lvalue And rvalue Return Types For Efficiency

Update: So, as per the comment by Jean, I have looked at this link. This is actually pretty close to the question I am asking. The only difference is that it deals with Classes explicitly (which cv::UMat undoubtedly is); However, would the func...
more »

2017-03-08 20:03 (3) Answers

OpenCV Mat image data structure

I have an image that has been processed throw: //UIImage to Mat cv::Mat originalMat = [self cvMatFromUIImage:inputImage]; //Grayscale cv::Mat grayMat; cv::cvtColor(originalMat, grayMat, CV_RGB2GRAY); //Blur cv::Mat gaussMat; cv::GaussianBlur( gray...
more »

2017-03-04 02:03 (2) Answers