dividing binary image using GUI
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 件のコメント
Varian Adisuryo
2016 年 7 月 28 日
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.
Varian Adisuryo
2016 年 7 月 28 日
okay I will try it, thank you so much for the suggestion.
Varian Adisuryo
2016 年 8 月 4 日
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?
Image Analyst
2016 年 8 月 5 日
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.
Varian Adisuryo
2016 年 8 月 5 日
yes sir you are right, after I use the number of rows from the cropped image, it work perfectly. Thank you so much
Varian Adisuryo
2016 年 8 月 5 日
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?
Image Analyst
2016 年 8 月 5 日
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.
Varian Adisuryo
2016 年 8 月 6 日
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?
Image Analyst
2016 年 8 月 6 日
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);
Varian Adisuryo
2016 年 8 月 6 日
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
Image Analyst
2016 年 8 月 6 日
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;
Varian Adisuryo
2016 年 8 月 6 日
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
