opencv3.0

python opencv matchTemplate is mask feature implemented?

混江龙づ霸主 提交于 2019-12-12 08:58:36
问题 OpenCV, as of version 3.0.0, added a mask feature to the matchTemplate method. It supports template matching with transparent templates by defining a mask on the template. My python program below works fine, but if I add a mask parameter to the cv2.matchTemplate call, it throws an error: OpenCV Error: The function/feature is not implemented () in matchTemplateMask, file /Users/jared.rada/dev/opencv/modules/imgproc/src/templmatch.cpp, line 894 Traceback (most recent call last): File "masked.py

How to get all images in folder using c++

北城以北 提交于 2019-12-12 08:49:08
问题 I have a problem. I'm writing C++ with the openCV library. I want to get the number of all images in a folder and I want to load all images in the folder for process in C++. 回答1: you can use glob to get a list of filenames: vector<cv::String> fn; glob("/home/images/*.png", fn, false); vector<Mat> images; size_t count = fn.size(); //number of png files in images folder for (size_t i=0; i<count; i++) images.push_back(imread(fn[i])); 来源: https://stackoverflow.com/questions/31346132/how-to-get

Fastest way to apply color matrix to RGB image using OpenCV 3.0?

回眸只為那壹抹淺笑 提交于 2019-12-12 07:06:52
问题 I have a color image represented as an OpenCV Mat object (C++, image type CV_32FC3). I have a color correction matrix that I want to apply to each pixel of the RGB color image (or BGR using OpenCV convention, doesn't matter here). The color correction matrix is 3x3. I could easily iterate over the pixels and create a vector v (3x1) representing RGB, and then compute M*v, but this would be too slow for my real-time video application. The cv::cvtColor function is fast, but does not seem to

Opencv 3 with Python3 getting this error: (-215) npoints > 0 in function drawContours

微笑、不失礼 提交于 2019-12-12 06:24:42
问题 Trying to draw in contours from a list. Here's my code. It fails on the cv2.drawContours function. Is there a way to use the connectedComponentsWithStats function to somehow find all the contours and then draw black pixels over them the way I am trying to because when I use the connectedComponentsWithStats function, it selects the contours I want it to. gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) labelNum, labelImg, contours, GoCs = cv2.connectedComponentsWithStats(gray) for c in contours:

error in using cmake to build opencv3.2

蹲街弑〆低调 提交于 2019-12-12 04:34:07
问题 I want to using the contrib part of opencv3.2, so i have to build it from sources. Here is my setting: windows10, vs2013, cmake-gui-3.8.1. after configuration in cmake-gui, i click the generator button, and i get the error message below. I am new to opencv, and i couldn't figure out how to solve it. Anyone who can help, THANKS. CMake Error at E:/Program Files/opencv/opencv/source/opencv-3.2.0/cmake/OpenCVUtils.cmake:911 (add_library): Cannot find source file: E:/Program Files/opencv/opencv

What version of libpng is used in different versions of OpenCV?

微笑、不失礼 提交于 2019-12-12 03:48:37
问题 In my application I am reading .png images and doing some processing. The output with OpenCV 2.4.9 and OpenCV 3.0.0 (both for windows) are not bit exact. What may be the potential error. Is there any difference in libpng in both the versions which is causing the problem. Also is there any possibility that the libs (e.g. libpng) or the version of libs is different in same version (say 2.4.9 or 3.0.0) of OpenCV for windows and OpenCV for Android. 回答1: Is there any difference in libpng in both

linking error while using opencv 3.0 on eclipse

前提是你 提交于 2019-12-12 03:37:19
问题 I am trying to build an opencv 3.0.0 video project under ubuntu 14.04 on eclipse luna. This is the code sample: #include <opencv2/opencv.hpp> #include <opencv2/highgui.hpp> #include <opencv2/videoio.hpp> using namespace cv; int main( int argc, char** argv ) { VideoCapture cap(0); Mat edges; namedWindow("edges", 1); while(1) { Mat frame; cap >> frame; cvtColor(frame, edges, CV_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3); imshow("edges", edges); if

How to find the pixel value that corresponds to a specific number of pixels?

大兔子大兔子 提交于 2019-12-12 02:26:21
问题 Assume that I have a grayscale image in OpenCV. I want to find a value so that 5% of pixels in the images have a value greater than it. I can iterate over pixels and find number of pixels with the same value and then from the result find the value that %5 of pixel are above my value, but I am looking for a faster way to do this. Is there any such technique in OpenCV? I think histogram would help, but I am not sure how I can use it. 回答1: You need to: Compute the cumulative histogram of your

Issue converting KeyPoints to and from JSON and then using FlannBasedMatcher

旧街凉风 提交于 2019-12-11 19:11:38
问题 I'm saving my KeyPoints and Descriptors in a JSON file. Later when I retrieve them, I am trying to use them in a FlannBasedMatcher . However, I think something is going wrong in the conversion because I am getting the following error. cv2.error: OpenCV(4.1.0) /io/opencv/modules/flann/src/miniflann.cpp:315: error: (-210:Unsupported format or combination of formats) in function 'buildIndex_' > type=4 > Creating the keypoints and descriptors brisk = cv2.BRISK_create() kp1, des1 = brisk

OpenCV 3.0 RGBD DepthCleaner

☆樱花仙子☆ 提交于 2019-12-11 16:25:38
问题 I am having some difficulties to use the function DepthCleaner () with method = DEPTH_CLEANER_NIL to clean a depth image. This function is released in OpenCV 3.0.0. So, it's too early to find useful documentation for this function. If anyone of you have already used this function, could you please inform me which set of functions and codes I use to get a clean depth image. Let's say, I have a depth image from Kinect1 named as 'Img1.png'. I am declaring the image and using DepthCleaner as