opencv based CP detector for use with Hugin?

97 views
Skip to first unread message

Robert Mahar

unread,
Sep 7, 2023, 11:07:51 AM9/7/23
to hugin and other free panoramic software
Hi,

I've been using Hugin for a decade and for the most part can get it to do even difficult projects pretty easily.    But I have a couple microchip photography projects for which cpfind either finds no control points or a pile of extraneous ones.

Before I go crazy trying to make a cpfind like tool that speaks .pto files, and so on, I'm wondering if such a thing already exists to enable the use of the feature detection / mapping built into opencv.   I cannot imagine I am the first person on the planet to want to do this.   ( If I m I guess I should start coding. )

-- Bob

Rod Bibeau

unread,
Sep 7, 2023, 11:21:54 AM9/7/23
to hugi...@googlegroups.com
So my use case is a bit different but maybe helpful -

I had a bunch of panos from my drone with lots of water and/or snow
that cause some images to not find CP's. My solution is not perfect, I
am confident, but works for the most part - Basically, I took a PTO
file that had all the images linked and used it as a template and then
incorporated the template into my pano script. While the results are
not perfect, they are much better than having large holes in the image
or water where the sky should be.

My git repository for this needs to be updated some, but here is the
script - https://github.com/RookieITSec/HuginPanoScript/blob/main/PanoScript-Queue-v2.bat
> --
> A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
> ---
> You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/6e8fafa1-2884-4bfb-8f5f-ab973b0ba669n%40googlegroups.com.

Harry van der Wolf

unread,
Sep 7, 2023, 12:30:46 PM9/7/23
to hugi...@googlegroups.com
Yes, it is already there in opencv and works pretty well.
There are multiple algorithms can do the "control point find" and multiple algorithms like the MergeMertens that can be combined as well.
And it also contains blending algorithms.

I did some work in Python. Not in C.


Harry

Op do 7 sep 2023 om 17:07 schreef Robert Mahar <bob....@muhlenberg.edu>:
--

Robert Mahar

unread,
Sep 8, 2023, 1:56:32 PM9/8/23
to hugin and other free panoramic software
Looking at the opencv feature detection, the only painful thing will be making something that "just works" with stock opencv packages, as the feature detection are in 3rd party modules so not normally available if you just grab opencv pre-built RPM.   Not so sure how easily sharable such a solution would be for average Hugin users if "step one" is build their own opencv libraries from source.   But the rest is just a lot of boilerplate and it should be easy to wrap it in a way that looks like a typical panotools utility.  "cvfind" LOL.

Saleh Saeed

unread,
Sep 8, 2023, 5:06:27 PM9/8/23
to hugi...@googlegroups.com
Hi,

OpenCV uses SIFT/SURF/ORB etc methods to extract features per image. The extracted features are matched between image pairs by predicting an alignment. OpenCV cannot find this alignment for non-linear images (i.e. wide angle/fisheye). 

- If you are using wide angle images with high distortion at corners, you can extract features with some incorrect/missing feature matches (at the distorted corners) using OpenCV. I recommend not to use OpenCV in this case.
- If you are using linear images, you can use OpenCV to write accurate 2D coordinates of matching features into the Hugin's pto file.

You have to compile OpenCV with some changes in the code to get the 2D coordinates of matched features between image pairs.

If you can share a sample of your work where the CP find gives you no or externous control points, it will be easier to check for issues.

Harry van der Wolf

unread,
Sep 8, 2023, 5:59:27 PM9/8/23
to hugi...@googlegroups.com
Which ones do you mean?
In the 4.6 prebuilt libraries WITH the python bindings, I have ORB, SIFT, ECC, AlignMTB, mergeMertens exposure fusion, stiching, blending..
SIFT is free now, SURF is not, but ORB does a great job for keypoints and feature detection. Better than the other two (in my opinion).
It is for Python though, not C.

There is also the "learnopencv.com" with many examples in both C(++) and Python.
And on github there are by now also a ton of examples.
Lots to learn and copy from.

Op vr 8 sep 2023 om 19:56 schreef Robert Mahar <bob....@muhlenberg.edu>:
Reply all
Reply to author
Forward
0 new messages