DIP课程大作业---图像分割
来源:互联网 发布:淘宝旺旺名能改吗 编辑:程序博客网 时间:2024/05/23 19:17
数字图像处理课程的大作业,要求如下:
图像分割就是把图像分成若干个特定的、具有独特性质的区域并提出感兴趣目标的技术和过程。它是由图像处理到图像分析的关键步骤。现有的图像分割方法主要分以下几类:基于阈值的分割方法、基于区域的分割方法、基于边缘的分割方法以及基于特定理论的分割方法等。图像分割后提取出的目标可以用于图像语义识别,图像搜索等等领域。
要求1:输入一副真彩色RGB图像dog.jpg,完成对小狗的分割,输入结果为只包含小狗区域的二值图(matlab环境下,小狗区域值为1,其他区域值为0)。
要求2:设计一个简单的图形用户界面GUI,显示输入图像和输出图像
<pre name="code" class="plain">function varargout = DIP(varargin)%DIP MATLAB code form DIP.fig%DIP, by itself, creates a new DIP or raises the existing%singleton*.%%H = DIP returns the handle to a new DIP or the handle to%the existing singleton*.%%DIP('CALLBACK',hObject,eventData,handles,...) calls the local%function named CALLBACK in DIP.M with the given input arguments.%%DIP('Property','Value',...) creates a new DIP or raises the%existing singleton*. Starting from the left, property value pairs are%applied to the GUI before DIP_OpeningFcn gets called. An%unrecognized property name or invalid value makes property application%stop. All inputs are passed to DIP_OpeningFcn via varargin.%%*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 DIP%Last Modified by GUIDE v2.5 07-Jun-2015 01:02:20%Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @DIP_OpeningFcn, ... 'gui_OutputFcn', @DIP_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 DIP is made visible.function DIP_OpeningFcn(hObject1, ~, handles1, 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 command line arguments to untitled6 (see VARARGIN)im=imread('dog.jpg'); %第一张图片的显示axes(handles1.axes1);guidata(hObject1, handles1);hold on;imshow(im);handles1.output = hObject1;% Update handles structureguidata(hObject1, handles1);% UIWAIT makes DIP wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = DIP_OutputFcn(~, ~, 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 button press in pushbutton1.function pushbutton1_Callback(axes2, ~,handles2 )% 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)I=imread('dog.jpg');I1=rgb2hsv(I); %转到HSV空间I2=I1(:,:,2); %S分量BW1=im2bw(I2,0.4); bw1=BW1(80:650,45:680); %分割peng = strel('diamond', 2);bw11=imdilate(bw1,peng,'same'); %膨胀bw111=~bw11; %取反saveas(gcf,'dog1','jpg'); axes(handles2.axes2);guidata(axes2, handles2);hold on;imshow(bw111); %显示处理完成的图片
处理完成的图片,效果还不错:
0 0
- DIP课程大作业---图像分割
- DIP大作业--图像拼接
- 数据库系统课程大作业
- 图像处理作业——模糊阈值分割
- 课程作业
- 课程作业
- 关于Java课程大作业的严正声明
- ASP.net课程大作业及论文要求
- 【数据结构课程大作业】通信录管理系统
- 【二叉树系列】二叉树课程大作业
- 图像分割
- 图像分割
- 图像分割
- 图像分割
- 图像分割
- 图像分割
- 图像分割
- 图像分割
- Head First---命令模式
- 散列表---算法导论第十一章 Hash Tables
- Android之Window
- synchronized与static synchronized 的区别
- 编程小问题
- DIP课程大作业---图像分割
- 自定义EditText实现类iOS风格搜索框
- 【整理】链表特征以及代码实现
- 引起获取网络抛异常的情况
- 设计模式之访问者模式,C++实现
- IoC容器Autofac(3) - 理解Autofac原理,我实现的部分Autofac功能(附源码)
- C++函数的返回值问题(2)- C++ 引用的作用和用法
- java spring aop 的代理的简单实现
- HTTP协议