Create line of pixels on an image

3 visualizaciones (últimos 30 días)
David Harra
David Harra el 14 de Sept. de 2022
Comentada: Image Analyst el 15 de Sept. de 2022
I am trying to achieve the Two Point Correlation function for a distribution of grain sizes.
As a practice example, I have generated mimic grain diagram using voronoi.
x = rand([1 100]);
y = rand([1 100]);
voronoi(x,y)
What I am now trying to achieve is to pick a line across the bulk of the image and have this line made of say around 1000 pixels. Each pair of pixels will be separated by some distance 'r'. Then I would then like to know how many pixels belong to each grain. (Different grains will have different pixel values.)
I have researched using the line command amongst other things but I can't get anything close to what I need. Any help would be appreciated.
Thanks

Respuesta aceptada

Image Analyst
Image Analyst el 14 de Sept. de 2022
Does the orientation of the line matter? I think not. So why don't you just scan down the image line by line. To find out how many pixels are in each grain intensity you can take the histogram. Of course if you scan down the entire image that will just give you the histogram of the entire image. Not really sure what you're after. Do you just want to know the area fraction of a certain grain type? Not sure what you mean by having pixels separated "r" from the line. Wouldn't that just mean you have two lines? Is that because you're trying to determine the likelihood of one grain type being adjacent to another grain type?
  2 comentarios
David Harra
David Harra el 14 de Sept. de 2022
So my end goal is the Two Point Correlation function but this is the main part I am trying to acgieve. This function is a probability distribution of the distribution of grain sizes.
For example
you can randomly choose 1 million pairs of pixels, each pair has a distance of a given value ‘r’ , into this image, and count the number of pairs that are in the same grains. So we would need to generate a random number of points using the randi function - I just can't seem to get it to work.
Apologies if my explanation is vague, its the best I can explain it
Image Analyst
Image Analyst el 15 de Sept. de 2022
That sounds like what they did in the old days, like 50 years ago before they had computers and had to do stuff manually using sterological techniques.
These days we have computers and we can simply operate on every single pixel in the image. We don't need to take random samples anymore.
Since you seem to know what grain is where (you would have to in order to do what you were planning), you must already have labeled your image. So in that case, simply take the histogram of the labeled image to give the relative frequency of grain pixels. You can also do particle sizing on it if you want to get a distribution of areas of individual grains.
props = regionprops(labeledImage, 'Area');
allAreas = sort([props.Area]);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Image Processing Toolbox en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by