opencv3.0

How to detect multiple objects with OpenCV in C++?

孤者浪人 提交于 2020-01-02 00:41:16
问题 I got inspiration from this answer here, which is a Python implementation, but I need C++ , that answer works very well, I got the thought is that: detectAndCompute to get keypoints , use kmeans to segment them to clusters, then for each cluster do matcher->knnMatch with each's descriptors , then do the other stuffs like the common single detecting method. The main problem is, how to provide descriptors for each cluster's matcher->knnMatch process? I thought we should set value of the other

Python openCV matchTemplate on grayscale image with masking

旧巷老猫 提交于 2020-01-01 05:37:13
问题 I have a project where I want to locate a bunch of arrows in images that look like so: ibb.co/dSCAYQ with the following template: ibb.co/jpRUtQ I'm using cv2's template matching feature in Python. My algorithm is to rotate the template 360 degrees and match for each rotation. I get the following result: ibb.co/kDFB7k As you can see, it works well except for the 2 arrows that are really close, such that another arrow is in the black region of the template. I am trying to use a mask, but it

How can I change the device on wich OpenCL-code will be executed with Umat in OpenCV?

耗尽温柔 提交于 2019-12-29 06:32:32
问题 As known, OpenCV 3.0 supports new class cv::Umat which provides Transparent API (TAPI) to use OpenCL automaticaly if it can: http://code.opencv.org/projects/opencv/wiki/Opencv3#tapi There are two indtroductions to the cv::Umat and TAPI: Intel: https://software.intel.com/en-us/articles/opencv-30-architecture-guide-for-intel-inde-opencv AMD: http://developer.amd.com/community/blog/2014/10/15/opencv-3-0-transparent-api-opencl-acceleration/ But if I have: Intel CPU Core i5 (Haswell) 4xCores

OpenCV imwrite gives washed-out result for jpeg images

为君一笑 提交于 2019-12-28 22:50:24
问题 I am using OpenCV 3.0 and whenever I read an image and write it back the result is a washed-out image. code: cv::Mat img = cv::imread("dir/frogImage.jpg",-1); cv::imwrite("dir/result.jpg",img); Does anyone know whats causing this? Original: Result: 回答1: You can try to increase the compression quality parameter as shown in OpenCV Documentation of cv::imwrite : cv::Mat img = cv::imread("dir/frogImage.jpg",-1); std::vector<int> compression_params; compression_params.push_back(CV_IMWRITE_JPEG

OpenCV unable to set up SVM Parameters

送分小仙女□ 提交于 2019-12-28 03:03:53
问题 I have just started my learning on SVM using C++ OpenCV and was referring to the SVM documentation here. I wanted to try out the sample source code from the link to get familiar with it first but I couldn't run the sample source code. It returns the error : Error 1 error C2065: 'CvSVMParams' : undeclared identifier I'm using Visual Studio 2012 with OpenCV 3.0.0. The setup process should be correct as all other codes are working well except this. 回答1: A lot of things changed from OpenCV 2.4 to

Efficiently load a large Mat into memory in OpenCV

一曲冷凌霜 提交于 2019-12-27 10:17:12
问题 Is there a more efficient way to load a large Mat object into memory than the FileStorage method in OpenCV? I have a large Mat with 192 columns and 1 million rows I want to store locally in a file and load into memory then my application starts. There is no problem using the FileStorage, but I was wondering if there exists a more efficient method to do this. At the moment it takes about 5 minutes to load the Mat into memory using the Debug mode in Visual Studio and around 3 minutes in the

Drawing a Wave represented by (Orientation, Frequency, Phase-shift, Amplitude) Using OpenCv

╄→尐↘猪︶ㄣ 提交于 2019-12-25 19:04:08
问题 I want to create an empty image and take parameters from user, which are Wave Orientation, Wave Frequency, Phase-shift, Wave Amplitude. And I have to give an output similar to the following image: My questions: How can I draw waves inside my empty image? What functions should I use? 回答1: I guess you can do the following steps (but I am not sure, since I didn't test it): Use sine function with needed Wave Frequency, Phase-shift and Wave Amplitude to calculate values of pixels in one row.

Opencv3 Bayes Classifier predictProb giving strange results

Deadly 提交于 2019-12-25 16:55:16
问题 I am training an Opencv Bayes Classifier on various features of people for re-identification. The classifier appears to be working and predict() is giving an output, but the predictProb() function is returning very large values for some features and 0 for others. Data of the form: (this is one row of the matrix) 0.2523284, 0.027687496, 0.0042156572, 0.0018417788, 5.1221455e-06, 0.00030639244, 3.1830291e-07; gives probabilities of the order 1.0710769e+21 Data of the form: (this is one row of

Template Matching a screenshot fails on assertion

淺唱寂寞╮ 提交于 2019-12-25 14:22:07
问题 I'm trying to use OpenCV for template matching of a screenshot. I'm getting an error whenever I call the cv::matchTemplate() function. The error I'm getting: OpenCv Error: Assertion failed ((depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2) in cv::matchTemplate, file C:\builds\master_PackSlave-win64-vc12-shared\opencv\modules\imgproc\src\templmatch.cpp What I've tried: This question attempts to solve the problem but the solution doesn't help because that's what

Error: “Fatal signal 11 (SIGSEGV), code 1” when passing Mat object from java to jni function

旧城冷巷雨未停 提交于 2019-12-25 11:14:55
问题 I am running the video camera using the OpenCV function. I pass the Mat object to the jni function it works for awhile, them the error: 10-10 13:03:17.978: A/libc(28693): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9 in tid 28791 (Thread-5418) Java code that runs the camera and calls the jni function: package com.adhamenaya; import java.util.ArrayList; import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android