Can’t access webcam with OpenCV
I had the same issue on Windows 7 64-bit. I had to recompile opencv_highgui changing the “Preprocesser Definitions” in the C/C++ panel of the properties page to include: HAVE_VIDEOINPUT HAVE_DSHOW Hope this helps
I had the same issue on Windows 7 64-bit. I had to recompile opencv_highgui changing the “Preprocesser Definitions” in the C/C++ panel of the properties page to include: HAVE_VIDEOINPUT HAVE_DSHOW Hope this helps
Another, simpler way, that will probably translate better into OpenCV as it uses convolution rather than sequential Perl/C code. Basically set all the black pixels to value 10, and all the white pixels to value 0, then convolve the image with the following 3×3 kernel: 1 1 1 1 10 1 1 1 1 Now, … Read more
To build OpenCV as static library you need to set BUILD_SHARED_LIBS flag to false/off: cmake -DBUILD_SHARED_LIBS=OFF .. But I think it is not enough for your task because you actually need to cross-compile library for you architecture. In case of Android or IOS such port already exists and you can simply use it. In case … Read more
OpenCV has region of interest functions which you may find useful. If you are using the cv::Mat then you could use something like the following. // You mention that you start with a CVMat* imagesource CVMat * imagesource; // Transform it into the C++ cv::Mat format cv::Mat image(imagesource); // Setup a rectangle to define your … Read more
That is the code i would advise (it’s one of mine), to my mind it answers a lot of your questions, If you want the distance, i would precise that it is in the Z matrix, the (4,3) coefficient. Hope it will help you… Mat source=imread(“Whatyouwant.jpg”); int alpha_=90., beta_=90., gamma_=90.; int f_ = 500, dist_ … Read more
Python: Reads image blob.jpg and performs blob detection with different parameters. #!/usr/bin/python # Standard imports import cv2 import numpy as np; # Read image im = cv2.imread(“blob.jpg”) # Setup SimpleBlobDetector parameters. params = cv2.SimpleBlobDetector_Params() # Change thresholds params.minThreshold = 10 params.maxThreshold = 200 # Filter by Area. params.filterByArea = True params.minArea = 1500 # Filter … Read more
Depth and Color streams are not taken from the same point so they do not correspond to each other perfectly. Also they FOV (field of view) is different. cameras IR/Depth FOV 58.5° x 45.6° Color FOV 62.0° x 48.6° distance between cameras 25mm my corrections for 640×480 resolution for both streams if (valid depth) { … Read more
If you are using OpenCV 2 or OpenCV 3 you should use IMREAD_* flags (as mentioned at here). C++ using namespace cv; Mat image = imread(“image.png”, IMREAD_UNCHANGED); Python import cv2 im = cv2.imread(“image.png”, cv2.IMREAD_UNCHANGED)
How to install opencv(cv2) with python bindings in Linux – Ubuntu/Fedora Install gcc, g++/gcc-c++, cmake (apt-get or yum, in case of yum use gcc-c++) apt-get install gcc, g++, cmake Downlaod latest opencv from openCV’s website Untar it with tar -xvf opencv-* Inside the untarred folder make a new folder called release mkdir release cd release … Read more
Below is a minimal example: #include <opencv/cv.h> #include <opencv/highgui.h> int main(int argc, const char* argv[]) { const cv::Mat input = cv::imread(“input.jpg”, 0); //Load as grayscale cv::SiftFeatureDetector detector; std::vector<cv::KeyPoint> keypoints; detector.detect(input, keypoints); // Add results to image and save. cv::Mat output; cv::drawKeypoints(input, keypoints, output); cv::imwrite(“sift_result.jpg”, output); return 0; } Tested on OpenCV 2.3