App designer - problem with thresholding image

조회 수: 7(최근 30일)
Teshan Rezel
Teshan Rezel 2021년 4월 10일
댓글: Teshan Rezel 2021년 4월 11일
Hi folks,
I have the app attached, in which I am encountering two issues. Firstly, when trying to threshold an image and displaying the thresholded image, it would appear my function calls aren't working as the image displayed is not thresholded. (ResinThreshold function works in live editor, but not when called in app designer). The thresholding function is below.
Thanks
function ResinThreshold(app)
imgGrey = rgb2gray(app.img);
[counts, ~] = imhist(imgGrey, 255);
T = otsuthresh(counts);
BW = imbinarize(imgGrey, T);
BW = bwareaopen(BW, 3000);
BW = imfill(BW, 'holes');
BW = bwperim(BW);
BW = imdilate(BW, ones(5));
BW = imerode(BW, ones(3));
BW = imfill(BW, 'holes');
app.img = app.img.*repmat(uint8(BW),[1 1 3]);
end
  댓글 수: 2
Teshan Rezel
Teshan Rezel 2021년 4월 11일
hi @DGM, apologies! I thought I'd attached it...I've ammended the error!

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2021년 4월 11일
You need to display the output image
imshow(app.img);
  댓글 수: 5
Teshan Rezel
Teshan Rezel 2021년 4월 11일
hi @Image Analyst, so the app should prompt you to select a folder with images in it on startup. once selected, pushing any of the buttons on the left of the table will move increment the relevant tally and display the next image in sequence.
I haven't listed any instructions as this is a very specific app designed for use by a very few people, and its based entirely on an existing "manual" methodology. Typically, they will go through hundreds of images on the app and tally them up, so it's not feasible to implement a listbox for images.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by