dividing binary image using GUI
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hello, So I have a footprint in binary image and I have to divide it into 3 area with the same length but without the fingers. I have to do it using GUI.Is there any way how to do it? If it help, I give the picture about how to divide it above. Thank's a lot.
채택된 답변
Image Analyst
2016년 7월 28일
Just figure out the row numbers, for example
[rows, columns, numberOfColorChannels] = size(binaryImage);
row1 = round(rows/3);
row2 = round(2*rows/2);
topThird = binaryImage(1:row1, :);
middleThird = binaryImage((row1+1):row2, :);
bottomThird = binaryImage((row2+1):end, :);
댓글 수: 13
Thanks a lot for your help again. So we have to know the row numbers first, then if I want to divide into 3 part it means I have to know the row numbers from where the fingers is not include. Is that right?
Or, what if I detect the boundaries of the foot's body first and then divide it into 3 part. is it possible?
The point is I have to divide the body part of the foot into 3 part and calculate each area. would you give me some suggestion the best way?
Image Analyst
2016년 7월 28일
If you don't want the toes, you can threshold the image then call bwareafilt to get the largest blob. Or you can call bwareaopen() to throw away blobs smaller than a certain size. Then you can call regionprops() on just the remaining main part of the foot to get the bounding box.
okay I will try it, thank you so much for the suggestion.
sir, I have tried your first answer and apply it in my image and it works, the image can divided into 3 parts with the same length. But when I crop the image first and use your code, it doesn't divided into 3 parts. Could you please help me to correct it? or give me suggestion about where I can learn about it?
It has to work. Are you sure you updated the number of rows and columns based on the cropped image instead of using the original, precropped size? Otherwise show your code.
yes sir you are right, after I use the number of rows from the cropped image, it work perfectly. Thank you so much
sir If I may, I want to ask one more question and it related with your previous help. so I have made a threshold image using slider in my GUI and now I want to use "bwareaopen" to hide the toes. My question is, how to connect "bwareaopen" function to the threshold image that based on the slider?
In the function where you are going to call bwareaopen(), make sure it has the handles structure in scope, then do this:
sliderValue = handles.slider1.Value;
% sliderValue = get(handles.slider1, 'Value'); % This is the old way.
if sliderValue < 1
% Don't let go less than 1.
sliderValue = 1;
handles.slider1.Min = 1;
handles.slider1.Value = 1;
end
minAcceptableArea = round(sliderValue);
binaryImage = bwareaopen(binaryImage, minAcceptableArea);
Replace slider1 with the actual tag name of your slider.
sorry sir I tried and error, I still dont understand. when I replace the minAcceptableArea with the value like 100000 it become error.
If I want to use pushbutton to activate bwareaopen and show the result in the axes2 then where I should place your code?
Do you expect me to know the error without showing me your code and without showing me your error?
You put the code in the callback function for your pushbutton. Like
function pushbutton_click(hObject........
binaryImage = bwareaopen(......
axes(handles.axes2);
imshow(binaryImage);
I truly apologize sir. so this is my current code for "foot body" pushbutton:
if true
a=getappdata(0,'a');
a_gray=rgb2gray(a);
a_bw=im2bw(a_gray, .33);
a_bw2=bwareaopen(a_bw,100000);
axes(handles.axes2);
imshow(a_bw2);
setappdata(0,'filename',a_bw2);
end
Now this is the callback from the slider:
if true
a=getappdata(0,'a');
a_gray=rgb2gray(a);
thresholdValue = uint8(get(handles.slider1, 'Value'));
sliderValue = get(handles.slider1, 'Value');
a_bw=a_gray > thresholdValue;
axes(handles.axes2);
imshow(a_bw)
end
then I want to replace the threshold level in im2bw using the value from the slider and use the bwareaopen to hide the toes. Please show me the way sir. Thank you so much
Make sure your slider goes from 0 to 255, then get its value and don't use im2bw, just threshold it.
In the slider callback:
sliderValue = get(handles.slider1, 'Value');
thresholdValue = uint8(sliderValue);
% Now apply the threshold to make a binary image.
a_bw = a_gray > thresholdValue;
wow it work perfectly. thank you, thank you, thank you so much sir for your help.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
