Questions tagged [opencv]

14736 questions
1

votes
1

answer
120

Views

Why is there an opencv2 folder inside OpenCV 3.x?

Is this just for backwards compatibility, for people who have been developing for years with OpenCV 2 and then want to use OpenCV 3 without having to rewrite all their legacy code? Or is this related to a fundamental design decision the creators of OpenCV 3 opted for? For instance, when I look up...
mannyglover
-1

votes
0

answer
14

Views

How to detect gates objects from by Edge Detection in Python Open CV

I want to detect this gate from the video in real time. I can detect the edge. There are gates of other colours too. Can anyone suggest me how to detect the gate from here?
Adnan Sabbir
5

votes
1

answer
117

Views

Unable to use sort_contors for building seven segment OCR

I am trying to build an OCR for recognising seven segment display as mentioned below Using preprocessing tools of open CV I got it here Now I am trying to follow this tutorial - https://www.pyimagesearch.com/2017/02/13/recognizing-digits-with-opencv-and-python/ But on the part digitCnts = contour...
Mansi Shukla
0

votes
0

answer
13

Views

How to efficiently store video frames in memory

I am trying to load all the frames of a video for analysis, things such as average pixel value across all frames for background extraction, but the memory requirement is killing me. When I load the frames in memory in uint8, they take up ~2.8gb of memory. I have looked into libraries such as pims, b...
Petio Petrov
0

votes
0

answer
4

Views

required argument 'ranges' (pos 2) not found in cv2.warpAffine

I'm trying to use the transformation function cv2.warpAffine and pretty much copying how it was done in the documentation (https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_geometric_transformations/py_geometric_transformations.html?highlight=warpaffine) Documentatio...
rcarter36
2

votes
1

answer
30

Views

Display only 45 degrees line in an image

I want to detect lines in an image which is at 45 degrees only with respect to the origin. I have to do it with 3x3 convolution only. I have solved it such that all lines at 45 degrees are removed and everything else stays(inverse of what I want). Any help in reaching from here to my final goal will...
Asim
0

votes
0

answer
3

Views

Load datasets and store it in another file using opencv

How can I read all images from datasets and store it in another location using opencv.
Aviii04
-2

votes
0

answer
20

Views

Crop image from center in openCV using python

I am using openCV in python to auto detect objects in image and then crop it.But this cropping i need from center instead of starting top left corner in openCV. the following line of code cropping from top left corner. image = image[minY:maxY,minX:maxX]
Code cracker
0

votes
0

answer
9

Views

How can i load the cascadeClassifier in Android OpenCv

I am trying to port an existing opencv project to Android. But in current implementation in c++ i load the cascadeClassifier once when the program starts. But in android if i call my native functions from onCameraFrame() then i have to load the cascadeClassifier files every time i pass a frame to na...
Pratik
0

votes
0

answer
7

Views

Python 3 openCV png overlay on a live preview of the camera

Im a very big noob to this type of program and i cant really find any type of help on this so i was asking if anyone had any tips for this sort of thing
Entity
1

votes
2

answer
50

Views

c++ Math Issue, Double not returning value if math is all on the same line

First off thanks for all the great questions and answers on this site! This website has a been a great resource for solving so many of my problems that others have had in the past which have already been answered. However, I've currently got a problem I can't seem to find a solution for.. I'm worki...
sly.20
1

votes
1

answer
10.1k

Views

Basic Python OpenCV cropping and resizing

can someone help me with a little cropping algorithm? its openCV.. im trying to figure this out. I know the method is crop = image[y:y1, x:x1]. If I have an image with new_dimensionXxnew_dimensionY pixels and I want to crop it to the same width but the height just above 121px above pointOfInterestX....
David Kachlon
1

votes
1

answer
1.2k

Views

Python 2.7: Area opening and closing binary image in Python not so accurate

I am using Python 2.7 and I used following Python and Matlab function for removing noises and fill holes in this image . 1. Code to remove noise and fill holes using Python and Opencv img = cv2.imread("binar.png",0) kernel = np.ones((5,5),np.uint8) open = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel...
Naseeb Gill
1

votes
1

answer
1.7k

Views

How to use the PCACompute function from Python in OpenCV 3?

The cv2.PCACompute function worked well in OpenCV 2.4 using the following syntax : import cv2 mean, eigvec = cv2.PCACompute(data) The function exists in OpenCV 3.1, but raises the following exception : TypeError: Required argument 'mean' (pos 2) not found The C++ documentation is not very helpful at...
F.X.
1

votes
1

answer
306

Views

Unable to run Tracking on Open CV 3.4.1 on Python 3.6.6

I tried running tracking using open CV on python 3.6.6, but it shows: AttributeError: module 'cv2' has no attribute 'TrackerKCF_create' I also tried the python 2.7 API, but the same result: AttributeError: module 'cv2' has no attribute 'Tracker_create' The Open CV version is 3.4.1. Any idea how to...
Aditya Singh
1

votes
2

answer
84

Views

Trim (noised) whitespaces in images using Python

Say that I have an image as shown below: As you can see, the image contains blank/white space (noised with small green dots) in addition to a big green square (the square is randomly put in the left-bottom corner). What I want to do is to crop the image/trim the white space to only get the big gree...
singrium
1

votes
2

answer
28

Views

Find Alphabet and Color it to Red with OpenCV Python

I have a large image with some alphabets in it and cut out of one alphabet ("A"). I need to find each A in the larger image and color it to red. Large Image: Alphabet A: To solve the problem, I have used the following codes- import cv2, numpy as np # read the image and convert into binary a = cv2.i...
Sourav
0

votes
1

answer
26

Views

Stitch two images using Homography transform - Transformed image cropped

Image stitching not work properly. The warped image is cropped and interpolation cannot be done because images do not intersect. Hi, I was assigned an homework in which I have to stitch togheter two images, shot by different cameras. I should find the homography matrix and then warp the second image...
Giuseppe
4

votes
2

answer
1.4k

Views

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 (the one in the middle and when I press any key then t...
thanasissdr
0

votes
1

answer
11

Views

How to Upgrade OpenCV to Specific Version Using Pip?

I want to install OpenCV 3.4.0 on Ubuntu 16.04. I tried to build from source following tutorial on internet but run to this problem: ImportError: /home/ivan/.virtualenvs/cv/lib/python3.5/site-packages/cv2.so: undefined symbol: _ZTIN2cv3dnn19experimental_dnn_v35LayerE So I decided to just upgrade Ope...
gameon67
0

votes
1

answer
14

Views

Endlessly turning webcam On and Off?

I have wrote a code that will capture pictures eventually and will terminate when after it reaches a certain time. But once the script is over(i.e after terminating the code using time) how will i re-run automatically after a few seconds.? import cv2 import time import numpy capture = cv2.VideoCaptu...
Sai Krishnadas
0

votes
0

answer
5

Views

Pyrup Alternative for Upsampling

I am trying to perform PyrUp on an image but without using OpenCV. How can I build a function of my own in Numpy?
Anubhav Dutt
1

votes
0

answer
18

Views

How to detect black colour in a video cam using opencv?

I need to detect black objects in a real time video. I got a code in the internet for detecting blue objects. So I changed the upper and lower hsv value according to bgr colour code(am not clear about how to convert bgr to hsv), But its not detecting the black object in the video.the code am using b...
praveen kumar
1

votes
1

answer
4.9k

Views

Channel order in OpenCV

I have been reading in a few forums that OpenCV has the BGR channel order by default. It is also possible that a cv::Mat may have RGB channel order. A gray conversion would specify CV_BGR2GRAY or CV_RGB2GRAY as a parameter. 1) Are there any other options, than RGB and BGR ? 2) Is there any way to fi...
Thalia
1

votes
1

answer
4.2k

Views

OpenCV IP Camera RTSP stream

I'm trying to access a RTSP video stream from an IP camera using OpenCV and Java. I can access the stream using VLC player with the following format: rtsp://192.168.1.10:554/rtsp_live0 but when I try to use OpenCV the video stream seems to always be closed. The code I'm using... (simplified) VideoCa...
CS Student
1

votes
1

answer
372

Views

I want my already created virtualenv to have access to system packages

I've recently installed opencv3 on ubuntu 14.04. The tutorial I followed was for some reason using a virtualenv. Now I want to move opencv from the virtual to my global environment. The reason for this is that I can't seem to use the packages that are installed on my global environment which is gett...
Mustafa
1

votes
2

answer
2k

Views

Undefined symbols for architecture arm64: “cv::String::deallocate()”

When I add a ".a" file which includes opencv.framework,Xcode encountered such compile errors: I am pretty sure opencv.framework is there,and I am using opencv 3.1,it should already support arm64. But why does it keep complaining about this? How can I fix it? Thanks a lot. lipo - info shows following...
Li Fumin
1

votes
1

answer
535

Views

How to import openCV 3.1 in android studio 1.5.1 [closed]

I'm following these steps, but when I build it has an error:
Lovely ToonZ
10

votes
0

answer
309

Views

How to properly Multithread in OpenCV in 2019?

Background: I read some articles and posts regarding Multithreading in OpenCV: On the one hand you can build OpenCV with TBB or OpenMP support which parallelize OpenCV's functions internally. On the other hand you can create multiple threads yourself and call the functions parallel to realize multit...
Crigges
1

votes
1

answer
998

Views

opencv video stabilization algorithm

I am writing video stabilizer using opencv. The algorithm is as follows: while there are more frames in the video: take new frame from the video detect keypoints in the new frame compute descriptor for new keypoints match descriptors of the new and the previous frame filter matches to get good m...
Dainius Kavoliūnas
1

votes
2

answer
4.6k

Views

Why is Gaussian Filter different between cv2 and skimage?

I've got an image that I apply a Gaussian Blur to using both cv2.GaussianBlur and skimage.gaussian_filter libraries, but I get significantly different results. I'm curious as to why, and what can be done to make skimage look more like cv2. I know skimage.gaussian_filter is a wrapper around scipy.s...
waldol1
0

votes
0

answer
2

Views

Adjusting/Matching two Parts of one Picture, which are labeled

I want to create Images, where you can't see based on gray-color values which part belong to which. For example i have a picture of two ropes in a green background. One is blue, the other is red. I used KMeans and saved the labels as an .png file. I convert my image to an gray image. Now i want to m...
Martin O
1

votes
3

answer
5.7k

Views

Use waitKey in order pause and play video

I have a VideoCapture in OpenCV, I can successfully display a given video. What I want to do now is to pause and play by pressing a key (optional which one as long as it works). I have been reading about waitKey but there is something about this whole thing I don't get (ASCII) and how to bind keys....
J.Smith
1

votes
2

answer
3k

Views

OpenCv pytesseract for OCR

How to use opencv and pytesseract to extract text from image? import cv2 import pytesseract from PIL import Image import numpy as np from matplotlib import pyplot as plt img = Image.open('test.jpg').convert('L') img.show() img.save('test','png') img = cv2.imread('test.png',0) edges = cv2.Canny(img,1...
sumitroy
1

votes
2

answer
804

Views

How to use caffemodel with OpenCV on iOS?

I am trying to use a .caffemodel alongside OpenCV on iOS devices. I found this github repository, but it can only be built with Xcode 6. I am working with Xcode 7, but I also downloaded Xcode 6 and still have no success on building it. How can I use a caffemodel with OpenCV on iOS 9? PS: The alter...
cch
1

votes
2

answer
1k

Views

How to remove the local average color from an image with OpenCV

I have an image with a gentle gradient background and sharp foreground features that I want to detect. I wish to find green arcs in the image. However, the green arcs are only green relative to the background (they are semitransparent). The green arcs are also only one or two pixels wide. As a resul...
jnnnnn
0

votes
0

answer
3

Views

Curious about how opencv_cudaoptflow.lib, where to find it or make?

I am about to try YOLO as dll in Win10, x64, opencv 3.4.0, CUDA 10, MSVS 2015 as suggested here. All the steps are done but when I build I have an error The curious part for me is I couldn't find that opencv_cudaoptflow340.lib anywhere, not in the CUDA folders, not in the opencv340 (where my openc...
voo_doo
1

votes
2

answer
2.3k

Views

Find [x,y] rotated coordinates locations in image [OpenCV / Python]

I want to rotate an image at several angles sequentially. I do that using cv2.getRotationMatrix2D and cv2.warpAffine. Having a pair of pixels coordinates [x,y], where x=cols, y=rows (in this case) I want to find their new coordinates in the rotated images. I used the following slightly changed code...
Roxanne
1

votes
1

answer
1.2k

Views

“JavaCameraView” Camera Orientation Issue

I am new to Android development. I'm making a simple app, which has one Activity. In this Activity I'm trying to get frames from camera and process it real time, but I'm having camera orientation Issue, i.e. image received is 90 degree rotated. There are many solutions available to solve this proble...
I m MNA
1

votes
1

answer
3.2k

Views

How to load and convert .mat file into numpy 2D array?

I have a data in mat file (observations and features) and i want to load it into numpy 2D array. I dont want to convert it into csv first and then load csv into numpy.

View additional questions