フィルターのクリア

How to get the binary matrix of an image ?

5 ビュー (過去 30 日間)
Emily
Emily 2012 年 6 月 21 日
Dear all, I creat a 2-D network by method of fractal interpolation to simulate soil cracks. In my program ,plot(x,y) which plots the network , x,y stand for the points' corrdinate value. I want to compute this network's fractal dimension, but I can't get this image from the figure plotted. My quentions are how to get this image in jpg. or bmp.without white blank like the figure, and how to get the binary matrix of this figure. Thanks in advance.

採用された回答

Image Analyst
Image Analyst 2012 年 6 月 21 日
Emily, If you want an image of your cracks, first I'd create a blank image with zeros(). Then I'd go down through every x,y pair that you have using imline() to draw the line (crack) from one point to the next. Now you have your image with all your cracks on it, and you can use export_fig() to write it out to a standard format image file. This will give you just the image alone - no tick marks and titles etc.
However if you want a plot, rather than an image, I'd continue doing it the way you are and then use export_fig() to get the whole plot - including the title, x and y axis labels, tick marks, outer plot area bounding box, etc.
I don't really see how the image of the cracks is going to help you calculate the fractal dimension of the crack network though. I don't use fractals but I though the fractal dimension of a 2D image would look at all the pixel values of all the pixels to give a metric that is kind of related to the "roughness" of the image, but that wouldn't be appropriate to get the fractal dimension of a binary image of a crack network.
  3 件のコメント
Image Analyst
Image Analyst 2012 年 6 月 22 日
It doesn't really seem like an imaging problem, other than you could generate an image or a plot of the crack network, and I'm not a fractal expert so I'm going to bow out. I'm just going to suggest that you edit your post from "How to get the binary matrix of an image ?" to "Determine fractal dimension of network of cracks" so that some fractal experts might find it and help you. Of course they'll also want to see some kind of plot or image like I asked you for earlier so do that now.
Emily
Emily 2012 年 6 月 24 日
Thank you very much!

サインインしてコメントする。

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2012 年 6 月 21 日
getsnap() or getframe(); and then imwrite() or saveas() or print() or use the File Exchange contribution export_fig
You can set the axes background color to something other than white.
  10 件のコメント
Image Analyst
Image Analyst 2012 年 6 月 22 日
You're still not as clear as you'd be if you would just upload an image and describe what it is that you want. Mock up some lines on it using Photoshop or whatever to say what part you want to save. Try tinypic.com and pick the last link it give you.
Emily
Emily 2012 年 6 月 24 日
Thanks again!

サインインしてコメントする。


faraz.a
faraz.a 2013 年 5 月 25 日
please tell me how to create a matrix of zeroes and ones for black and white pixels of a binary image.
  1 件のコメント
Image Analyst
Image Analyst 2013 年 5 月 25 日
One way is to threshold a grayscale image
binaryImage = grayImage > thresholdValue;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFractals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by