can someone plz help me to slove this error please
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
so i have this code and an error keeps popping up saying
Undefined function 'imnoise' for input arguments of type 'uint8'.
same thing for imadjust and i dont know howto fix it can someone please help i would really appreciate it heres the code
classdef app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
ShowOriginalSwitch matlab.ui.control.Switch
ShowOriginalSwitchLabel matlab.ui.control.Label
ExportButton matlab.ui.control.Button
OKButton matlab.ui.control.Button
HighTripletLabel matlab.ui.control.Label
LowTripletLabel matlab.ui.control.Label
AdjustContrastLabel matlab.ui.control.Label
Slider_6 matlab.ui.control.Slider
Slider_6Label matlab.ui.control.Label
Slider_5 matlab.ui.control.Slider
Slider_5Label matlab.ui.control.Label
Slider_4 matlab.ui.control.Slider
Slider_4Label matlab.ui.control.Label
Slider_3 matlab.ui.control.Slider
Slider_3Label matlab.ui.control.Label
Slider_2 matlab.ui.control.Slider
Slider_2Label matlab.ui.control.Label
Slider matlab.ui.control.Slider
SliderLabel matlab.ui.control.Label
NoiseSlider matlab.ui.control.Slider
NoiseSliderLabel matlab.ui.control.Label
BrowseButton matlab.ui.control.Button
imageEditField matlab.ui.control.EditField
imageEditFieldLabel matlab.ui.control.Label
PhotoEditorLabel matlab.ui.control.Label
AdvancedOptionsButtonGroup matlab.ui.container.ButtonGroup
flipButton matlab.ui.control.Button
adjustimageintensityButton matlab.ui.control.Button
periodicnoiseButton matlab.ui.control.Button
guassiannoiseButton matlab.ui.control.Button
resizeButton matlab.ui.control.Button
blueButton matlab.ui.control.Button
complementButton matlab.ui.control.Button
lowpassfilterButton matlab.ui.control.Button
equalizationButton matlab.ui.control.Button
greenButton matlab.ui.control.Button
histoforgrayButton matlab.ui.control.Button
saltandpepperButton matlab.ui.control.Button
rotateButton matlab.ui.control.ToggleButton
redButton matlab.ui.control.ToggleButton
histoforrgbButton matlab.ui.control.ToggleButton
TextArea_2 matlab.ui.control.TextArea
TextArea matlab.ui.control.TextArea
BasicOptionsButtonGroup matlab.ui.container.ButtonGroup
ExitButton matlab.ui.control.Button
ResetButton matlab.ui.control.Button
BlackandwhiteButton matlab.ui.control.ToggleButton
GrayShadeButton matlab.ui.control.ToggleButton
ImportImageButton matlab.ui.control.ToggleButton
UIAxes3 matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
UIAxes matlab.ui.control.UIAxes
end
properties (Access = private)
Image
Modified
TempEffect
Noise
Exit
LowR
LowG
LowB
HighR
HighG
HighB
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
title(app.UIAxes3,[]);
xlabel(app.UIAxes3,[]);
ylabel(app.UIAxes3,[]);
app.UIAxes3.XAxis.TickLabels={};
app.UIAxes3.YAxis.TickLabels={};
app.Exit=0;
app.LowR=0.2;
app.LowG=0.3;
app.LowB=0;
app.HighR=0.6;
app.HighG=0.7;
app.HighB=1;
end
% Button pushed function: BrowseButton
function BrowseButtonPushed(app, event)
[filename,pathname]=uigetfile({'*.jpg'; '*jpeg';'*tif';'*gif';'*bmp';'*.*'},'File Selector');
app.imageEditField.Value=strcat(pathname,filename);
app.Image=imread(app.imageEditField.Value);
app.Modified= app.Image;
I=imshow(app.Modified,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
app.UIFigure.Visible="off";
app.UIFigure.Visible="on";
end
% Value changed function: NoiseSlider
function NoiseSliderValueChanged(app, event)
app.Noise= app.NoiseSlider.Value;
app.TempEffect=app.Modified;
if app.Noise>0
app.TempEffect=imnoise(app.Modified,'guassian',app.Noise);
I=imshow(app.Modified,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
else
app.TempEffect=app.Modified;
I=imshow(app.Modified,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
app.Exit=1;
end
% Value changed function: ShowOriginalSwitch
function ShowOriginalSwitchValueChanged(app, event)
if app.Exit==1
app.Modified=app.TempEffect;
app.Exit=0;
end
value = app.ShowOriginalSwitch.Value;
if strcmp (value ,'On')==1
I=imshow(app.Image,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
else
I=imshow(app.Modified,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
end
% Value changed function: Slider
function SliderValueChanged(app, event)
app.LowR= app.Slider.Value;
app.TempEffect=imadjust(app.Modified,[app.LowR app.LowG app.LowB;app.HighR app.HighG app.HighB],[]);
I=imshow(app.TempEffect,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Value changed function: Slider_2
function Slider_2ValueChanged(app, event)
app.LowG = app.Slider_2.Value;
app.TempEffect=imadjust(app.Modified,[app.LowR app.LowG app.LowB;app.HighR app.HighG app.HighB],[]);
I=imshow(app.TempEffect,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Value changed function: Slider_3
function Slider_3ValueChanged(app, event)
app.LowB = app.Slider_3.Value;
app.TempEffect=imadjust(app.Modified,[app.LowR app.LowG app.LowB;app.HighR app.HighG app.HighB],[]);
I=imshow(app.TempEffect,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Value changed function: Slider_4
function Slider_4ValueChanged(app, event)
app.HighR = app.Slider_4.Value;
app.TempEffect=imadjust(app.Modified,[app.LowR app.LowG app.LowB;app.HighR app.HighG app.HighB],[]);
I=imshow(app.TempEffect,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Value changed function: Slider_5
function Slider_5ValueChanged(app, event)
app.HighG = app.Slider_5.Value;
app.TempEffect=imadjust(app.Modified,[app.LowR app.LowG app.LowB;app.HighR app.HighG app.HighB],[]);
I=imshow(app.TempEffect,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Value changed function: Slider_6
function Slider_6ValueChanged(app, event)
app.HighB = app.Slider_6.Value;
app.TempEffect=imadjust(app.Modified,[app.LowR app.LowG app.LowB;app.HighR app.HighG app.HighB],[]);
I=imshow(app.TempEffect,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Button pushed function: OKButton
function OKButtonPushed(app, event)
app.Modified=app.TempEffect;
I=imshow(app.Modified,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
% Button pushed function: ExportButton
function ExportButtonPushed(app, event)
filter={'*.jpg'; '*jpeg';'*tif';'*gif';'*bmp';'*.*','File Selector'};
[file,path]=uiputfile(filter);
if file~=0
fig=figure;
fig.Visible='off';
figAxes=axes(fig);
allChildren=app.UIAxes3.Xaxis.Parent.Children;
copyobj(allChildren,figAxes)
figAxes.Xaxis.TickLabels={};
figAxes.Yaxis.TickLabels={};
figAxes.DataAspectRatio=app.UIAxes3.DataAspectRatio;
set(gca,'Visible','off');
saveas(fig,strcat(path,file));
delete(fig);
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Color = [0.9412 0.8706 0.7098];
app.UIFigure.Position = [100 100 2132 614];
app.UIFigure.Name = 'MATLAB App';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.Position = [325 260 241 249];
% Create UIAxes2
app.UIAxes2 = uiaxes(app.UIFigure);
title(app.UIAxes2, 'Title')
xlabel(app.UIAxes2, 'X')
ylabel(app.UIAxes2, 'Y')
zlabel(app.UIAxes2, 'Z')
app.UIAxes2.Position = [639 260 223 239];
% Create UIAxes3
app.UIAxes3 = uiaxes(app.UIFigure);
title(app.UIAxes3, 'Title')
xlabel(app.UIAxes3, 'X')
ylabel(app.UIAxes3, 'Y')
zlabel(app.UIAxes3, 'Z')
app.UIAxes3.Position = [1618 108 472 350];
% Create BasicOptionsButtonGroup
app.BasicOptionsButtonGroup = uibuttongroup(app.UIFigure);
app.BasicOptionsButtonGroup.ForegroundColor = [1 0.9216 0.6314];
app.BasicOptionsButtonGroup.TitlePosition = 'centertop';
app.BasicOptionsButtonGroup.Title = 'Basic Options';
app.BasicOptionsButtonGroup.BackgroundColor = [0.8118 0.3412 0.3412];
app.BasicOptionsButtonGroup.FontAngle = 'italic';
app.BasicOptionsButtonGroup.FontWeight = 'bold';
app.BasicOptionsButtonGroup.FontSize = 18;
app.BasicOptionsButtonGroup.Position = [102 225 151 314];
% Create ImportImageButton
app.ImportImageButton = uitogglebutton(app.BasicOptionsButtonGroup);
app.ImportImageButton.Text = 'Import Image';
app.ImportImageButton.BackgroundColor = [0.9412 0.8706 0.7098];
app.ImportImageButton.Position = [20 230 100 28];
app.ImportImageButton.Value = true;
% Create GrayShadeButton
app.GrayShadeButton = uitogglebutton(app.BasicOptionsButtonGroup);
app.GrayShadeButton.Text = 'Gray Shade';
app.GrayShadeButton.BackgroundColor = [0.9412 0.8706 0.7098];
app.GrayShadeButton.Position = [20 182 100 28];
% Create BlackandwhiteButton
app.BlackandwhiteButton = uitogglebutton(app.BasicOptionsButtonGroup);
app.BlackandwhiteButton.Text = 'Black and white ';
app.BlackandwhiteButton.BackgroundColor = [0.9412 0.8706 0.7098];
app.BlackandwhiteButton.Position = [19 132 103 28];
% Create ResetButton
app.ResetButton = uibutton(app.BasicOptionsButtonGroup, 'push');
app.ResetButton.BackgroundColor = [0.9412 0.8706 0.7098];
app.ResetButton.Position = [20 83 100 27];
app.ResetButton.Text = 'Reset';
% Create ExitButton
app.ExitButton = uibutton(app.BasicOptionsButtonGroup, 'push');
app.ExitButton.BackgroundColor = [0.9412 0.8706 0.7098];
app.ExitButton.Position = [20 28 100 27];
app.ExitButton.Text = 'Exit';
% Create TextArea
app.TextArea = uitextarea(app.UIFigure);
app.TextArea.FontWeight = 'bold';
app.TextArea.FontAngle = 'italic';
app.TextArea.FontColor = [1 0.9216 0.6314];
app.TextArea.BackgroundColor = [0.8118 0.3412 0.3412];
app.TextArea.Position = [405 516 119 34];
app.TextArea.Value = {'Original Image'};
% Create TextArea_2
app.TextArea_2 = uitextarea(app.UIFigure);
app.TextArea_2.HorizontalAlignment = 'center';
app.TextArea_2.FontWeight = 'bold';
app.TextArea_2.FontAngle = 'italic';
app.TextArea_2.FontColor = [1 0.9216 0.6314];
app.TextArea_2.BackgroundColor = [0.8118 0.3412 0.3412];
app.TextArea_2.Position = [678 516 119 34];
app.TextArea_2.Value = {'Modified Image'; ''};
% Create AdvancedOptionsButtonGroup
app.AdvancedOptionsButtonGroup = uibuttongroup(app.UIFigure);
app.AdvancedOptionsButtonGroup.ForegroundColor = [1 0.9216 0.6314];
app.AdvancedOptionsButtonGroup.TitlePosition = 'centertop';
app.AdvancedOptionsButtonGroup.Title = 'Advanced Options';
app.AdvancedOptionsButtonGroup.BackgroundColor = [0.8118 0.3412 0.3412];
app.AdvancedOptionsButtonGroup.FontAngle = 'italic';
app.AdvancedOptionsButtonGroup.FontWeight = 'bold';
app.AdvancedOptionsButtonGroup.FontSize = 18;
app.AdvancedOptionsButtonGroup.Position = [82 10 809 186];
% Create histoforrgbButton
app.histoforrgbButton = uitogglebutton(app.AdvancedOptionsButtonGroup);
app.histoforrgbButton.Text = 'histo-for-rgb';
app.histoforrgbButton.BackgroundColor = [0.9686 0.6 0.6];
app.histoforrgbButton.Position = [71 125 100 23];
app.histoforrgbButton.Value = true;
% Create redButton
app.redButton = uitogglebutton(app.AdvancedOptionsButtonGroup);
app.redButton.Text = 'red';
app.redButton.BackgroundColor = [0.9686 0.6 0.6];
app.redButton.Position = [233 126 100 23];
% Create rotateButton
app.rotateButton = uitogglebutton(app.AdvancedOptionsButtonGroup);
app.rotateButton.Text = 'rotate';
app.rotateButton.BackgroundColor = [0.9686 0.6 0.6];
app.rotateButton.Position = [384 125 100 23];
% Create saltandpepperButton
app.saltandpepperButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.saltandpepperButton.BackgroundColor = [0.9686 0.6 0.6];
app.saltandpepperButton.Position = [521 125 100 23];
app.saltandpepperButton.Text = 'salt and pepper';
% Create histoforgrayButton
app.histoforgrayButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.histoforgrayButton.BackgroundColor = [0.9686 0.6 0.6];
app.histoforgrayButton.Position = [71 73 100 23];
app.histoforgrayButton.Text = 'histo-for-gray';
% Create greenButton
app.greenButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.greenButton.BackgroundColor = [0.9686 0.6 0.6];
app.greenButton.Position = [233 75 100 23];
app.greenButton.Text = 'green';
% Create equalizationButton
app.equalizationButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.equalizationButton.BackgroundColor = [0.9686 0.6 0.6];
app.equalizationButton.Position = [384 73 100 23];
app.equalizationButton.Text = 'equalization';
% Create lowpassfilterButton
app.lowpassfilterButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.lowpassfilterButton.BackgroundColor = [0.9686 0.6 0.6];
app.lowpassfilterButton.Position = [521 73 100 23];
app.lowpassfilterButton.Text = 'low pass filter';
% Create complementButton
app.complementButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.complementButton.BackgroundColor = [0.9686 0.6 0.6];
app.complementButton.Position = [71 20 100 23];
app.complementButton.Text = 'complement';
% Create blueButton
app.blueButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.blueButton.BackgroundColor = [0.9686 0.6 0.6];
app.blueButton.Position = [233 20 100 23];
app.blueButton.Text = 'blue';
% Create resizeButton
app.resizeButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.resizeButton.BackgroundColor = [0.9686 0.6 0.6];
app.resizeButton.Position = [384 19 100 23];
app.resizeButton.Text = 'resize';
% Create guassiannoiseButton
app.guassiannoiseButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.guassiannoiseButton.BackgroundColor = [0.9686 0.6 0.6];
app.guassiannoiseButton.Position = [521 19 100 23];
app.guassiannoiseButton.Text = 'guassian noise';
% Create periodicnoiseButton
app.periodicnoiseButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.periodicnoiseButton.BackgroundColor = [0.9686 0.6 0.6];
app.periodicnoiseButton.Position = [680 124 100 23];
app.periodicnoiseButton.Text = 'periodic noise';
% Create adjustimageintensityButton
app.adjustimageintensityButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.adjustimageintensityButton.BackgroundColor = [0.9686 0.6 0.6];
app.adjustimageintensityButton.Position = [665 73 131 23];
app.adjustimageintensityButton.Text = 'adjust image intensity';
% Create flipButton
app.flipButton = uibutton(app.AdvancedOptionsButtonGroup, 'push');
app.flipButton.BackgroundColor = [0.9686 0.6 0.6];
app.flipButton.Position = [680 19 100 23];
app.flipButton.Text = 'flip';
% Create PhotoEditorLabel
app.PhotoEditorLabel = uilabel(app.UIFigure);
app.PhotoEditorLabel.BackgroundColor = [0.8118 0.3412 0.3412];
app.PhotoEditorLabel.HorizontalAlignment = 'center';
app.PhotoEditorLabel.FontSize = 24;
app.PhotoEditorLabel.FontColor = [1 0.9216 0.6314];
app.PhotoEditorLabel.Position = [1243 549 257 31];
app.PhotoEditorLabel.Text = 'Photo Editor';
% Create imageEditFieldLabel
app.imageEditFieldLabel = uilabel(app.UIFigure);
app.imageEditFieldLabel.BackgroundColor = [0.9412 0.8706 0.7098];
app.imageEditFieldLabel.HorizontalAlignment = 'right';
app.imageEditFieldLabel.FontWeight = 'bold';
app.imageEditFieldLabel.FontColor = [0.8118 0.3412 0.3412];
app.imageEditFieldLabel.Position = [984 477 39 22];
app.imageEditFieldLabel.Text = 'image';
% Create imageEditField
app.imageEditField = uieditfield(app.UIFigure, 'text');
app.imageEditField.FontWeight = 'bold';
app.imageEditField.FontColor = [1 0.9216 0.6314];
app.imageEditField.Position = [1038 477 263 22];
% Create BrowseButton
app.BrowseButton = uibutton(app.UIFigure, 'push');
app.BrowseButton.ButtonPushedFcn = createCallbackFcn(app, @BrowseButtonPushed, true);
app.BrowseButton.FontWeight = 'bold';
app.BrowseButton.FontColor = [0.8118 0.3412 0.3412];
app.BrowseButton.Position = [1312 477 100 23];
app.BrowseButton.Text = 'Browse';
% Create NoiseSliderLabel
app.NoiseSliderLabel = uilabel(app.UIFigure);
app.NoiseSliderLabel.HorizontalAlignment = 'right';
app.NoiseSliderLabel.FontWeight = 'bold';
app.NoiseSliderLabel.FontColor = [0.8118 0.3412 0.3412];
app.NoiseSliderLabel.Position = [982 406 38 22];
app.NoiseSliderLabel.Text = 'Noise';
% Create NoiseSlider
app.NoiseSlider = uislider(app.UIFigure);
app.NoiseSlider.Limits = [0 1];
app.NoiseSlider.ValueChangedFcn = createCallbackFcn(app, @NoiseSliderValueChanged, true);
app.NoiseSlider.FontWeight = 'bold';
app.NoiseSlider.FontColor = [0.8118 0.3412 0.3412];
app.NoiseSlider.Position = [1041 415 360 3];
% Create SliderLabel
app.SliderLabel = uilabel(app.UIFigure);
app.SliderLabel.HorizontalAlignment = 'right';
app.SliderLabel.Position = [924 89 35 22];
app.SliderLabel.Text = 'Slider';
% Create Slider
app.Slider = uislider(app.UIFigure);
app.Slider.Limits = [0 0.5];
app.Slider.Orientation = 'vertical';
app.Slider.ValueChangedFcn = createCallbackFcn(app, @SliderValueChanged, true);
app.Slider.Position = [980 98 3 181];
app.Slider.Value = 0.5;
% Create Slider_2Label
app.Slider_2Label = uilabel(app.UIFigure);
app.Slider_2Label.HorizontalAlignment = 'right';
app.Slider_2Label.Position = [1007 87 35 22];
app.Slider_2Label.Text = 'Slider';
% Create Slider_2
app.Slider_2 = uislider(app.UIFigure);
app.Slider_2.Limits = [0 0.5];
app.Slider_2.Orientation = 'vertical';
app.Slider_2.ValueChangedFcn = createCallbackFcn(app, @Slider_2ValueChanged, true);
app.Slider_2.Position = [1063 96 3 180];
% Create Slider_3Label
app.Slider_3Label = uilabel(app.UIFigure);
app.Slider_3Label.HorizontalAlignment = 'right';
app.Slider_3Label.Position = [1088 85 35 22];
app.Slider_3Label.Text = 'Slider';
% Create Slider_3
app.Slider_3 = uislider(app.UIFigure);
app.Slider_3.Limits = [0 0.5];
app.Slider_3.Orientation = 'vertical';
app.Slider_3.ValueChangedFcn = createCallbackFcn(app, @Slider_3ValueChanged, true);
app.Slider_3.Position = [1144 94 3 181];
% Create Slider_4Label
app.Slider_4Label = uilabel(app.UIFigure);
app.Slider_4Label.HorizontalAlignment = 'right';
app.Slider_4Label.Position = [1203 86 35 22];
app.Slider_4Label.Text = 'Slider';
% Create Slider_4
app.Slider_4 = uislider(app.UIFigure);
app.Slider_4.Limits = [0.5 1];
app.Slider_4.Orientation = 'vertical';
app.Slider_4.ValueChangedFcn = createCallbackFcn(app, @Slider_4ValueChanged, true);
app.Slider_4.Position = [1259 95 3 181];
app.Slider_4.Value = 0.5;
% Create Slider_5Label
app.Slider_5Label = uilabel(app.UIFigure);
app.Slider_5Label.HorizontalAlignment = 'right';
app.Slider_5Label.Position = [1299 85 35 22];
app.Slider_5Label.Text = 'Slider';
% Create Slider_5
app.Slider_5 = uislider(app.UIFigure);
app.Slider_5.Limits = [0 0.5];
app.Slider_5.Orientation = 'vertical';
app.Slider_5.ValueChangedFcn = createCallbackFcn(app, @Slider_5ValueChanged, true);
app.Slider_5.Position = [1355 94 3 181];
% Create Slider_6Label
app.Slider_6Label = uilabel(app.UIFigure);
app.Slider_6Label.HorizontalAlignment = 'right';
app.Slider_6Label.Position = [1386 85 35 22];
app.Slider_6Label.Text = 'Slider';
% Create Slider_6
app.Slider_6 = uislider(app.UIFigure);
app.Slider_6.Limits = [0.5 1];
app.Slider_6.Orientation = 'vertical';
app.Slider_6.ValueChangedFcn = createCallbackFcn(app, @Slider_6ValueChanged, true);
app.Slider_6.Position = [1442 94 3 181];
app.Slider_6.Value = 0.5;
% Create AdjustContrastLabel
app.AdjustContrastLabel = uilabel(app.UIFigure);
app.AdjustContrastLabel.HorizontalAlignment = 'center';
app.AdjustContrastLabel.FontSize = 18;
app.AdjustContrastLabel.FontWeight = 'bold';
app.AdjustContrastLabel.FontColor = [0.8118 0.3412 0.3412];
app.AdjustContrastLabel.Position = [1103 317 264 23];
app.AdjustContrastLabel.Text = 'Adjust Contrast';
% Create LowTripletLabel
app.LowTripletLabel = uilabel(app.UIFigure);
app.LowTripletLabel.FontSize = 14;
app.LowTripletLabel.FontWeight = 'bold';
app.LowTripletLabel.FontColor = [0.8118 0.3412 0.3412];
app.LowTripletLabel.Position = [1015 41 80 22];
app.LowTripletLabel.Text = 'Low Triplet';
% Create HighTripletLabel
app.HighTripletLabel = uilabel(app.UIFigure);
app.HighTripletLabel.FontSize = 14;
app.HighTripletLabel.FontWeight = 'bold';
app.HighTripletLabel.FontColor = [0.8118 0.3412 0.3412];
app.HighTripletLabel.Position = [1325 41 82 22];
app.HighTripletLabel.Text = 'High Triplet';
% Create OKButton
app.OKButton = uibutton(app.UIFigure, 'push');
app.OKButton.ButtonPushedFcn = createCallbackFcn(app, @OKButtonPushed, true);
app.OKButton.BackgroundColor = [0.8118 0.3412 0.3412];
app.OKButton.FontSize = 18;
app.OKButton.FontWeight = 'bold';
app.OKButton.FontColor = [0.9412 0.8706 0.7098];
app.OKButton.Position = [1499 93 70 184];
app.OKButton.Text = 'OK';
% Create ExportButton
app.ExportButton = uibutton(app.UIFigure, 'push');
app.ExportButton.ButtonPushedFcn = createCallbackFcn(app, @ExportButtonPushed, true);
app.ExportButton.BackgroundColor = [0.8118 0.3412 0.3412];
app.ExportButton.FontSize = 18;
app.ExportButton.FontWeight = 'bold';
app.ExportButton.FontColor = [0.9412 0.8706 0.7098];
app.ExportButton.Position = [1957 49 133 30];
app.ExportButton.Text = 'Export';
% Create ShowOriginalSwitchLabel
app.ShowOriginalSwitchLabel = uilabel(app.UIFigure);
app.ShowOriginalSwitchLabel.HorizontalAlignment = 'center';
app.ShowOriginalSwitchLabel.FontSize = 14;
app.ShowOriginalSwitchLabel.FontWeight = 'bold';
app.ShowOriginalSwitchLabel.FontColor = [0.8118 0.3412 0.3412];
app.ShowOriginalSwitchLabel.Position = [1681 53 99 22];
app.ShowOriginalSwitchLabel.Text = 'Show Original';
% Create ShowOriginalSwitch
app.ShowOriginalSwitch = uiswitch(app.UIFigure, 'slider');
app.ShowOriginalSwitch.ValueChangedFcn = createCallbackFcn(app, @ShowOriginalSwitchValueChanged, true);
app.ShowOriginalSwitch.FontSize = 14;
app.ShowOriginalSwitch.FontWeight = 'bold';
app.ShowOriginalSwitch.FontColor = [0.8118 0.3412 0.3412];
app.ShowOriginalSwitch.Position = [1810 45 88 39];
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
0 Commenti
Risposta accettata
Walter Roberson
il 28 Nov 2022
"imnoise expects pixel values of data type double and single to be in the range [0, 1]. You can use the rescale function to adjust pixel values to the expected range. If your image is type double or single with values outside the range [0,1], then imnoise clips input pixel values to the range [0, 1] before adding noise."
So you should im2double() your uint8.
4 Commenti
Walter Roberson
il 29 Nov 2022
Ah, I see now that the wording could mean that IF your values are floating point then that range is expected, rather than saying that only floating point is expected.
DGM
il 29 Nov 2022
I could understand that someone might accidentally have a file that's shadowing one function, but both being shadowed seems like a stretch.
I suspect that the app may be something that was downloaded without knowing its dependencies, but I can't know that. If it turns out that OP doesn't have IPT, then MIMT imadjustFB() and imnoiseFB() should be drop-in replacements for the usage that's shown.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!