OpenCV 3.0 LineIterator

I’ve solved my own problem. Line iterator seems to be unavailable in the cv2 library. Therefore, I made my own line iterator. No loops are used, so it should be pretty fast. Here is the code if anybody needs it: def createLineIterator(P1, P2, img): “”” Produces and array that consists of the coordinates and intensities … Read more

OpenCV unable to set up SVM Parameters

A lot of things changed from OpenCV 2.4 to OpenCV 3.0. Among others, the machine learning module, which isn’t backward compatible. This is the OpenCV tutorial code for the SVM, update for OpenCV 3.0: #include <opencv2/core.hpp> #include <opencv2/imgproc.hpp> #include “opencv2/imgcodecs.hpp” #include <opencv2/highgui.hpp> #include <opencv2/ml.hpp> using namespace cv; using namespace cv::ml; int main(int, char**) { // … Read more

Convert a single color with cvtColor

Your second approach is correct, but you have source and destination of different types in cvtColor, and that causes the error. Be sure to have both hsv and bgr of the same type, CV_32F here: #include <opencv2/opencv.hpp> #include <iostream> int main() { cv::Mat3f hsv(cv::Vec3f(0.7, 0.7, 0.8)); std::cout << “HSV: ” << hsv << std::endl; cv::Mat3f … Read more

How can I get the position and draw rectangle using opencv?

So you have a problem unrelated to your question. However, you can achieve your goal using only OpenCV highgui facilites: #include <opencv2\opencv.hpp> #include <iostream> using namespace std; using namespace cv; vector<Rect> rects; bool bDraw; Rect r; Point base; Mat3b img; Mat3b layer; Mat3b working; void CallBackFunc(int event, int x, int y, int flags, void* userdata) … Read more

‘unresolved external symbol’ error when linking with OpenCV 3.0

Here the steps to use OpenCV 3.0.0 with precompiled libs, for a C++ project that links OpenCV statically, in Windows (tested with Windows 8.1) and Visual Studio (tested with Visual Studio 2013) to run this program: #include <opencv2\opencv.hpp> using namespace cv; int main() { Mat3b img = imread(“path_to_image”); imshow(“img”, img); waitKey(); return 0; } Download … Read more