フィルターのクリア

Smooth, Blur and greyscale filter using a slider

2 ビュー (過去 30 日間)
Capx
Capx 2021 年 12 月 19 日
コメント済み: yanqi liu 2021 年 12 月 23 日
Hi, I'm trying to add filters (Smooth, Blur and greyscale) to three different sliders on my GUI. I'm new to Matlab; therefore, I'm unsure how to make them work. Any help would be appreciated.

採用された回答

yanqi liu
yanqi liu 2021 年 12 月 20 日
yes,sir,may be write some code in SliderValueChanged function,such as
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Slider
function SliderValueChanged(app, event)
value = app.Slider.Value;
app.TextArea.Value = sprintf('use slider 1, the value is %.1f', value);
end
% Value changed function: Slider2
function Slider2ValueChanged(app, event)
value = app.Slider2.Value;
app.TextArea.Value = sprintf('use slider 2, the value is %.1f', value);
end
% Value changed function: Slider3
function Slider3ValueChanged(app, event)
value = app.Slider3.Value;
app.TextArea.Value = sprintf('use slider 3, the value is %.1f', value);
end
end
then,we can use different value to make some process
  13 件のコメント
Capx
Capx 2021 年 12 月 22 日
@yanqi liu @Image Analyst Thank you for your assistance. Last but not least, could you assist me with the filter reset button? When I press the reset button, I want the sliders to be reset.
yanqi liu
yanqi liu 2021 年 12 月 23 日
yes,sir,please use
app.SmoothSlider.Value=0;
app.GREYSlider.Value=0;
app.BlurSlider.Value=0;
in reset callback

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2021 年 12 月 20 日
In the slider callback you can
  1. Get the value of the slider
  2. Construct a kernel to do blurring, like kernel = ones(sliderValue)/sliderValue^2
  3. Blur the image using blurredImage = imfilter(inputImage, kernel);
  4. Display the blurred image

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by