Is there a documentation about how to develop my own plugin?

For any question about plugins!
hannes438
Posts: 1
Joined: Mon Apr 21, 2014 6:16 pm

Is there a documentation about how to develop my own plugin?

Post by hannes438 »

Dear all,

is there some documentation describing the process of how to develop my own (standard) plugin?
I would like to start with a simple file fusing multiple scans given scan data and a camera trajectory into one point cloud.

Thank you very much!

Best
daniel
Site Admin
Posts: 7458
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is there a documentation about how to develop my own plu

Post by daniel »

You can look at the dedicated document in the root directory of the project

Code: Select all

https://github.com/cloudcompare/trunk/blob/master/designing_a_new_qCC_plugin.rtf
I believe it has been updated recently. There's a fake project (qDummyPlugin) in the 'plugins' directory that you can duplicate and then edit (look at the code, there's a lot of directions in the comments). And last but not least, the best sources of information are the other plugins!

And of course don't hesitate to ask for more information here (or directly by email: cloudcompare [at] danielgm.net).
Daniel, CloudCompare admin
RobH616
Posts: 19
Joined: Tue Sep 23, 2014 11:25 am

Re: Is there a documentation about how to develop my own plu

Post by RobH616 »

Dear WhoEverCanHelp

*Disclaimer : Have had experience with programming in C++ but I'm new to all things CloudCompare, may say something dumb *

Soon I will start to learn how to create my own plugins for CC and I would like to know a little about the scope of what a plugin is capable of doing. For example, to start with I woul like to create a plugin that reads in two files as an input, a point cloud and a 3D mesh model and utilizes other options in CC so that with the touch of a button it will:

(1) Rough allignment and Match the box centers, then
(2) fine allignment with a specific number fo iterations / or error etc.
(3) Compute cloud 2 mesh distances with a specific min and max distance, octree level etc.
(4) produce colour map with specific (or user defined at input stage) colour scheme etc.
(5) export the resulting colour map with PC and 3D model as CC binaries.
(6) Maybe take screenshot of the colour map from a number of different angles and create a pdf or equivilant with these screenshot.

To easily tell the user how the scan compares to design with a couple of ticks of a button.

Is this possible ?

Hannes (or any other new developer), what was the most useful source of information when you started to develop CC plugins?

Thank you very much

Best Regards
daniel
Site Admin
Posts: 7458
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is there a documentation about how to develop my own plu

Post by daniel »

Hi and welcome!

Well, you should definitely be able to do all this:
0) To read the data, it's easier to let CC loads them then the user just have to select the right data and launch the plugin. But you can use the qCC_io library to load the files directly on the plugin side.
1) Matching the box centers if very easy. And regarding 'rough alignment' it all depends on what you are thinking about ;)
2) the CCLib::ICPRegistrationTools class should be sufficient for this
3) the CCLib::DistanceComputationTools class is meant for this
4) you can programmatically define your own color ramps and associate them to a scalar field
5) Easy (use the qCC_io library again)
6) You can programmatically set the camera position of a 3D view. Then you can either use CC's default view(s) or create your own view in your plugin. You can also grab each 'view' as an image. But for pdf generation, you'll have to use a third party library.

If the process is very well defined, it shouldn't be too difficult to do all this (the 6th point might be the trickiest especially if you want to handle your own 3D view, export a pdf, etc.). And if you need to display a dialog, it's better to know how Qt works.

The easiest way to design a plugin is definitely to copy an existing one. In your case qSRA resembles the most to what you are trying to achieve, but it's a bit complicated. So you should start to copy a much simpler one (such as qHPR or qPoissonRecon for instance) and pick what you need in qSRA (if necessary).

I'll gladly help you in this process... if the plugin is meant to be publicly distributed (and hosted on github typically). Otherwise I can still answer questions but I may be less "patient" ;)
Daniel, CloudCompare admin
RobH616
Posts: 19
Joined: Tue Sep 23, 2014 11:25 am

Re: Is there a documentation about how to develop my own plu

Post by RobH616 »

HI Daniel,

Thank you for your quick response. I will definitely take you up on your offer when I get around to starting... Not entirely sure when that will be though.

Many Thanks
RobH616
Posts: 19
Joined: Tue Sep 23, 2014 11:25 am

Re: Is there a documentation about how to develop my own plu

Post by RobH616 »

Hi Daniel,

(Apologies in advance for the lengthy comment ! )

I'm still getting to grips with the various functions of CloudCompare (v2.5.5.2), I'll try to explain my questions in words as much as I can for now but I can upload some screenshots later if you require.

I have point clouds of a variety of objects and I want to compare these to the 3D models that I have avalible in .obj or .fbx format. When these designs are read in by Cloud Compare they are read as a mesh object. In these designs each part of the object is added separtely, for example if the object is a steel-bar cage then each bar of the cage is cloud compare is a separte mesh. It appears that you can only register and calculate distances between 2 pointclouds, or 1 pointcloud and 1 mesh. If I try to select the whole steel-bar cage which consists of about 6 different bar's (mesh's) the fine-registration and the "compute cloud/mesh distances" tool are greyed out.

I see that there is an object type called "sub-mesh" as in some of the designs (mainly the ones I have in .obj format) have the whole cage object as a mesh and each bar as a sub-mesh. In this case you can select the cage mesh object and the pointcloud and compare those and I'm assuming it's comparing the pointcloud to the combination of all sub-mesh's (which is what I want).

Is there a tool in cloudcompare that allows me to select a set of mesh's and re-define these as a set of sub-mesh's of an overall mesh ?

I tried to get around this by selecting all the bar mesh's and sampling points on each mesh to create a set of point clouds which I then merged together and compared this to the point cloud from the scan. There were two problems with this:

(1) point clouds were made of each bar before I merged these together. This means that points were sampled on the faces of the bar's that would be touching, therefore there is a fairly large number of points in the merged pointcloud that the scan won't be able to see even if I scanned the cage from all angles.
---- Is there a way to remove these points on touching faces ? that I could maybe write into my plugin ( fyi : The "vertices" of the bar's do overlap )
This might not be a huge problem because the number of points on touching surfaces will be small compared to the number of points on the 'visible' surface.

(2) When you're comparing point clouds to mesh's and compute the distances, the output displays both positive and negative distances for the discrepancy between the cloud and the mesh. I'm assuming because this is a closed mesh then you can define +ve distances as the points being above the surface and -ve as being below/inside the mesh surface. However, when you compare cloud2cloud only scalar distances are computed.
---- Would it be possible to add (as part of may plugin), the ability to define a +ve and -ve distance between cloud2cloud based on the normal vector of the points on the reference cloud ? ( i.e if the distance between the compared cloud point to the reference cloud point is in the same direction as the normal of the reference cloud point then define this distance as +ve )

Thank you for your help with this, I'm sure I will have more questions soon :).

Best Regards,
Rob
daniel
Site Admin
Posts: 7458
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is there a documentation about how to develop my own plu

Post by daniel »

Hi,

I perfectly understand your need and the issues you encountered.

The OBJ files are indeed the only way for now to import what was formerly called a ''mesh group' (and now a standard mesh with 'sub-meshes'). The other formats either don't have the concept of 'parts", or they have either no explicit hierarchical relations or on the contrary to complex ones (this is the case of FBX - moreover FBX support is pretty new and not necessarily well finished).

Otherwise you are right, you can't compute signed distances by default with point clouds as we miss the information of what is 'inside' and what is 'outside'.

The best solution for you would be indeed to merge a set of meshes as one unique mesh (optionally with sub-meshes or not - this has no influence when computing distances but it may have for other processes). And this is something that is quite simple in fact (I just never had the use for it!). I'll integrate this asap. In effect I'll probably use the actual 'Edit > Merge' method, but extending it to the case of meshes.

I'll keep you updated when it's done.
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7458
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is there a documentation about how to develop my own plu

Post by daniel »

It's done, you can test the new version of the 'Merge' method:
(edit: link removed)

I hadn't the time to test it thoroughly so don't hesitate to give me some feedback.
Daniel, CloudCompare admin
RobH616
Posts: 19
Joined: Tue Sep 23, 2014 11:25 am

Re: Is there a documentation about how to develop my own plu

Post by RobH616 »

Wow, thank you very much !

I will test this soon and give feed back.

Highest Regards.
RobH616
Posts: 19
Joined: Tue Sep 23, 2014 11:25 am

Re: Is there a documentation about how to develop my own plu

Post by RobH616 »

Hi Daniel,

In general the merged meshing tool works brilliantly! thank you very much. There's one or two small problem that I've found so far while I tested this merging tool on a .fbx object. After importing the object and selecting a set of mesh's, the tool successfully clones all mesh's and merges these together.

However, If you then click the merged mesh and use the translate tool to move this away from the original's and click the green tick to accept translation, the merged mesh is moved correctly, but the yellow box drawn around the mesh has extended to fit around where the mesh is now and where it once was as well.

This is not a big problem as if you save the merged mesh as a .stl file then open it. The translate tool works correctly.

The only other problem I've found is that CC will crash if you try and save the merged mesh as a .fbx or .bin file. I realize that you said in a previous comment that .fbx format doesn't understand the consept of sub-mesh's so that probably why this isn't working but I thought I'd mention that instead of throwing an error, it cashes. Don't really know why the .bin would crash though, possibly for the same reason ?

I'm sure I'll post again soon.

Many Thanks !
Rob
Post Reply