# How to fit a 3D circular surface?

## Recommended Posts

Hi,

I have data from laser scan of a circular surface. I converted data to image and using circular edge detection to mask out the background. What I like to do next is to fit the surface then subtract my original data from it. I am not sure if there is any function I can use to fit specifically in the boundary of the object only. Please let me know what function that I should use.

Thanks you.

Edited by Thang Nguyen

##### Share on other sites

I am sorry, I was not clear but I mean a 3D scan of circular surface, not a circular fit.

##### Share on other sites

You might have to show us some pictures. It sounded like you had some edge detection which should give you points that make a circle on the edge of the cylinder. You can use a circle fit to get the radius which will give you an area. If you need, you can take an average inside the circle to get the height of the cylinder.

Edited by infinitenothing

##### Share on other sites

One of the issue is the surface can be tilt, so I cannot use the average value.

I also have the case the cylinder diameter is greater than the range of the laser scan which I need to do 2 scan. In this case, I have to fit two half circle before I can stitch them together. To generalize my question, I am looking for a method to fit a 3D surface with some certain shape.

##### Share on other sites

A tilted circle projects to an ellipse right?

http://zone.ni.com/reference/en-XX/help/370281M-01/imaqvision/imaq_fit_ellipse_2/

Not sure about the general solution but maybe something involving this solver

http://zone.ni.com/reference/en-XX/help/371361J-01/gmath/find_all_minima_nd/

##### Share on other sites

@ininitenothing: I would like to fit the plane not the boundary. Thanks.

##### Share on other sites

That makes sense. Let me throw out an idea:

So you're trying to find the coefficients in this formula: Z=a1x+a2y+C. You might be able to use this: http://zone.ni.com/reference/en-XX/help/371361H-01/gmath/general_ls_linear_fit/

Where Y is an array of all the pixel intensities and H is {x1,y1,c}, ...

You might want to use real world coordinates instead of pixel coordinates.

Edited by infinitenothing

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

×