필터 지우기
필터 지우기

Create a mask of irregular pore-like shapes

조회 수: 1 (최근 30일)
Geert
Geert 2013년 10월 14일
댓글: Image Analyst 2017년 5월 16일
I would love to have an automatic way of creating random masks consisting of irregular shapes which resemble pores in some kind of material. With a mask, I mean an image with pixels of value 1 where the shapes are present and pixels of value 0 where no shapes are present. As an example, consider the following mask (create in MS Paint with manual labor :-)): Pore-like irregular shaped mask Ideally, the code should have the following parameters:
  • average size of pores
  • number of pores
  • some irregularity parameter, high = highly irregular, low = more circular shaped
I did some attempts myself, but haven't found anything satisfying so far. The following example creates a mask that's to "regular" in my opinion:
figure();
imshow(imdilate(imerode(1-(randn(100,100)>0),strel('disk',1)),strel('disk',1)),[]);
  댓글 수: 3
Ottavia Rossini
Ottavia Rossini 2017년 5월 16일
hey, did you manage to solve your problem? I have a similar task and can't really find an answer. Thanks
Image Analyst
Image Analyst 2017년 5월 16일
Did you try the voronoi() function like I suggested in my answer?
x = gallery('uniformdata',[1 10],0);
y = gallery('uniformdata',[1 10],1);
voronoi(x,y)

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2013년 10월 14일
You could try Voronoi, but that would probably be too regular also. So then I'd suggest you look into creating an image of Perlin Noise. It's used in computer graphics and the movie industry to create a huge variety or textures, terrains, and surfaces. Getting the right one and thresholding would probably work.
See my clouds demo attached below for another way. It's based on the oft-referenced Prof. Peter Kovesi's MATLAB code.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by