I have an image problem with the image using the save button "Error using images.int​ernal.pars​eNonString​InputsEdge​"

9 ビュー (過去 30 日間)
olivio gusmao
olivio gusmao 2020 年 6 月 4 日
回答済み: Riya 2025 年 2 月 18 日 6:01
I want to save the image with the save button that can immediately change the size of the image
citra = handles.image;
citraGray = rgb2gray(citra);
a = imresize(citraGray,[20 20]);
tresH = 0.08;
citraSobel = edge(citraGray,a,tresH,'sobel');
%----------------------
global frame
[nama_file_simpan, path_simpan]=uiputfile ({'*.jpg','JPEG Image (*.jpg)';},'Menyimpan Citra');
if isequal(nama_file_simpan,0) || isequal(path_simpan,0)
msgbox('Image is saved', 'Foto_Editor')
else
F=getframe(handles.axes1);
img=frame2im(F);
imwrite(img, fullfile(path_simpan,nama_file_simpan),'jpg');
end

回答 (1 件)

Riya
Riya 2025 年 2 月 18 日 6:01
Hi Olivio,
I understand that you are encountering an error while using the “edge” function and saving an image. The main reason for this error is an incorrect syntax in the “edge” function.
The “edge” function in MATLAB is used to detect edges in an image using different methods such as Sobel, Canny, etc. The syntax for “edge” function is:
BW = edge(I, method, threshold);
Where “I” is the input grayscale image, “method” specifies the edge detection algorithm (e.g., “sobel”, “canny”) and “threshold” is an optional parameter to control edge sensitivity.
To resolve the issue you are facing, please make the following changes to your code by correcting the syntax of the edge function.
citraSobel = edge(a, 'sobel', tresH);
Also, ensure grayscale conversion only if necessary. This will prevent any errors if the image is already grayscale.
These changes should resolve the issue and allow the image to be processed and saved correctly.
For more details, you can refer to the following documentation:
Thanks!

Community Treasure Hunt

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

Start Hunting!

Translated by