All Questions
19,453
questions
1910
votes
23
answers
241k
views
Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition
One of the most interesting projects I've worked on in the past couple of years was a project about image processing. The goal was to develop a system to be able to recognize Coca-Cola 'cans' (note ...
395
votes
10
answers
26k
views
How to detect a Christmas Tree?
Which image processing techniques could be used to implement an application that detects the Christmas trees displayed in the following images?
I'm searching for solutions that are going to work ...
193
votes
6
answers
133k
views
OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection
I successfully implemented the OpenCV square-detection example in my test application, but now need to filter the output, because it's quite messy - or is my code wrong?
I'm interested in the four ...
169
votes
10
answers
132k
views
Extracting text OpenCV
I am trying to find the bounding boxes of text in an image and am currently using this approach:
// calculate the local variances of the grayscale image
Mat t_mean, t_mean_2;
Mat grayF;
outImg_gray....
110
votes
4
answers
137k
views
OpenCV Point(x,y) represent (column,row) or (row,column)
I have a 300x200 image in a Matrix src. I am applying the following operation on the image.
for(int i=0;i<src.rows;i++){
for(int j=0;j<src.cols;j++){
line( src, Point(i,j),Point(i,j), ...
103
votes
9
answers
202k
views
What does OpenCV's cvWaitKey( ) function do?
What happens during the execution of cvWaitKey()? What are some typical use cases? I saw it in OpenCV reference but the documentation isn't clear on its exact purpose.
96
votes
5
answers
92k
views
Does performance differ between Python or C++ coding of OpenCV?
I aim to start opencv little by little but first I need to decide which API of OpenCV is more useful. I predict that Python implementation is shorter but running time will be more dense and slow ...
84
votes
2
answers
206k
views
How to get image width and height in OpenCV? [duplicate]
I want to get image width and height, how can I do that in OpenCV?
For example:
Mat src = imread("path_to_image");
cout << src.width;
Is that right?
83
votes
6
answers
159k
views
Accessing certain pixel RGB value in openCV
I have searched internet and stackoverflow thoroughly, but I haven't found answer to my question:
How can I get/set (both) RGB value of certain (given by x,y coordinates) pixel in OpenCV? What's ...
73
votes
2
answers
122k
views
What are the differences between CV_8U and CV_32F and what should I worry about when converting between them?
I have some code that is acting up and I suspect it's because I'm operating on the wrong types of data or converting between them poorly.
It is mixing cv::Mat objects of types CV_8U (which is what ...
73
votes
3
answers
101k
views
What does CV_8UC3 and the other types stand for in OpenCV?
I was surprised when I couldn't find anything in OpenCV documentation describing - with words - what the various types stand for, and Googling wasn't much help either. I know that CV_8UC1 is gray-...
72
votes
2
answers
103k
views
Recommended values for OpenCV detectMultiScale() parameters
What are the recommended parameters for CascadeClassifier::detectMultiScale() and depending on which factors I should change default parameters?
void CascadeClassifier::detectMultiScale(
const ...
70
votes
7
answers
136k
views
Easiest way to rotate by 90 degrees an image using OpenCV?
What is the best way (in c/c++) to rotate an IplImage/cv::Mat by 90 degrees? I would assume that there must be something better than transforming it using a matrix, but I can't seem to find anything ...
70
votes
5
answers
134k
views
Print out the values of a (Mat) matrix in OpenCV C++
I want to dump the values of a matrix in OpenCV to the console using cout. I quickly learned that I do not understand OpenvCV's type system nor C++ templates well enough to accomplish this simple task....
69
votes
5
answers
114k
views
linux/videodev.h : no such file or directory - OpenCV on ubuntu 11.04
I tried to install OpenCV2.2 on Ubuntu 11.04. But OpenCV compilation fails stating an error related to linux/videodev.h file.
File available in /user/includes/linux is named videodev2.h.
/home/user/...
67
votes
13
answers
94k
views
Rotate an image without cropping in OpenCV in C++
I'd like to rotate an image, but I can't obtain the rotated image without cropping
My original image:
Now I use this code:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui....
67
votes
5
answers
177k
views
Convert RGB to Black & White in OpenCV
I would like to know how to convert an RGB image into a black & white (binary) image.
After conversion, how can I save the modified image to disk?
66
votes
10
answers
170k
views
Convert Mat to Array/Vector in OpenCV
I am novice in OpenCV. Recently, I have troubles finding OpenCV functions to convert from Mat to Array. I researched with .ptr and .at methods available in OpenCV APIs, but I could not get proper data....
65
votes
5
answers
356k
views
Find OpenCV Version Installed on Ubuntu [duplicate]
I would like to find out what version of OpenCV is installed on my computer (i am running Ubuntu 10.04). Is there a simple way to check it if ? If not then can i find out the directories where files (...
65
votes
2
answers
60k
views
Camera position in world coordinate from cv::solvePnP
I have a calibrated camera (intrinsic matrix and distortion coefficients) and I want to know the camera position knowing some 3d points and their corresponding points in the image (2d points).
I know ...
65
votes
1
answer
4k
views
OpenCV undistortPoints and triangulatePoint give odd results (stereo)
I'm trying to get 3D coordinates of several points in space, but I'm getting odd results from both undistortPoints() and triangulatePoints().
Since both cameras have different resolution, I've ...
64
votes
1
answer
62k
views
using OpenCV and SVM with images
I am having difficulty with reading an image, extracting features for training, and testing on new images in OpenCV using SVMs. can someone please point me to a great link? I have looked at the OpenCV ...
64
votes
1
answer
21k
views
Classification of detectors, extractors and matchers
I am new to opencv and trying to implement image matching between two images. For this purpose, I'm trying to understand the difference between feature descriptors, descriptor extractors and ...
62
votes
3
answers
102k
views
Copy an cv::Mat inside a ROI of another one
I need to copy a cv::Mat image (source) to an ROI of another (Destination) cv::Mat image.
I found this reference, but it seems that it does not work for my case.
Do you have any pointers how could I ...
61
votes
6
answers
87k
views
Simple illumination correction in images OpenCV C++
I have some color photos and the illumination is not regular in the photos: one side of the image is brighter than the other side.
I would like to solve this problem by correcting the illumination.
I ...
61
votes
2
answers
32k
views
Removing watermark out of an image using OpenCV
First of all I have this image and I want to make an application that can detect images like it and remove the circle (watermark) from it.
int main(){
Mat im1,im2,im3,gray,gray2,result;
im2=...
60
votes
1
answer
118k
views
Installing OpenCV 2.4.3 in Visual C++ 2010 Express [closed]
How do you install and use OpenCV 2.4.3 under VC++ 2010 Express?
60
votes
8
answers
37k
views
How can I determine distance from an object in a video?
I have a video file recorded from the front of a moving vehicle. I am going to use OpenCV for object detection and recognition but I'm stuck on one aspect. How can I determine the distance from a ...
59
votes
5
answers
156k
views
openCV program compile error "libopencv_core.so.2.4: cannot open shared object file: No such file or directory" in ubuntu 12.04
I compiled and installed openCV 2.4.2 in ubuntu 12.04. Under /usr/local/include I can see the directories /usr/local/opencv and /usr/local/opencv2.
Here is the code I wrote:
#include <cv.h>
#...
59
votes
6
answers
49k
views
Executing cv::warpPerspective for a fake deskewing on a set of cv::Point
I'm trying to do a perspective transformation of a set of points in order to achieve a deskewing effect:
http://nuigroup.com/?ACT=28&fid=27&aid=1892_H6eNAaign4Mrnn30Au8d
I'm using the image ...
59
votes
5
answers
172k
views
g++ ld: symbol(s) not found for architecture x86_64
I'm trying to compile the Sam Hare's Struck code.
I'm using mac OSX10.9, opencv 2.4.6 and Eigen 2.0.17.
Eigen and opencv headers are stored in /opt/local/include while opencv dylib in /opt/local/lib....
58
votes
5
answers
80k
views
opencv multi channel element access
I'm trying to learn how to use OpenCV's new C++ interface.
How do I access elements of a multi channel matrix? For example:
Mat myMat(size(3, 3), CV_32FC2);
for (int i = 0; i < 3; ++i)
{
for (...
55
votes
8
answers
135k
views
Converting cv::Mat to IplImage*
The documentation on this seems incredibly spotty.
I've basically got an empty array of IplImage*s (IplImage** imageArray) and I'm calling a function to import an array of cv::Mats - I want to ...
54
votes
4
answers
188k
views
c++ and opencv get and set pixel color to Mat
I'm trying to set a new color value to some pixel into a cv::Mat image my code is below:
Mat image = img;
for(int y=0;y<img.rows;y++)
{
for(int x=0;x<img.cols;x++)
{
...
54
votes
6
answers
59k
views
Writing robust (color and size invariant) circle detection with OpenCV (based on Hough transform or other features)
I wrote the following very simple python code to find circles in an image:
import cv
import numpy as np
WAITKEY_DELAY_MS = 10
STOP_KEY = 'q'
cv.NamedWindow("image - press 'q' to quit", cv....
52
votes
11
answers
70k
views
How to convert an OpenCV cv::Mat to QImage
I am wondering how would I convert the OpenCV C++ standard cv::Mat type to QImage. I have been searching around, but have no luck. I have found some code that converts the IPlimage to QImage, but that ...
50
votes
2
answers
106k
views
How to link opencv in QtCreator and use Qt library
This question must be duplicate many times, but it just doesn't work and sometimes it still remains unanswered. Sources of information are mainly these
http://www.laganiere.name/opencvCookbook/...
49
votes
2
answers
163k
views
How can I convert a cv::Mat to a gray scale in OpenCv?
How can I convert a cv::Mat to a gray scale?
I am trying to run drawKeyPoints func from opencv, however I have been getting an Assertion Filed error. My guess is that it needs to receive a gray scale ...
49
votes
2
answers
197k
views
How to solve munmap_chunk(): invalid pointer error in C++
I have an application in C++ and OpenCV which tries to use the classification model realized with SVMLight in order to add the weight values which can be use for HOG Calssificator under OpenCV.
The ...
48
votes
1
answer
66k
views
Installing C++ Libraries on OS X
I am trying to get my head around some basic concepts, but I can't seem to figure them out.
I am really confused over what it means to install (I think they are called libraries) for C++. I am ...
46
votes
5
answers
60k
views
How to correctly use cv::triangulatePoints()
I am trying to triangulate some points with OpenCV and I found this cv::triangulatePoints() function. The problem is that there is almost no documentation or examples of it.
I have some doubts about ...
46
votes
4
answers
6k
views
Extracting segments from a list of 8-connected pixels
Current situation: I'm trying to extract segments from an image. Thanks to openCV's findContours() method, I now have a list of 8-connected point for every contours. However, these lists are not ...
45
votes
9
answers
121k
views
How to calculate the angle from rotation matrix
I am using two image of the single object the object is roated certain degree from its first image.
I have calculated the POSE of each image and converted the rotational vector to Matrix using ...
45
votes
11
answers
68k
views
Shift image content with OpenCV
Starting from an image, I would like to shift its content upward of 10 pixels, without changing size and filling in black the sub image (width x 10px) on the bottom.
For instance, the original:
And ...
45
votes
2
answers
100k
views
Compiling a static executable with CMake
for a project I need to create an executable that includes all the libraries that I used (opencv, cgal) in order to execute it on a computer that has not those libraries. Currently, this is my ...
45
votes
1
answer
110k
views
cmake find_package specify path
I have 2 versions of OpenCV installed on my machine. One is in /usr/local/opencv3.1. I presume the install location of the other one (version 3.4) is /usr/local. Anyway, find_package(OpenCV 3.0 ...
44
votes
3
answers
210k
views
OpenCV get pixel channel value from Mat image
Maybe I'm not looking hard enough, but everything seems to want me to use an array. Thus, how do I get the channel value for a particular pixel for foo if foo is something like Mat foo = imread("bar....
43
votes
6
answers
75k
views
connected components in OpenCV
I am looking for an OpenCV function that can find connected components and perform a few tasks on them ( like getting the number of pixels, contour, list of pixels in the object etc.. )
Is there a ...
42
votes
10
answers
52k
views
how to check whether two matrices are identical in OpenCV
I have two instances of cv::Mat : m1 and m2. They are of the same numeric type and sizes.
Is there any function in OpenCV that returns whether the matrices are identical (have all the same values)?
42
votes
2
answers
144k
views
Resize image OpenCV
If I have an image called inImg and an image named outImg how can I resize outImg so that it is 75% the size of inImg?