Page 1 of 1

HELP -FPP /Structured Light: Slanted point cloud and "melted" edges on a stepped cylinder using linear phase-to-depth

Posted: Fri May 15, 2026 4:16 pm
by RP_FPP_CC
Hi everyone,

I’m working on a custom Fringe Projection Profilometry setup in MATLAB and need some advice on point cloud processing and leveling.

The Setup & Object:

Hardware: DSL with a ceiling-mounted projector hitting the object at a downward angle.

Object: A solid. It is a cylinder with sudden, sharp 90-degree drops in diameter and flat sections.

The Current Script (The Problem):
I am currently forcing the reconstruction using a basic linear approximation: True_3D = Delta_Phi * Z_Factor, followed by a standard [11 11] median filter and a 2.5 Gaussian blur to handle the phase noise and 8-bit quantization steps.

The Results (See attached images):

The Slant: The entire point cloud is tilted backward. I assume this is because the math assumes the camera sensor is perfectly parallel to the world Y-axis, but I don't have a reliable flat background to lock onto for a rigid body transformation ( MAYBE).

The "Melted" Edges: The sharp, sudden changes in the cylinder's diameter are completely ruined. Instead of a crisp 90-degree cliff, the object looks like melted plastic or a smooth ramp. Even the flat sections look warped.

My Questions:

Leveling: What is the best mathematical approach in MATLAB (or standard point cloud logic) to automatically find the central axis of a cylinder and align it perfectly to the Y-axis to fix the global slant?

Edge-Preserving Filters: What is the industry standard for denoising structured-light point clouds while strictly preserving sharp machined edges?

I’ve attached a photo of the raw "slanted" point cloud and the "melted" result.


Script_Current_one:

% --- 1. PHASE TO DEPTH CALCULATION (Linear Approximation) ---
Delta_Phi = U_Obj - U_Ref;
True_3D = Delta_Phi * Z_Factor;

% --- 2. NOISE FILTERING
True_3D = medfilt2(True_3D, [11 11], 'symmetric');
True_3D = imgaussfilt(True_3D, 2.5);

% Dynamic Modulation Mask
Smart_Mask = Mod_Obj > 0.03;
True_3D(~Smart_Mask) = NaN;

% Basic Floor Leveling & Clipping
floor_level = median(True_3D(:), 'omitnan');
True_3D = True_3D - floor_level;
True_3D(True_3D < 2) = NaN;
True_3D(True_3D > 250) = NaN;

% --- 3. POINT CLOUD GENERATION (
[rows, cols] = size(True_3D);
[X, Y] = meshgrid(1:cols, 1:rows);

% Using basic PPM (Pixels Per Millimeter)
X_mm = X / PPM;
Y_mm = Y / PPM;
valid = ~isnan(True_3D);

ptCloud_Raw = pointCloud([X_mm(valid), Y_mm(valid), True_3D(valid)]);

% --- 4. LEVELING ---
maxDistance = 3.0;
[model, inlierIndices] = pcfitplane(ptCloud_Raw, maxDistance);
normalVec = model.Normal;

if normalVec(3) < 0
normalVec = -normalVec;
end

% Rotate point cloud to align normal vector with Z-axis
targetVec = [0, 0, 1];
rotVec = vrrotvec(normalVec, targetVec);
R = vrrotvec2mat(rotVec);
tform = rigidtform3d(R, [0 0 0]);

ptCloud_Leveled = pctransform(ptCloud_Raw, tform);



IMAGES ATTACHED:

Image
Image
Image
Image

Any specific algorithm recommendations or MATLAB function suggestions would be a lifesaver. Thanks!

Re: HELP -FPP /Structured Light: Slanted point cloud and "melted" edges on a stepped cylinder using linear phase-to-dept

Posted: Sat May 16, 2026 4:53 pm
by daniel
Can you try to post the images again? (it's hard to understand what you are doing and what is the problem you are facing exactly)