From: Lars-Göran Nord on
"Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <i31nu0$b2l$1(a)fred.mathworks.com>...
> Lars:
> Well we're getting a little more info, bit by bit. It seems you are looking at cracks in something (rather than metal grains). Maybe Sean can help you, expecially if you're also dealing with cracks in concrete.
>
> The image you posted does have breaks. But it also has background so it looks like you saved the figure and uploaded it rather than saved the actual image - hence the background padding and breaks.
>
> Perhaps the next bit of information you could supply would be the actual binary image (not the saved image of it displayed in a figure), the original grayscale image from which you derived the binary image, and the code you used to derive the binary image.
>
> There is an option in bwmorph() that can find branchpoints in the skeleton. You will want to use that to count the number of crack intersections.
>
> To get crack width, you will not want to skeletonize the cracks, which of course just reduces all binary cracks down to a single pixel width. You'll want to measure the original, un-skeletonized binary image.
>
> Please don't start replying right after a > symbol of the prior post - that will just end up adding your message onto the prior one, so for example, Google will collapse all your text into the prior message since it thinks it's part of the same message, and I don't see it unless I expand it.


>well all very good comments I will try to shape up.
and my lines are a crack patter from thermal fatigue in steel.
Sorry about the fatal mistake regarding the images, I was in PhotoShop "world" when saving them.
I will also supply the original image, this image is a fake one made in PhotoShop at 9 pixels width. I still don't have any good real one for testing.
I made the skeleton just to try to get the length, area will be taken from original image, but I might be wrong in this way of treating the image.
images will be uploaded tomorrow.
From: Lars-Göran Nord on
"Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <i31nu0$b2l$1(a)fred.mathworks.com>...
> Lars:
> Well we're getting a little more info, bit by bit. It seems you are looking at cracks in something (rather than metal grains). Maybe Sean can help you, expecially if you're also dealing with cracks in concrete.
>
> The image you posted does have breaks. But it also has background so it looks like you saved the figure and uploaded it rather than saved the actual image - hence the background padding and breaks.
>
> Perhaps the next bit of information you could supply would be the actual binary image (not the saved image of it displayed in a figure), the original grayscale image from which you derived the binary image, and the code you used to derive the binary image.
>
> There is an option in bwmorph() that can find branchpoints in the skeleton. You will want to use that to count the number of crack intersections.
>
> To get crack width, you will not want to skeletonize the cracks, which of course just reduces all binary cracks down to a single pixel width. You'll want to measure the original, un-skeletonized binary image.
>
> Please don't start replying right after a > symbol of the prior post - that will just end up adding your message onto the prior one, so for example, Google will collapse all your text into the prior message since it thinks it's part of the same message, and I don't see it unless I expand it.


>Is this way OK to answer?
>
>Images are now uploaded one tif that I did in photoshop so its not a real image of the cracks but quite close. For the skeletton I used bw3 = bwmorph(bw2, 'thin', inf);
>
>I hope this will help us both:-)
>
>Thanks for your interest.
From: Lars-Göran Nord on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i2vlar$2g2$1(a)canopus.cc.umanitoba.ca>...
> Lars-Göran Nord wrote:
> > "Lars-Göran Nord" <lars-goran.nordh(a)uddeholm.se> wrote in message
> > <i2vg70$mm4$1(a)fred.mathworks.com>...
> >> ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message
> >> For example
> >> > 0 1
> >> > 1 1
> >> > Is the area of this 3? Or is it sqrt(2)? Or something different?
>
> > I have say I was wrong, 3 is right.
>
> Area of a triangle is 1/2 * base * height.
>
> If we interpret the base and height here to each be 2, then we would have
> 1/2 * 2 * 2 which would be an area of 2.
>
> If we interpret the 1's as marking pixel centers, then the base and height
> would each be 1, leading to an area of 1/2 .
>
>
> With regard to the length of the lines:
>
> Unfortunately at that resolution I cannot see how "smooth" the lines are.
> Would it be acceptable to approximate the length as if each line segment is
> convex when viewed from one of its sides? If you do not have to deal with
> zig-zags and figuring out the micro-level length, then I think it would likely

>Hi Walter,

> Finally some "good" pictures are uploaded

>Thanks
Lars
> be _relatively_ easy to find piecewise straight-line approximations based upon
> tangents to the curve that are extended to some tolerance from the actual line.
From: Lars-Göran Nord on
"Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i2vk8c$7vp$1(a)fred.mathworks.com>...
> "Lars-Göran Nord" <lars-goran.nordh(a)uddeholm.se> wrote in message <i2vfo0$mtp$1(a)fred.mathworks.com>...
> > "Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i2vah4$gtb$1(a)fred.mathworks.com>...
> > > "Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message =
> > > > If you just use
> > > sum()
> > > as I mentioned above it will give you an over estimate but depending on your application that may not be a bad thing. What are these lines measuring and what are you doing with the results?
> > > >
> > > > -Sean
> > > Typo, that sum() was kind of important to that sentence meaning anything.
> >
> > Very good comments, first of all the lines are measuring crack lengt (thermal fatigue of steel) and when I have the length of the one pixel lines (cracks) I will calculate an average crack width by dividing the total crack area from the original image with the length of cracks.
> > From the start I had an idea of finding pixels connected corner by corner and giving them the value sqrt(2) and all others connected face to face 1. I don't follow your 3*sqrt(2).
>
> First off, the 3*sqrt(2) was a typo; I meant just sqrt(2). (My typing has been failing me today, fortunately weekend is here!)
>
> For calculating the area of the crack just summing the pixels of the skeleton will probably give you an accurate enough length. The crack isn't a geometric surface and thus trying to fit a triangulated surface is probably no more accurate than a pixel face one. Also, since you're using total area in pixels as your area it would make sense to me to not triangulate the line and then pollute that measurement with pixel area. I.e. you would want triangulated perimeter of the outside of the crack to stay consistent.
>
> Those are just a few thoughts. We do a lot of work with crack propagation in concrete x-cmt images and that's usually what we use.
>
> Have a great weekend; hopefully you can get away from this!

>Had a great weekend at my summerhouse.

>I now have some good pictures uploaded. I made the skeletton just to try to find the crack length that way, a real image will look almost like the cr1.tif but that one is actually a fake made in photoshop (dont have any good real one yet) but thickness of cracks will be uneven in real life. Thats why I want to measure the length of that one pixel line and then get area from the "real" one and mean crack width like this (area/length).
>
>Your way might be a better one, but I dont quite follow you Sean!
>
>Thank you,
Lars
From: ImageAnalyst on
On Aug 1, 4:58 pm, "Lars-Göran Nord" <lars-goran.no...(a)uddeholm.se>
wrote:
> >Is this way OK to answer?
>
> >Images are now uploaded one tif that I did in photoshop so its not a real image of the cracks but quite close. For the skeletton I used  bw3 = bwmorph(bw2, 'thin', inf);
>
> >I hope this will help us both:-)
>
> >Thanks for your interest.
--------------------------------------------------------------------------
At least you're replying to the proper response so that's good, but
you're responses still have a > in front of them so they are being
considered part of the prior reply and don't show up - they're
collapsed.

Anyway, I did download your image and do a little bit. Your cracks
are pretty thin - 1.24 pixels wide. Here is the code I used:
IMPORTANT: YOU WILL HAVE TO JOIN ANY LINES THAT THE NEWS READER SPLITS
INTO TWO.
I summed the skeleton to get the total cracks length. Then I divided
the area by that to get the average width:


clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
% Change the current folder to the folder of this m-file.
% (The line of code below is from Brett Shoelson of The Mathworks.)
if(~isdeployed)
cd(fileparts(which(mfilename)));
end

% Read in a standard MATLAB gray scale demo image.
folder = 'C:\Documents and Settings\username\My Documents\Temporary
stuff';
baseFileName = 'cr1.tif';
fullFileName = fullfile(folder, baseFileName);
grayImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 1.
[rows columns numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
% Convert to gray scale
grayImage = rgb2gray(grayImage);
end
% Display the original gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full
screen.

binaryImage = grayImage < 100;
% Display the binary image.
subplot(2, 2, 2);
imshow(binaryImage, []);
title('Binarized Image', 'FontSize', fontSize);
binaryArea = sum(binaryImage(:))

skel = bwmorph(binaryImage, 'skel');
% Display the skeletonized image.
subplot(2, 2, 3);
imshow(skel, []);
title('Skeletonized Image', 'FontSize', fontSize);

% Calculate the length of all the cracks.
skelArea = sum(skel(:))

% Divide the area by the length to get the average width.
crackWidth = binaryArea / skelArea;

message = sprintf('Done!\nThe area of the cracks is %d\nThe length of
the cracks is %d\nThe average width of the cracks is %.2f', ...
binaryArea, skelArea, crackWidth);
uiwait(msgbox(message));



First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10
Prev: Find word in string
Next: starn matlab with crontab