Ask Your Question

wolfram79's profile - activity

2018-09-12 02:05:35 -0600 received badge  Notable Question (source)
2017-06-01 06:30:42 -0600 received badge  Popular Question (source)
2016-03-28 01:29:14 -0600 asked a question Incompatible library version: libopencv_sfm.3.1.dylib requires version 4.0.0 or later, but libgflags.2.dylib provides version 2.0.0

Hi everyone,

I've successfully upgraded to OpenCV 3.1 built and configured from source on my mac. When try to test the built libs I always get the following error (python for example)

(cv) sir:build sir$ python Python 2.7.10 (default, Jul 13 2015, 12:18:59) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import cv2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/Users/sir/.virtualenvs/cv/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: /usr/local/lib/libgflags.2.dylib Referenced from: /usr/local/lib/libopencv_sfm.3.1.dylib Reason: Incompatible library version: libopencv_sfm.3.1.dylib requires version 4.0.0 or later, but libgflags.2.dylib provides version 2.0.0

Now, since there is no version 4.0.0 of libgflags I wonder what's going on?

Anyone has an idea?

I'd really appreciate it, since I cannot compile my OpenCV-Based projects anymore atm disaster help :)

2014-11-11 12:04:38 -0600 asked a question MDd and MTd link errors when using QT and OpenCV under Windows VS12 LNK2038

I'm trying to compile a project that I have written on Mac using QT and OpenCV3 on Windows.

I'm failing in the Link step - LNK2038 : mismatch detected for 'RuntimeLibrary' MTd_StaticDebug != MDd_DynamicDebug

Both BOOST and QT have issues when you do not use "dynamic C run time library " if I understand the respective documentations correct.

I can start compiling OpenCV on my Windows machine now, but last time I did that on mac i needed half a day to configure it correctly...

Is there a way I can get OpenCV precompiled with /MDd ? I'm sure a lot of people use OpenCV with BOOST Unit testing and QT, so everyone would be lost with the supplied download, or am I missing a point here?

Sincerely,

Wolfram

2014-11-11 08:30:36 -0600 answered a question How to calculate the degree of camera shake

There are a lot of ways to do that...

One way it can be done is like at http://nghiaho.com/uploads/code/videostab.cpp

(frame processing snippet)

cap >> cur;

if(cur.data == NULL) {
    break;
}

cvtColor(cur, cur_grey, COLOR_BGR2GRAY);

// vector from prev to cur
vector <Point2f> prev_corner, cur_corner;
vector <Point2f> prev_corner2, cur_corner2;
vector <uchar> status;
vector <float> err;

goodFeaturesToTrack(prev_grey, prev_corner, 200, 0.01, 30);
calcOpticalFlowPyrLK(prev_grey, cur_grey, prev_corner, cur_corner, status, err);

// weed out bad matches
for(size_t i=0; i < status.size(); i++) {
    if(status[i]) {
        prev_corner2.push_back(prev_corner[i]);
        cur_corner2.push_back(cur_corner[i]);
    }
}

// translation + rotation only
Mat T = estimateRigidTransform(prev_corner2, cur_corner2, false); // false = rigid transform, no scaling/shearing

// in rare cases no transform is found. We'll just use the last known good transform.
if(T.data == NULL) {
    last_T.copyTo(T);
}

T.copyTo(last_T);

// decompose T
double dx = T.at<double>(0,2);
double dy = T.at<double>(1,2);
double da = atan2(T.at<double>(1,0), T.at<double>(0,0));

prev_to_cur_transform.push_back(TransformParam(dx, dy, da));

out_transform << k << " " << dx << " " << dy << " " << da << endl;

cur.copyTo(prev);
cur_grey.copyTo(prev_grey);

cout << "Frame: " << k << "/" << max_frames << " - good optical flow: " << prev_corner2.size() << endl;
k++;


(snippet)

Another way that is very robust is to take a few e.g. 64x64 gray blocks of the image at fixed positions and correlate them with the following frame. The position of the maximum value of the resulting matrix corresponds to the translation.

You might want to apply lens distortion before if you want to have real nice results and you're "zoomed out".

W.

2014-11-11 08:20:38 -0600 asked a question KNearest get sample count - where did it go?

The method

CvKNearest::get_sample_count ( Manual : Returns the total number of train samples. C++: int CvKNearest::get_sample_count() const )

seems to be a victim of the latest refactoring ... how to I get the train sample count now?

2014-11-11 08:18:18 -0600 commented question cv::KNearest missing in 3.0.0, cv::ml::KNearest abstract?

Thanks a lot for the quick reply. The method

CvKNearest::get_sample_count ( Manual : Returns the total number of train samples. C++: int CvKNearest::get_sample_count() const )

seems to be missing as well... what happend to it / how to I get the train sample count now?

Thanks again

2014-11-11 08:18:01 -0600 commented question cv::KNearest missing in 3.0.0, cv::ml::KNearest abstract?

Thanks a lot for the quick reply. The method

CvKNearest::get_sample_count ( Manual : Returns the total number of train samples. C++: int CvKNearest::get_sample_count() const )

seems to be missing as well... what happend to it / how to I get the train sample count now?

Thanks again

2014-11-11 08:16:04 -0600 commented question cv::KNearest missing in 3.0.0, cv::ml::KNearest abstract?

Thanks a lot for the quick reply. The method

CvKNearest::get_sample_count ( Manual : Returns the total number of train samples. C++: int CvKNearest::get_sample_count() const )

seems to be missing as well... what happend to it / how to I get the train sample count now?

Thanks again

2014-11-11 08:15:41 -0600 commented question cv::KNearest missing in 3.0.0, cv::ml::KNearest abstract?

Thanks a lot for the quick reply. The method

CvKNearest::get_sample_count ( Manual : Returns the total number of train samples. C++: int CvKNearest::get_sample_count() const )

seems to be missing as well... what happend to it / how to I get the train sample count now?

Thanks again

2014-11-11 07:41:52 -0600 received badge  Scholar (source)
2014-11-11 07:41:33 -0600 commented answer cv::KNearest missing in 3.0.0, cv::ml::KNearest abstract?

Thanks a lot for the quick reply. The method

CvKNearest::get_sample_count ( Manual : Returns the total number of train samples. C++: int CvKNearest::get_sample_count() const )

seems to be missing as well... what happend to it / how to I get the train sample count now?

Thanks again

2014-11-07 16:47:05 -0600 answered a question Stereo Camera Code: Both are on but only one capture window

Hi Ninja,

try to initialize named windows first

(...)

cv::namedWindow("RedCamera"); cv::namedWindow("BlackCamera");

for (;;){

(...)

cv::imshow("RedCamera", cameraFrame1); cv::imshow("BlackCamera", cameraFrame2);

(...)

(see also:)

http://stackoverflow.com/questions/19565262/opencv-imshow-does-not-work

2014-11-07 16:38:48 -0600 received badge  Editor (source)
2014-11-07 16:35:37 -0600 asked a question cv::KNearest missing in 3.0.0, cv::ml::KNearest abstract?

Hi,

I have a perfectly working program written in c++ under Mac OS 10.9 (LLVM) with QT5 and OpenCV that i pulled some weeks ago from the development branch. It uses cv::KNearest.

I'm trying to compile this application under Windows using OpenCV 3.0.0 Alpha, QT5 latest version, Visual Studio '13 but don't succeed.

I get

cv::KNearest : Is not a member of 'cv' (?)

Looking into the <ml.hpp> class, I figured out to try to use cv::ml::KNearest instead, but now I get

C2259 cv::ml::KNearest : cannot instantiate abstract class

Can somebody help me with this? Has there been a recent change in the KNearest / ML code, ...?

Sincerely,

Wolfram