Help regarding Image Segmentation of B/W Image!!
이전 댓글 표시
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
Image Analyst
2015년 3월 14일
편집: Image Analyst
2015년 3월 14일
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
2015년 3월 20일
Samkit Mutta
2015년 3월 20일
Image Analyst
2015년 3월 20일
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
2015년 3월 23일
채택된 답변
추가 답변 (3개)
Meghana Dinesh
2015년 3월 20일
0 개 추천
Try using the Morphological operators dilation and erosion.
댓글 수: 4
Samkit Mutta
2015년 3월 23일
Meghana Dinesh
2015년 3월 27일
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
2015년 3월 27일
Samkit Mutta
2015년 3월 29일
Image Analyst
2015년 3월 23일
0 개 추천
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
2015년 4월 19일
0 개 추천
댓글 수: 26
Image Analyst
2015년 4월 19일
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
2015년 4월 19일
Image Analyst
2015년 4월 19일
Put this line of code into your code:
workspace; % Make sure the workspace panel is showing.
Samkit Mutta
2015년 4월 19일
Image Analyst
2015년 4월 19일
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
2015년 4월 20일
Image Analyst
2015년 4월 20일
Are you sure you don't have a "clear" or "clear all" or "clearvars" in there somewhere?
Samkit Mutta
2015년 4월 20일
Image Analyst
2015년 4월 21일
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
2015년 4월 21일
Image Analyst
2015년 4월 21일
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
2015년 4월 21일
Samkit Mutta
2015년 4월 21일
Image Analyst
2015년 4월 21일
What is the favor or question?
Samkit Mutta
2015년 4월 22일
Image Analyst
2015년 4월 22일
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
2015년 4월 23일
Samkit Mutta
2015년 4월 23일
편집: Samkit Mutta
2015년 4월 23일
Image Analyst
2015년 4월 23일
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
2015년 4월 27일
Samkit Mutta
2015년 4월 27일
Image Analyst
2015년 4월 27일
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
2018년 7월 14일
image analyst sir, i am also doing same sort of project ,can u help me to work this in 3d yarn image .
sudha muthusamy
2018년 7월 14일
sir is this possible for a moving yarn ??
sudha muthusamy
2018년 7월 14일
sir please provide an idea related to yarn hairiness measurement
Image Analyst
2018년 7월 14일
카테고리
도움말 센터 및 File Exchange에서 Image Preview and Device Configuration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



