cpclean doesn't work with decimal values ?

28 views
Skip to first unread message

ChameleonScales

unread,
May 20, 2022, 7:04:16 AM5/20/22
to Hugin Google Group
Hi,
If you download the attached pto and run :
cpclean --max-distance "2" -o "./out.pto" "./in.pto"

it revomes 0 control point, even though the max distance is 2.01

I assume cpclean rounds the values and considers 2.01 good enough ?

Problem is because of that, my bash script sometimes works fine and other times loops indefinitely. Here's why :
In my script, the user gives a distance threshold. As long as the pto's maximum control point distance is above that threshold, the script will run several commands including cpclean, in a while loop. More precisely :
while [[ $maxdist > $tolerance ]] ; do
  cpclean --max-distance $tolerance1 -o "$pto" "$pto"
  autooptimiser -n -o "$pto" "$pto"
  maxdist=`checkpto "$pto" | grep Maximum | awk -F ": " '{print $2}'`
done

So if the user gives 2 as the threshold for the attached pto file, my script will never get out of the while loop.


Did I make a wrong assumption about cpclean?
How would you go about this?
in.pto

T. Modes

unread,
May 20, 2022, 10:45:57 AM5/20/22
to hugin and other free panoramic software
ChameleonScales schrieb am Freitag, 20. Mai 2022 um 13:04:16 UTC+2:
Hi,
If you download the attached pto and run :
cpclean --max-distance "2" -o "./out.pto" "./in.pto"

it revomes 0 control point, even though the max distance is 2.01

I assume cpclean rounds the values and considers 2.01 good enough ?

Did I make a wrong assumption about cpclean?

 cpclean does not work with fixed threshold. The threshold is always mean+n*sigma (in step 1 for each image pair and then in step 2 for the whole pano). The max-distance factor is the variable n in the given expression.

Also running autooptimiser in between does not affect the results because cpclean does its own optimisation for each step before calculating mean and sigma.
From the help screen:
cpclean --help
<snip>
Step 1 optimises all images pairs, calculates for each pair mean
       and standard deviation and removes all control points
       with error bigger than mean+n*sigma
Step 2 optimises the whole panorama, calculates mean and standard deviation
       for all control points and removes all control points with error
       bigger than mean+n*sigma
</snip>

I have extended also the help file for cpclean.

ChameleonScales

unread,
May 20, 2022, 11:08:37 AM5/20/22
to hugi...@googlegroups.com
Thanks for this clarification. I will adapt my script accordingly.

ChameleonScales

unread,
May 22, 2022, 7:04:05 AM5/22/22
to hugi...@googlegroups.com
Also running autooptimiser in between does not affect the results because cpclean does its own optimisation for each step before calculating mean and sigma.

it actually does and I just verified it. There may be one or two reasons:

1: as you may have noticed, my script uses the -n argument with autooptimiser, which does:
Optimize parameters specified in script file

Maybe cpclean does one type of optimization regardless of what's specified in the pto.

2: As you said in the other topic :

after running cpclean the image positions remain always unchanged
So if you run autooptimizer, you do move the images and maybe it affects which cps will be deleted. I'm less sure of this one because cpclean optimizes before removing cps, so if the optimization type is the same as autooptimizer, it should get the same cp distances regardless.
Reply all
Reply to author
Forward
0 new messages