Page 1 of 1
Calculations in the CLI
Posted: Fri Feb 16, 2024 11:56 am
by mm_max_cloud
I am trying to substract a plane from my point cloud and only keep the points above a certain distance.
My CLI script works fine except for the filtering of the scalar field.
Is it possible to perform calculations on the defined variables "MAX"; "MIN"; "SAT_MAX";"DISP_MIN" etc.?
I keep getting this error message:
- Screenshot 2024-02-16 125042.png (43.35 KiB) Viewed 3421 times
My shell script for the filtering of the SF is as follows:
any help is highly appreciated :)
Re: Calculations in the CLI
Posted: Sat Feb 17, 2024 7:56 am
by daniel
Which version are you using? Only version 2.13 supports this.
Re: Calculations in the CLI
Posted: Mon Feb 19, 2024 7:40 am
by mm_max_cloud
I am using CloudCompare 2.13beta
Re: Calculations in the CLI
Posted: Mon Feb 19, 2024 7:58 am
by daniel
That's maybe an old beta version. The 2.13 official version has been released last week, you should try it.
Re: Calculations in the CLI
Posted: Mon Feb 19, 2024 8:37 am
by HeadLess
your $MAX value was not properly converted by your shell, probably because using single quotes, or escaping or because of the brackets. make sure that your command sends proper commands to CC. you could try to send your commands to a file, then load that with
-COMMAND_FILE {file}
command, that way you can check everything in your file.
But to be sure Daniel CC supports arithmetic during filter SF? does it really need to in this case?
if you use bash to calculate your min value $(($MAX*0.99)) that way your bash will calculate your value.
Re: Calculations in the CLI
Posted: Mon Feb 19, 2024 10:45 am
by mm_max_cloud
Thank you for your suggestions.
I installed the 2.13 stable version of cloud compare - but still get the same error.
I think the problem is that the "-FILTER_SF" command does not support arithmetic operations.
It is not possible to access the "MAX" variable and perform calculations on it.
From my understanding the "MAX" variable is a CloudCompare internal variable, that cannot be converted to a system variable to perform calculations on.
Is there a workaround to set the "MAX" and "MIN" values adaptively (e.g. always from 95% to 100%)?
Re: Calculations in the CLI
Posted: Tue Feb 20, 2024 7:31 am
by daniel
CloudCompare does understand 'MAX' (it's in its code). The issue here is really that your batch process is not replacing "$MAX*0.99" by a numerical value.
CloudCompare literally receives "$MAX*0.99" instead of a numerical value (hence the error message).
Re: Calculations in the CLI
Posted: Tue Feb 20, 2024 7:53 am
by HeadLess
I looked at it yesterday.
-FILTER_SF only accept doubles or exactly MIN or MAX string. so computation is not possible.
Then i was looking for a workaround but SF_OP does not accept MIN/MAX as values
i was trying to do a normalized SF so you can just drop points below a known number. But that is still not possible. but this is i think the easiest to implement in CC.
something like this, -SF_OP 0 DIV MAX -FILTER_SF 0.95 MAX this could work i think with minimal changes in CC.
Re: Calculations in the CLI
Posted: Wed Feb 21, 2024 10:42 am
by HeadLess
I created a quick PR to make this possible so the given command_file would work, if it gets merged as is.
https://github.com/CloudCompare/CloudCompare/pull/1967
Code: Select all
-NO_TIMESTAMP
-AUTO_SAVE OFF
-O "cloud_with_sf"
-SF_OP 0 DIV MAX -NOT_IN_PLACE
-FILTER_SF 0.95 1
-RENAME_ENTITIES "filtered"
-SAVE_CLOUDS