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

  • Here or MinFilter[img, 2] – ciao Jul 29 '15 at 4:45
  • 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. – m_goldberg Jul 29 '15 at 4:53
  • mathematica.stackexchange.com/questions/3963/… That is how I make the diagram. – Z-Harlpet Jul 29 '15 at 5:04
  • @Ciao That is so useful. Thanks! – Z-Harlpet Jul 29 '15 at 5:09
  • 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. – 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]], 
   "Erosion[...,Disk[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

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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