Force Hugin CPFind to create/find more Control Points? Problem with lots of snow.

Skip to first unread message


Feb 15, 2023, 2:39:46 AM2/15/23
to hugin and other free panoramic software

I have been work on a better way to handle pano images from my Drone (Mini 2), and one problem has me stumped. 

To help with the sheer volume of panos I am working with (~1000), I am attempting to script this with a Win Bat file file. 

The problem specifically now is with multiple images in a pano set being omitted due to no CP's found. 

Here are the script steps I am using to generate the CP's.  All other steps in my testing script have been remarked out to focus on this aspect of the problem -

REM Build the PTO file with the contents of the directory we are currently in.
"C:\Program Files\Hugin\bin\pto_gen" *.jpg -o test.pto

REM Create Control Points in the existing pto file
"C:\Program Files\Hugin\bin\cpfind" -o test.pto test.pto

This works for most of the image sets, but being from the north and winter, I have many that are struggling with finding CP's when the contrast and features in the snow are not as obvious. 

Example Images -

I poured through the documentation on how to tweak cpfind to generate more points, but no matter what I have tried(Example: --kdtreesteps=1000 --kdtreeseconddist=1 --sieve1size=500 --fullscale -v --linearmatch), I cannot force it to find more points in the snowy images. 

Any recommendations on how to tweak the process, and/or the cpfind command line options?

Thank you!

Saleh Saeed

Feb 15, 2023, 2:28:42 PM2/15/23

The images shot by your drone lacks texture (boundary regions around objects in particular for images D & E - see below). The low light conditions of the north are probably not the culprit. Following are your images (left) and their high pass filtered versions (right).
A.jpeg A-highpass.jpeg
B.jpeg B-highpass.jpeg
C.jpeg C-highpass.jpeg
D.jpeg D-highpass.jpeg
E.jpeg E-highpass.jpeg
F.jpeg F-highpass.jpeg

Test image: (with better boundary regions around an object)
Lenna_(test_image).png Lenna_(test_image)-highpass.png

Here is a screen shot of hugin showing the control points matched between images. (Note that hugin cannot find/match any control point in D & E)
control points.PNG

Solution 1:
Use hugin's CP finder in the GUI (as shown in the image below) to manually add and match control points. I tried that but due to lack of differentiable regions I cannot even match it manually for images D & E.
control points C-D.PNG

Solution 2:
Try to recapture images with objects so that their boundaries (edges) can be used as control points by the CP finder.

Solution 3: (My suggestion)
If you use a drone with cameras fixed at their respective locations (cameras are not moving relative to each other, only the drone is moving), you don't need to find the control points each time. Just use one set of images for finding control point and alignment. Repeat that alignment (or transformation) for all images in a batch. This process requires a little RnD and could not be possible for everyone.

Please feel free to ask if you have any questions.

Thank you and have a nice day.


A list of frequently asked questions is available at:
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
To view this discussion on the web visit

Jan Steinman

Feb 16, 2023, 11:09:09 AM2/16/23
to hugin and other free panoramic software
"you don't need to find the control points each time. Just use one set of images for finding control point and alignment"

I agree. What I have done when stitching 60° segments of spheres is to manually place a single control point in the top centre of each horizontal image, then place six corresponding control points every 60° in the zenith shot.

Since your sky is so uniform, I think you could easily do a similar approach for the sky, leaving hugin to choose the points it can. That may result in some odd "stretching" of the sky relative to the other points, but I bet no one will ever notice.


Aug 21, 2023, 11:54:35 PM8/21/23
to hugin and other free panoramic software


Just in case someone comes across this thread, I have figured out the solution suggested above that is currently working….templates and prealigned commands to re-use known locations of images. The DJI Mini 2 shoots a pano in the same manner each time thankfully.

I have modified my script that stitches my DJI Mini 2 Pano photo sets and it does the following -

Here is what my script does -

  1. Generates a new PTO for the specific folder
  2. import template details.
  3. cpfind (with pre-aligned as the drone uses the same pattern each time)
  4. clean control points
  5. geocpset to “match” images without CP’s…this was needed for areas of water/snow that are mostly featureless.
  6. clean control points
  7. linefind (not really seeing a benefit to this one, but that is another story)
  8. Autooptimiser
  9. Pano_Modify - tweak the settings to get the output I want.
  10. send the PTO to batch processor to not completely kill my computer when doing large sets.

The trick with the featureless images (water this time, but I think it will be similar with my snow photos) was the creation of a template and using the pre-aligned parameter along with the geocpset tool.

This is not perfect yet, but far better.

Note - Templates - I used a pto file that was very close to perfect for my template.pto. The script ingests this template file and uses the needed data for positioning. I could not find a good reference for the —prealigned parameters/process, so this was a lot of trial and error.

The full script as of writing this -

REM 2023-08-21- This script is being built to take a folder full of folders containing groups of .jpg photos from the drone 360 photo tool and export a 2:1 aspect ration photo to be uploaded to google Maps/Streetview. REM Guide followed located here - REM - dji.assistant file uses a similar process, but dynamically pulls data. If the template I have setup does not work well, this may be a new idead - REM Hugin needs to be installed here C:\Program Files\Hugin REM - This script is being called by the deployment script. The Deployment script copies this to each folder in the specified directory and then executes it. All sub-folder tasks will run at the same time, so it will take a bit of time when doing many panos. REM - MAKE SURE YOU DO NOT HAVE ANY NON-PANO IMAGES IN THE FOLDER. THE SOFTWARE TRIES TO EAT THEM AND ADD TO YOUR PANO. REM - set the name of the variable we will be using. This will be the name of the directory the file is in. @echo off for %%I in (.) do set "current_folder=%%~nxI" echo The current folder is: %current_folder% REM Build the PTO file with the contents of the directory we are currently in. "C:\Program Files\Hugin\bin\pto_gen" *.jpg -o %current_folder%.pto REM Add detail from the template example (a good DJI Mini2 pano in my case) to new PTO file from the template of a known good file. REM - "C:\Program Files\Hugin\bin\pto_template" --o %current_folder%.pto --template=template.pto %current_folder%.pto REM Create Control Points in the project "C:\Program Files\Hugin\bin\cpfind" --prealigned -o %current_folder%.pto %current_folder%.pto REM Clean up the control points "C:\Program Files\Hugin\bin\cpclean" -o %current_folder%.pto %current_folder%.pto REM Use the non-conntected tool to align non-CPlinked images REM - "C:\Program Files\Hugin\bin\geocpset" -o %current_folder%.pto %current_folder%.pto REM Clean up the control points "C:\Program Files\Hugin\bin\cpclean" -o %current_folder%.pto %current_folder%.pto REM Find Vertical Lines "C:\Program Files\Hugin\bin\linefind" -o %current_folder%.pto %current_folder%.pto REM Optimize "C:\Program Files\Hugin\bin\autooptimiser" -a -l -s -m -o %current_folder%.pto %current_folder%.pto REM set output/stitcher options REM These options are to setup the pano for upload to Google Maps. "C:\Program Files\Hugin\bin\pano_modify" -o %current_folder%.pto --fov=360x180 --center --straighten --canvas=9000x4500 --ldr-file=JPG --ldr-compression=100 --output-exposure=AUTO %current_folder%.pto REM Stitch the output - un-rem the next line if you want the script to stitch right away. I had too many at once so I moved over to the batch tool, which is the command below. REM "C:\Program Files\Hugin\bin\hugin_executor" --stitching --prefix=%current_folder% %current_folder%.pto REM send to batch to run sequentially. REM Only use the next line if the "hugin_executer" line is commented out. "C:\Program Files\Hugin\bin\PTBatcherGui.exe" --batch %current_folder%.pto REM - Figure out how to get rid of the black blocks at the top.
Reply all
Reply to author
0 new messages