⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 noise_estimate.m

📁 用guide编的matlab界面,可以点击图像任意位置截取一小块
💻 M
字号:
function varargout = noise_estimate(varargin)%NOISE_ESTIMATE M-file for noise_estimate.fig%      NOISE_ESTIMATE, by itself, creates a new NOISE_ESTIMATE or raises the existing%      singleton*.%%      H = NOISE_ESTIMATE returns the handle to a new NOISE_ESTIMATE or the handle to%      the existing singleton*.%%      NOISE_ESTIMATE('Property','Value',...) creates a new NOISE_ESTIMATE using the%      given property value pairs. Unrecognized properties are passed via%      varargin to noise_estimate_OpeningFcn.  This calling syntax produces a%      warning when there is an existing singleton*.%%      NOISE_ESTIMATE('CALLBACK') and NOISE_ESTIMATE('CALLBACK',hObject,...) call the%      local function named CALLBACK in NOISE_ESTIMATE.M with the given input%      arguments.%%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one%      instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help noise_estimate% Last Modified by GUIDE v2.5 09-Apr-2008 11:37:58% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @noise_estimate_OpeningFcn, ...                   'gui_OutputFcn',  @noise_estimate_OutputFcn, ...                   'gui_LayoutFcn',  [], ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})   gui_State.gui_Callback = str2func(varargin{1});endif nargout    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else    gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before noise_estimate is made visible.function noise_estimate_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject    handle to figure% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% varargin   unrecognized PropertyName/PropertyValue pairs from the%            command line (see VARARGIN)% Choose default command line output for noise_estimatehandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes noise_estimate wait for user response (see UIRESUME)% uiwait(handles.figure1);% axes(handles.axes1)% imshow('a.bmp');% axes(handles.axes2)% imshow('b.bmp');% --- Outputs from this function are returned to the command line.function varargout = noise_estimate_OutputFcn(hObject, eventdata, handles)% varargout  cell array for returning output args (see VARARGOUT);% hObject    handle to figure% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;% --- Executes on mouse press over figure background, over a disabled or% --- inactive control, or over an axes background.function figure1_WindowButtonDownFcn(hObject, eventdata, handles)% hObject    handle to figure1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)%--------------------------------------------------------------------------global s2;global image1;global image2;global e1;global e2;sz=32;a=get(gcf,'CurrentPoint');p=get(handles.axes2,'Position');r1=(a(1)-(p(1)-1));r2=((p(2)+s2(1))-a(2));rect=[r1,r2,sz,sz];if (a(1)>(p(1)-1))&&(a(1)<(p(1)+s2(1)))&&(a(2)<(p(2)+s2(1)))&&(a(2)>(p(2)-1))                       set(handles.position,'String',[num2str(r1),',',num2str(r2)]);%显示点击位置        part1=imcrop(image1,rect); % 截取图像        e1=sqrt(zs_EvalNoiseMRI(part1));% 估算噪声,可换成其它函数        set(handles.show1,'String',num2str(e1));% 显示计算结果        part2=imcrop(image2,rect);                 %显示截取的图像块        ps=get(handles.axes3,'Position');        set(handles.axes3,'Position',[ps(1),ps(2),sz,sz]);        axes(handles.axes3);        imshow(part2);                e2=sqrt(zs_EvalNoiseMRI(part2));        set(handles.show2,'String',num2str(e2));        end%--------------------------------------------------------------------------% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Ofilename1;global image1;global s1;[Ofilename1,pathname]=uigetfile('D:\a\*.bmp;*.jpg','Open image');image1=imread([pathname,Ofilename1]);s1=size(image1);p1=get(handles.axes1,'Position');set(handles.axes1,'Position',[p1(1),p1(2),s1(1),s1(2)]);axes(handles.axes1);imshow(image1);title(Ofilename1);%Oe1=sqrt(zs_EvalNoiseMRI(image1));set(handles.show3,'String',num2str(Oe1));% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Ofilename2;global image2;global s2;[Ofilename2,pathname]=uigetfile('D:\a\*.bmp;*.jpg','Open image');image2=imread([pathname,Ofilename2]);s2=size(image2);p2=get(handles.axes2,'Position');set(handles.axes2,'Position',[p2(1),p2(2),s2(1),s2(2)]);axes(handles.axes2);imshow(image2);title(Ofilename2);%Oe2=sqrt(zs_EvalNoiseMRI(image2));set(handles.show4,'String',num2str(Oe2));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -