Help regarding Image Segmentation of B/W Image!!
Mostrar comentarios más antiguos
Hello! I am working on a project titled 'Yarn Hairiness determination using Image Processing'. The steps involved are- Image processing and Image analysis. In the processing, I converted the image to B/W. After that I am suppose to segment the core yarn from the its protruding fibres. I am stuck here. I have attached the the picture below. It would be a big help!
5 comentarios
Image Analyst
el 14 de Mzo. de 2015
Editada: Image Analyst
el 14 de Mzo. de 2015
Please attach the image so we can help you. Maybe you forgot to click "Attach file" after you browsed to the image??? Better yet, just use the brown and green frame icon to insert the image into the body of your message.
Samkit Mutta
el 20 de Mzo. de 2015
Samkit Mutta
el 20 de Mzo. de 2015
Image Analyst
el 20 de Mzo. de 2015
Yes, they do look different: different color, different fiber composition, different amounts of fray, different thread diameter, etc. Exactly what do you want to characterize in the two images?
Samkit Mutta
el 23 de Mzo. de 2015
Respuesta aceptada
Más respuestas (3)
Meghana Dinesh
el 20 de Mzo. de 2015
0 votos
Try using the Morphological operators dilation and erosion.
4 comentarios
Samkit Mutta
el 23 de Mzo. de 2015
Meghana Dinesh
el 27 de Mzo. de 2015
Maybe you can use spur and then subtract the Images (before and after spur) and improve on this to get your second requirement.
Samkit Mutta
el 27 de Mzo. de 2015
Samkit Mutta
el 29 de Mzo. de 2015
Image Analyst
el 23 de Mzo. de 2015
0 votos
Simply try thresholding. See my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 You might also like my demo for how to extract the largest blob, attached.
Samkit Mutta
el 19 de Abr. de 2015
0 votos
26 comentarios
Image Analyst
el 19 de Abr. de 2015
That's the way MATLAB works. If you run a script, you put variables into the base workspace. Each function has it's own private workspace that comes into existence when you enter the function and goes away when you leave the functions. I'm sure you've heard of "garbage collection" in java. So to see any variables in a function, you have to set a breakpoint in that function. The reason I did a function instead of a script was that I could then put all the functions in the same m-file. You can't have a script followed by a function in the same m-file so if I had a script, I would have to have had at least two m-files, not one.
Samkit Mutta
el 19 de Abr. de 2015
Image Analyst
el 19 de Abr. de 2015
Put this line of code into your code:
workspace; % Make sure the workspace panel is showing.
Samkit Mutta
el 19 de Abr. de 2015
Image Analyst
el 19 de Abr. de 2015
Then why do you say the workspace does not show up? Put a breakpoint on that line of code and see if the workspace panel shows up when you execute the line of code. And if it does, step through the code to see when the workspace panel vanishes. Of course if you step out of a function, the workspace panel will now show the parent routine's variables, but the panel should still be there.
Samkit Mutta
el 20 de Abr. de 2015
Image Analyst
el 20 de Abr. de 2015
Are you sure you don't have a "clear" or "clear all" or "clearvars" in there somewhere?
Samkit Mutta
el 20 de Abr. de 2015
Image Analyst
el 21 de Abr. de 2015
I don't have that problem. I set a breakpoint there and, and you can see in the screen capture below, you can clearly see the workspace panel on the left with the variables showing up inside it. If you don't see that, call the Mathworks.

Samkit Mutta
el 21 de Abr. de 2015
Image Analyst
el 21 de Abr. de 2015
I did not set any breakpoints. I just let the code run uninterrupted. So the workspaces popped into being while the function was being executed, and vanished when the functions exited, just like they're supposed to. You can't see the workspaces while the function is executing with no breakpoints - it simply doesn't need to display them because it doesn't need to since there's no way you could examine them anyway. You can only see and examine the workspace variables when you have set a breakpoint and stopped at it.
Samkit Mutta
el 21 de Abr. de 2015
Samkit Mutta
el 21 de Abr. de 2015
Image Analyst
el 21 de Abr. de 2015
What is the favor or question?
Samkit Mutta
el 22 de Abr. de 2015
Image Analyst
el 22 de Abr. de 2015
Here's a snippet on inputdlg():
% Ask user for two floating point numbers.
defaultValue = {'45', '67'};
titleBar = 'Enter a value';
userPrompt = {'Enter number 1 : ', 'Enter number 2: '};
caUserInput = inputdlg(userPrompt, titleBar, 1, defaultValue);
if isempty(caUserInput),return,end; % Bail out if they clicked Cancel.
% Convert to floating point from string.
usersValue1 = str2double(caUserInput{1})
usersValue2 = str2double(caUserInput{2})
% Check for a valid integer.
if isnan(usersValue1)
% They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
usersValue = defaultValue;
message = sprintf('I said it had to be a number.\nI will use %f and continue.', usersValue1);
uiwait(warndlg(message));
end
and I'm sure you know how to use and "if" statement to compare numbers.
Samkit Mutta
el 23 de Abr. de 2015
Samkit Mutta
el 23 de Abr. de 2015
Editada: Samkit Mutta
el 23 de Abr. de 2015
Image Analyst
el 23 de Abr. de 2015
Try this:
hairareaindex = .5; % The ACTUAL hair index.
% Ask user for hte acceptable value.
prompt={'Enter the acceptable Hair Area Index'};
dlg_title='Input';
userResponse = inputdlg(prompt,dlg_title)
acceptableHairIndex = str2double(cell2mat(userResponse))
if acceptableHairIndex <= hairareaindex
message = sprintf('The actual hair index of %f is above the acceptable value of %f, so this yarn IS Acceptable',...
hairareaindex, acceptableHairIndex);
uiwait(msgbox(message));
else
message = sprintf('The actual hair index of %f is below the acceptable value of %f, so this yarn IS NOT Acceptable',...
hairareaindex, acceptableHairIndex);
uiwait(warndlg(message));
end
Samkit Mutta
el 27 de Abr. de 2015
Samkit Mutta
el 27 de Abr. de 2015
Image Analyst
el 27 de Abr. de 2015
You're welcome. I'm glad I could help you towards a successful project. If you want, you can also "Vote" for my two answers to give me "reputation points".
sudha muthusamy
el 14 de Jul. de 2018
image analyst sir, i am also doing same sort of project ,can u help me to work this in 3d yarn image .
sudha muthusamy
el 14 de Jul. de 2018
sir is this possible for a moving yarn ??
sudha muthusamy
el 14 de Jul. de 2018
sir please provide an idea related to yarn hairiness measurement
Image Analyst
el 14 de Jul. de 2018
Categorías
Más información sobre Image Preview and Device Configuration en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



