Error adding Gaussian noise ( M must be a real scalar )

3 ビュー (過去 30 日間)
lian jiajie
lian jiajie 2021 年 2 月 22 日
回答済み: Keerthana Chiruvolu 2021 年 3 月 2 日
I am building an image processing application with App Designer and wanted to add noise to input image. Encountered this error message shown below
Got the error message when I do it this way :
mean = app.MeanEditField.Value;
variance = app.VarianceEditField.Value;
temp = app.output_img.ImageSource;
Noisy = imnoise(temp,'gaussian',mean,variance);
But works in this way :
Noisy = imnoise(temp,'gaussian',0.1,0.02);
The first way is simply grabbing the value entered from GUI and put them as imnoise arguments. It should work the same as the second way. Please, anyone can tell what's the issue in there.

回答 (1 件)

Keerthana Chiruvolu
Keerthana Chiruvolu 2021 年 3 月 2 日
Hi,
It is clear for the error message that it is due to the data type of the input, which might not be a scalar.
Identify the data type of the inputs used from the app and ensure that it is a real scalar value.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by