I am trying to create a script (having very little knowledge of grasshopper) with a photogrammetry scan. Based off of the RGB values of each point I want to 1. group them and 2. modify and change their colours.
If someone could help with the script or point me in the direction of where to look that would be amazing!
Whoa! 18.2 MB!! I can open the file in Rhino and see that the tree (sideways) is 1 point cloud with one million points when exploded!!! But donât know how to access those colors in Grasshopper? LookingâŚ
I spent way too much time struggling with Rhino APIs and Python and not enough time on Google.
So I have code now that outputs all points and their colors. Trying to do something useful with it but a million points is a HUGE data set. Have you got something smaller we can play with until this works?
I didnât know a text panel could hold a million colors.
P.S. Can you please elaborate on how to group the colors? Do you want to âround offâ colors to ranges of 25 red, 25 green and 25 blue values?
Iâm still refining what I have and would like clarification from you before I post the code.
For each point, Iâm splitting the colors into RGB values and sorting them, using the highest R, G or B value to categorize them. By this method I count 544618 blue points, 406564 green points and 48974 red points. (see third image below)
Then I have a slider (5 to 30) that divides 255 (the max value of RGB) into ranges (domains) for rounding off color values, effectively reducing the number of colors.
Itâs slow for a million points; Sort and Find Domain take 1.7 minutes each for 3 million values (one million points times three color values each).
Iâm using Custom Preview to re-color the points instead of modifying the point cloud in Python, which is also somewhat slow and perhaps alters the results?
Well, there are all kinds of games that can be played with colors, but as I like to say, this is your art project. Iâll post the code I have, knowing there are more ideas to explore. You need to right-click the Cloud_ID component (cyan group) and then click the point cloud in Rhino.
The purple group at the top limits the points used unless you choose âAllâ in the blue group FILTER. WARNING!! âAllâ is slow!
That table doesnât have many colors and will fall over with only two legs?
I forgot to mention that the disabled Preview component on the right, connected to the three color swatch components⌠well, itâs difficult to explain and I wanted to fix that before posting but⌠The sequence of colors depends on the point cloud, as indicated in the text panel above it showing the count for each color. The table shows this:
Color: R = 324888
Color: B = 1125
Color: G = 631
So the colors need to be connected to Entwine in that same sequence: RBG (God bless her soul), not BGR. Crude, I know, but itâs bed time for me.
This code is a first draft, many things could be changed.
P.S. The points displayed by Custom Preview are definitely and obviously larger than the points in the point cloud, so any color games should modify the point cloud via Python. Which might get weird, modifying the source data unless a copy is made? I know nothing about point clouds.
Hi @TTS
When using Volvox, you can import a smaller subset of the point cloud to make working with the cloud faster until you need all the points. Volvox also lets you extract the colors by deconstructing the cloud with DeCloud component. Once you have the colors, you can tint them all at once (C# component uses GH_GraphicsUtil.BlendColour).
I moved the points an arbitrary 5 units in both X and Y so the new point cloud doesnât overlap the original.
I canât replicate that observation this morning.
I replaced the Cloud_ID component (cyan group) with a command line prompt:
The only clue that you have selected a point cloud is the prompt disappears. Terrible UI because there is a long wait before anything else happens. Be patient. I added an âOnOffâ switch to the getPtCloud component (the original Python) so toggling that switch (off then on again) will re-display the prompt to âSelect a point cloud:â
I disabled most of the white group because it was slow and not required for the yellow group. point_cloud_2022Oct23a.gh (27.3 KB)
I donât know if this is off topic but âŚ
Have you tried using âCloudcompareâ , it is free software that is very good at classifying pointclouds.
It should be able to do a colour separation.
I use it for processing LIDAR landscape data.
I have worked with point clouds up to 30Gig, it is very powerful.
Mike.
This version has cosmetic changes that donât address your primary goals (above) but might be general purpose enough to be useful for other GH projects.
The pink group at the top-right uses Galapogos to find a minimum bounding box for the point cloud. When the solver is done, click the Data Dam to pass the results downstream. As always, Data Dam leaks on startup, meaning it passes data without being clicked.
The teal-colored group below it uses the minimal bounding box to orient the point cloud vertically at the origin.
Fixed the color issue in the disabled white group. No need to manually reconnect color swatches.
INSTRUCTIONS
Select Point Cloud (then wait patiently)
Start Galapogas Solver (wait patiently)
When Galapogos is done, click Data Dam (again, wait patiently)
getPtCloud takes ~18 seconds for both the table and the tree, according to the profiler. FDom(Find Domain) in the yellow group takes 1.9 minutes for the tree, 32 secs. for the table. Sort in the white group takes 1.8 minutes for the tree. It is disabled by default.
I see nothing proprietary in anything posted on this thread. You havenât posted any code at all and are free to remove the two E57 pointcloud files from your posts. There are plenty of other examples that anyone is free to use instead:
Incredible answers honestly have seen few people go to such an extent! I am trying to solve a similar issue but maybe I donât need to. Hereâs my problem:
I have site scans that come in as both meshes with textures and coloured point clouds, these site scans I want to be able to designate materials for acoustic analysis using Pachyderm which requires material qualities for analysis ( Pachyderm Acoustical Simulation | Food4Rhino ). I want to break these meshes up into components based off of the colours provided by the point cloud as an approximation of the materials present in the scene and then assign those components to materials in Pachyderm.
I figured as the only data beyond positional present is colour data, and finding a way to analyze the colors present in mesh textures I assume is more complicated, that this would be the best workflow. Is there a way to select mesh faces based off of corresponding pointcloud points? If not would it be better to reform the mesh from the pointcloud and assign values that way? Let me know what you think! Iâve been looking at volvox and cockroach as possible aids in this solution for point cloud analysis and editing.