# LabVIEW

cancel
Showing results for
Did you mean:

## roughness

hi everyone

I am new to this forum and a beginner to labview development.

I have to make a VI that calculate roughness parameters (Ra, Rk, Rpk, Rvk) based on images of metalic pieces.

(see attached VI)

I did some researches on the net and i foud that i have to plot surface profil of my image

how can I get surface profil ?

what kind of filters do i have to use ?

Message 1 of 6
(3,940 Views)

## Re: roughness

Hi cloudinette,

you attached some text/csv files containing 2D arrays of numbers. How are they related to "images of metalic pieces"?

i foud that i have to plot surface profil of my image how can I get surface profil ?

Maybe the surface profile is given in those text files?

Maybe one row correlates with one line over the surface?

Can you answer those questions and explain the content of the text files?

(I can't open your VI as I only have LV2014 at hand.)

Once you got the profile values you can easily calculate those roughness values. Wikipedia provides all the formulas needed…

Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(3,931 Views)

## Re: roughness

first of all i'm sorry if I made english mistakes (i'm not a native english speaker)

I'm working with a camera (heliIspect H4 by heliotis) to scan metalic surfaces

the camera generate grayscale .tiff images with a depth of 32 per pixel. to handle those images, I had to convert them to text images via Image J to make it easy to display with labview. so every text file contains gray values of every pixel of image.

image resolution is 300 * 300

so my VI contains a sequence of the following actions :

- loading text file and converting array to image (Imaq array to image)

- making a line profil of image (Imaq line profil)

I want to use the output line profil to calculate roughness parameters

i'll check out wikipedia formulas

regards

Message 3 of 6
(3,901 Views)

## Re: roughness

Hi cloudinette,

so you already have your "images" available as a 2D array of values - why do you still need to convert it to IMAQ?

Just index a row (or column) and calculate your roughness values!

Or even better: have your LabVIEW VI calculate this for all rows/columns and even the full surface… 😄

(Maybe you need to scale from gray level to surface height. Where do you get that conversion info from?)

Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(3,896 Views)

## Re: roughness

Hi,

I am in internship, the compagny wants it to be visual : drawing line on image == > obtaining surface profile + all roughness parameters.

you are right I need to scale from gray levels to height, I think the camera attributes include such information

Regards

Message 5 of 6
(3,865 Views)

## Re: roughness

OK, I think I see what you are trying to do.  You want the user to be able to select a rectangular region of interest and then draw their own line on the image to get a profile.  Is that correct?  I agree with Gerd, it could be more useful once a rectangular area of interest is selected, you could evaluate the roughness of the whole region, either using 1D metrics (like Ra) rastered over the surface or 2D metrics (like Sa) to evaluate the whole surface in one step.

I'll start with the simplest thing first though.  The code could be cleaned up quite a bit, but up to the point that you extract a line profile everything works.  Their are some problems with your roughness analysis, though.  I have experience here, so I can give you some starting advice.  Before calculating a roughness metric, it is common to filter the data to a range of wavelengths of interest.  This is typically accomplished using a Gaussian filter.  I'll set that aside for now; it is a big topic.  At the very least, you will need to subtract a baseline.  To do this, you can do a simple line fit to the data and then subtract the line fit from the profile.  This will give a roughness profile centered around zero.  Then, to calculate Ra, you would simply take the absolute value and average the numbers.

The other important thing you're missing is scaling.  Your "camera" (actually an interferometric 3D Profilometer) is outputting gray scale levels that should linearly correlate to height values.  You will need to scale your values to get the correct units and for this will need the scaling values.

Just curious, I noticed the heliInspect H4 comes with its own analysis software.  What are you trying to accomplish that it doesn't already do?  Also, it comes with a LabVIEW API as well.  Are you using it?  It may make it easier to get images directly from the instrument into LabVIEW without having to go through the text files.

Good luck!

Message 6 of 6
(3,654 Views)