This is a Voronoi Diagram. I really want to know how to change the thickness of the "wall" of each V-cell, in another words, the thickness of the edge in this diagram. Voronoi Cell for 500 random dots

  • $\begingroup$ Here or MinFilter[img, 2] $\endgroup$ – ciao Jul 29 '15 at 4:45
  • $\begingroup$ How did you make the diagram? I don't think you much chance of getting a useful response if you don't add the code you used to generate the diagram to your post. $\endgroup$ – m_goldberg Jul 29 '15 at 4:53
  • $\begingroup$ mathematica.stackexchange.com/questions/3963/… That is how I make the diagram. $\endgroup$ – Z-Harlpet Jul 29 '15 at 5:04
  • $\begingroup$ @Ciao That is so useful. Thanks! $\endgroup$ – Z-Harlpet Jul 29 '15 at 5:09
  • $\begingroup$ I vote to leave this question open for nikie's answer if nothing else. I hadn't realized the importance of using DiskMatrix in a case like this until now. $\endgroup$ – Mr.Wizard Jul 30 '15 at 7:02

Use Erosion[image, DiskMatrix[radius]]:

img = Import["http://i.stack.imgur.com/WVmnm.jpg"];
Erosion[img, DiskMatrix[2]]

enter image description here

Intuitively, you can imagine that this places a disk with radius 2 at every black pixel. If you're more concerned about speed than accuracy, you can also use Erosion[image, radius] which places a square with some radius at every black pixel - which of course makes diagonal lines thicker than horizontal or vertical lines:

circle = Image[
   Rasterize[Graphics[{Circle[]}, PlotRangePadding -> 0.5]], 
   ImageSize -> All];
Row[{Labeled[Erosion[circle, DiskMatrix[10]], 
  Labeled[Erosion[circle, 10], 
   "Erosion[..., 10] or MinFilter[..., 10]"]}]

enter image description here

Note: MinFilter seems to do mostly the same thing Erosion does, except it can only use rectangular masks. The differences between MinFilter and Erosion seem to be:

  • Erosion can use non-rectangular structuring elements (like Disk above)
  • MinFilter can process TimeSeries data
  • for color images Erosion processes each channel separately, while MinFilter replaces each pixel with the (r,g,b) value of the darkest pixel in the neighborhood.

(There may be more differences - I had to guess these these from the documentation. No idea why there is no mention in each function's "Properties and Relations" section. IMHO, MinFilter could have been implemented as Method option to Erosion instead of a new function.)


Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.