Ask Your Question

elliotwoods's profile - activity

2018-05-06 06:22:35 -0500 edited question Multi-view solvePnP routine

[Paid job] Multi-view solvePnP routine Hi all! I need a multi-view version of the solvePnP function. Qualitively: We w

2018-05-01 22:57:54 -0500 edited answer Multi-view solvePnP routine

@Tetragramm seems to have solved this at: https://github.com/Tetragramm/opencv_contrib/blob/master/modules/mapping3d/inc

2018-05-01 22:56:54 -0500 edited question Multi-view solvePnP routine

[Paid job] Multi-view solvePnP routine Hi all! I need a multi-view version of the solvePnP function. Qualitively: We w

2018-05-01 22:56:50 -0500 edited question Multi-view solvePnP routine

[Paid job] Multi-view solvePnP routine Hi all! I need a multi-view version of the solvePnP function. Qualitively: We w

2018-05-01 22:56:36 -0500 answered a question Multi-view solvePnP routine

@Tetragramm seems to have solved this at: https://github.com/Tetragramm/opencv_contrib/blob/master/modules/mapping3d/inc

2018-02-07 23:13:59 -0500 received badge  Notable Question (source)
2017-08-10 09:34:37 -0500 commented question Multi-view solvePnP routine

Hi Tetragramm. In the end we went with single-camera because we couldn't get stereo working in time (i didn't get a chance to try your implementation). I didn't receive an email from you, and I just want to get in touch again to say thank you for your time and let's chat on email if you have time.

2017-04-10 22:34:36 -0500 commented question Multi-view solvePnP routine

Hi @Tetragramm. Wow this is amazing! I'll try this is as soon as I can . The artwork opening is tomorrow, and my attempt at stereo solvePnP using non-linear fit didn't work (warning - uses other libraries, also produces terrible results. i think i have something wrong somewhere). so i'm on a monocular route right now. will try and switch to your solution tonight. do you have a DM channel?

2017-03-31 21:55:13 -0500 commented answer Multi-view solvePnP routine

Thanks for letting me know about composeRT! it really helps

2017-03-31 21:54:33 -0500 commented question Multi-view solvePnP routine

We can presume that the markers are in ordered sets. i.e. objectPoints1 and imagePoints1 are equal length, and objectPoints1[i] corresponds with imagePoints1[i] (as with solvePnP)

2017-03-31 21:53:41 -0500 commented question Multi-view solvePnP routine

Hi @Tetragramm! I linked to this post from a few places so want to stick with it if possible (i think it gets bumped up the list when somebody posts here).

2017-03-23 06:32:43 -0500 answered a question Unhandled exception at Microsoft C++ exception: cv::Exception at memory location

this isn't necessarily an exception about memory allocation (in fact, most likely it isn't).

try wrapping your code like this

try {
    codeWhichCausesPain();
} catch(const std::exception & e) {
   cout << "Doesn't work : " << e.what();
}

also check your console. generally when an exception is thrown in opencv it gets written to the console also.

Then once you know what the exception is, and what code is causing it, then we can figure out what the reason is :)

2017-03-17 05:35:38 -0500 received badge  Enthusiast
2017-03-15 20:52:20 -0500 commented answer Multi-view solvePnP routine

current thinking : adding another line after https://github.com/opencv/opencv/blob... to include the error from the second camera would result in a simultaneous solve. Just would need to be able to transform _r and _t by either R+T,E,F from stereoCalibrate.

2017-03-13 22:49:11 -0500 commented question Aruco 2.0* dictionaries for OpenCV 3.1.0

having the same issue here! after setting up the whole studio with marker_mapper's favourite MIP_36h12. I'm unable to use any of the markers in OpenCV :)

2017-03-08 10:31:59 -0500 received badge  Scholar (source)
2017-03-08 10:31:48 -0500 answered a question Issue with build on symbols OpenCV 3.2.0 / VS2015 / Release (x64)

User berak was correct. This was a 32bit/64bit mismatch issue.

The bad setting wasn't in the project settings but in the Solution configuration (was set to use the 32bit version of the project for the 64bit build profile). I've seen that pop up a couple of times before but didn't recognise the symptoms.

Thanks to all on IRC and here for helping

Elliot

2017-03-08 08:28:08 -0500 commented question Issue with build on symbols OpenCV 3.2.0 / VS2015 / Release (x64)

hi berak. Thank you for helping on this! I now tried moving opencv_core320.lib to front and end of lib list but same result. definitely using all 64bit (checked dumpbin and all application project settings). I'll try CMAKE now as a sanity check + if it works i can compare project differences.

2017-03-08 04:58:47 -0500 commented question Issue with build on symbols OpenCV 3.2.0 / VS2015 / Release (x64)

also i posted the question on SO http://stackoverflow.com/questions/42... (i imagine more general C++ experience with name mangling there, and more experience with opencv building here :)

2017-03-08 04:57:44 -0500 asked a question Issue with build on symbols OpenCV 3.2.0 / VS2015 / Release (x64)

Hey all

I've been hitting a problem for a couple of days now of getting OpenCV to run within a project with VS2015 but am having library linking problems.

Specifically, I'm the maintainer of the ofxCvMin addon for openFrameworks, and am currently trying to upgrade the libraries from 2.4.x to 3.2.0. (I've built and linked opencv libs a few times for windows and osx over the years).

I can successfully build Debug and Release libs (this wasn't an issue at all). (note : current setup is static libs, not using static CRT)

I managed to build an application linking the debug libraries (with a little extra help on #opencv IRC), but Release is still is not working. VC++ doesn't seem to recognise the imported symbols.

Diggiging deeper, it seems that the C++ application is looking for :

?deallocate@Mat@cv@@QAEXXZ
public: void __thiscall cv::Mat::deallocate(void)

when building. But in opencv_core320.lib we have:

?deallocate@Mat@cv@@QEAAXXZ
public: void __cdecl cv::Mat::deallocate(void) __ptr64

which VC++ doesn't consider to be a compatible symbol. I presume there are some project settings which affect the symbol naming strategy (__thiscall <> __cdecl hints at a C++ vs C style).

Is anybody aware of project settings which affect how the symbols are decorated when using OpenCV with VC++?

Thank you

NB : CMAKE is not an option here as the projects/solutions need to be openFrameworks generated (although could be used to look into which build settings are present)

2017-03-07 19:43:30 -0500 commented answer Multi-view solvePnP routine

I'm sorry but it doesn't get what I want :). I wish there was a way to hack stereoCalibrate to do what I need (e.g. if there were flags like USE_STEREO_EXTRINSICS_GUESS | FIX_STEREO_EXTRINSICS, and it output the extrinsics to the object rather than just between the cameras). Or perhaps it wasn't clear from my question that I want the extrinsics of the stereo pair RELATIVE TO THE SCENE, not to each other.. Thank you

2017-03-07 09:56:21 -0500 answered a question how to use open cv in visual studio 2017

please clarify which language you are using with Visual Studio, e.g. C++, VB, C#, etc.

Visual Basic As @berak notes, OpenCV does not support Visual Basic (although there are unofficial .NET wrapping for OpenCV which you could use to employ OCV in VB). Due to the nature of .NET, you wouldn't need libraries which were specifically built for Visual Basic .NET 2017, you could use older libraries also.

Visual C++ If you're referring to VC (Visual C++), then you will need c++ libraries (and binaries) built with/for Visual C++ 2017. These are not available officially yet, but you could try using a recent version of cmake and a recent version of opencv from github to generate and build your own VC 2017 projects and solution. But you likely will hit many issues.

Since it sounds like you might be new to OpenCV, it's strongly suggested that you use a well supported platform e.g. Visual C++ 2015. If you want to avoid C++, then please consider using OpenCV with Python as it is quite easy to setup and is well documented.

2017-03-07 08:01:01 -0500 asked a question Multi-view solvePnP routine

Hi all!

I need a multi-view version of the solvePnP function.

Qualitively: We want to resolve the pose (rotation + translation) of an object in space using projections of landmarks on that object onto multiple image planes. Each image plane represents a calibrated camera at fixed locations in the world (for each we have a priori : cameraMatrix, distortionCoefficients, rotation, translation). The object is covered in markers (e.g. 10-20 markers, perhaps 4-8 will be in the camera's view at any time) which can be seen and identified in the cameras and are at known 3D positions in object space and known corresponding 2D positions in each image plane. Using the correspondences of 3D points in object space to 2D points in projected image space for each camera, we must reliably (and quickly) discover the rotation and translation for the object.

Quantitively:

  • Inputs
    • Set[ intrinsics, extrinsics ] views // size N
    • Set[ Set[ObjectPoints], Set[ImagePoints] ] // size N
  • Outputs
    • rotation of object // 3-vector
    • translation of object // 3-vector

I have some notes at: https://paper.dropbox.com/doc/KC35-st...

And posed a freelancer posting at: https://www.upwork.com/jobs/~01b0f0c4...

Using a single camera this is possible using the solvePnP function (which optimises the rotation and translation so that the projections of object points match the observed points on the image plane)

Template for the function could be:

double solvePnPMultiView(vector<vector<cv::Point3f>> objectPointsPerView
        , vector<vector<cv::Point2f>> imagePointProjectionsPerView
        , vector<cv::Mat> cameraMatrixPerView
        , vector<cv::Mat> distortionCoefficientsPerView
        , vector<cv::Mat> translationPerView
        , vector<cv::Mat> rotationVectorPerView

        , cv::Mat & objectRotationVector
        , cv::Mat & objectTranslation
        , bool useExtrinsicGuess);


//same function but with different data format
double solvePnPMultiView(vector<vector<cv::Point3f>> objectPointsPerView
        , vector<vector<cv::Point2f>> undsitortedImagePointProjectionsPerView
        , vector<cv::Mat> rectifiedProjectionMatrixPerView

        , cv::Mat & objectRotationVector
        , cv::Mat & objectTranslation
        , bool useExtrinsicGuess);

//specific version for stereo (calls one of the functions above)
double solvePnPStereo(vector<cv::Point3f> objectPointsObservedInCamera1
        , vector<cv::Point2f> projectedImagePointsObservedInCamera1
        , vector<cv::Point3f> objectPointsObservedInCamera2
        , vector<cv::Point2f> projectedImagePointsObservedInCamera2
        , cv::Mat cameraMatrix1
        , cv::Mat distortionCoefficientsCamera1
        , cv::Mat cameraMatrix2
        , cv::Mat distortionCoefficientsCamera2
        , cv::Mat camera1ToCamera2RotationVector
        , cv::Mat camera1ToCamera2Translation

        , cv::Mat & objectRotationVector
        , cv::Mat & objectTranslation
        , bool useExtrinsicGuess);

(these functions would all call the same code internally, but just have different ways of being used)

The object we're trying to track is a tree (with known mesh taken from photo-scan). The tree is covered in retroreflective markers. We are projecting onto the tree from a set of moving video projectors (attached to robot arm). I'm pretty confident I can figure out which marker is which before we get to the solvePnP stage. This is all part of a new artwork by our studio (please check http://kimchiandchips.com#lightbarrie... for an example of previous work).

Notes:

  • Routine should take less than 3ms on Core i7 for 2 views with 10 object points each.
  • Ideally don't use any libraries other than OpenCV (would be even be great to PR this into OpenCV)
  • I think OpenCV's only numerical solver is CvLevMarq which is C only, but I'd like to use C++ style where possible (i.e. it seems probably might ...
(more)
2017-03-07 02:01:05 -0500 received badge  Supporter (source)
2017-01-10 00:33:33 -0500 received badge  Popular Question (source)
2016-01-13 06:06:06 -0500 received badge  Teacher (source)
2014-10-02 11:31:37 -0500 received badge  Self-Learner (source)
2014-10-02 09:55:09 -0500 answered a question findCirclesGrid - no working example

Some findings:

  • Size must be odd in both dimensions (this makes sense when you consider how the found circles are ordered)
  • Using an adaptive threshold (with a blockSize ~3x the circle size works well for me)
  • The Size is supposed to be number of items per row, then number of rows (not the other way around as some suggest)
  • For assymetric circles, each row is a straight line of circles

Here's my code.... (i'm running inside openFrameworks, hence image.getPixelsRef():

Mat cvImage;
cvtColor(toCv(this->image.getPixelsRef()), cvImage, CV_RGB2GRAY);

int blockSize = sqrt(this->paramMaxArea) * 3.0f;
blockSize = (blockSize / 2) * 2 + 1;
if (blockSize <= 1) {
    blockSize = 3;
}

adaptiveThreshold(cvImage, cvImage, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, blockSize, 2);

imitate(this->thresholdedImage, cvImage);
memcpy(this->thresholdedImage.getPixels(), cvImage.data, this->thresholdedImage.getPixelsRef().size());
this->thresholdedImage.update();

SimpleBlobDetector::Params params;
params.maxArea = paramMaxArea; // 100 * 100
params.minArea = paramMinArea; // 10 * 10
Ptr<FeatureDetector> blobDetector = new SimpleBlobDetector(params);

auto success = findCirclesGrid(cvImage, cv::Size(5, 7), this->centers, CALIB_CB_ASYMMETRIC_GRID | CALIB_CB_CLUSTERING, blobDetector);
cout << (success ? "success" : "fail") << endl;

Here's the image i'm testing with: http://www.kimchiandchips.com/files/opencv/5x7.JPG (i can't attach directly here since it's larger than 1MB)

And here's a screenshot of the app running: Screen Shot

The full code can be found at: this gist

2014-10-02 09:42:43 -0500 commented question findCirclesGrid - no working example

Thank you Steven

I didn't use highgui for my tests, as I'm working inside openFrameworks, so it doesn't make for a good sample for others to compile. I'll post my findings below.

2014-10-02 05:57:04 -0500 received badge  Editor (source)
2014-10-02 05:57:04 -0500 edited question findCirclesGrid - no working example

Hi all

I can find a lot of examples of code + images for findCircles grid which does NOT work (according to the authors). Also I can find claims that findCirclesGrid works great for them. But I can't find a code example which is known to work against an image which can be downloaded to test with.

Essentially the example should comprise:

Hoping to post one here soon.. :)

[EDIT] I'm not allowed to answer my own question because i'm a new user, but I managed to get the image and code from: http://answers.opencv.org/question/3136/findcirclesgrid-in-python/ working in a cpp example [/EDIT]