How to make my coding of canny edge detection into GUI?

조회 수: 4 (최근 30일)
NURUL AMIRA MHD RIZAL
NURUL AMIRA MHD RIZAL 2018년 5월 6일
댓글: NURUL AMIRA MHD RIZAL 2018년 5월 7일
I have this code for edge detection. How can I make it into GUI? where it have buttons to select 'Canny edge detection'.
I = imread('ddd.jpg');
Igray = rgb2gray(I);
BW = edge(Igray,'canny');
imshow(BW)

답변 (1개)

sloppydisk
sloppydisk 2018년 5월 6일
Use the uicontrol function, see
doc control
For your example:
global I
global BW
I = imread('ddd.jpg');
Igray = rgb2gray(I);
BW = edge(Igray,'canny');
figure(1)
uicontrol('Style', 'Checkbox',...
'Callback', @canny,...
'String', 'Edge detection'...)
,'Position', [20 20 100 20]...
)
imshow(I)
function canny(src, event)
global I
global BW
if src.Value
imshow(BW)
else
imshow(I)
end
end

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by