当前位置:网站首页>【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
2022-07-03 18:49:00 【海神之光】
一、机器视觉识别简介
颜色是物体表面的固有特征, 在目标识别和图像分割中有着无法替代的作用。机器视觉是利用光电成像系统和图像处理模块对物体进行尺寸、形状、颜色等的识别。这样, 就把计算机的快速性、可重复性, 与人眼视觉的高度智能化和抽象能力相结合, 用机器代替人眼来作各种测量和判断, 大大提高了生产的柔性和自动化程度。图像处理中最适合显示系统的颜色空间是RGB颜色空间, 但其R、G、B3个分量高度相关, 阈值选择困难, 本文提出了一种稳定颜色空间的图像分割和识别方法, 并应用于自动生产线, 取得良好效果。
1 系统结构
机器视觉系统结构如图1所示。
机器视觉系统中, 从获得图像数据到最后获得处理结果, 通常要经过很多种算法。同时, 不同目的的机器视觉系统要求对图像作的运算也大为不同。机器视觉系统的输入是图像, 而最后的输出则是一些符号或者数值, 这些符号或数值, 有可能表达了物体的特性 (正品/次品, 阿拉伯数字等) 和位置 (集成电路引脚的位置等等) 。
2.1 图像平滑
采集的图像常有噪声干扰, 图像平滑处理有利于改善图像质量[, 本文采用自适应中值滤波算法。设Sx, y表示中心点 (x, y) 在给定时间的掩模窗口。设Zmin为Sx, y中灰度级最值;Zmed为Sx, y中灰度级中值;Zmax为Sx, y中灰度级最大值;Zx, y为像素 (x, y) 的灰度级;Smax为Sx, y允许最大的尺寸。自适应中值滤波器算法为:
A层算法
如果A1>0&A2>0转到B层。否则, 增大窗口尺寸。
如果窗口尺寸≤Smax重复A层。否则输出Zx, y。
B层算法
如果A1>0&A2>0, 输出Zx, y。否则输出Zmed。
2.2 颜色模型转换
装置采集的图像为RGB模型, 为避免计算机对图像进行处理时因三个量相互影响产生色差或者颜色失真而导致系统误判, 需要转换为HSI模型, 本文采用几何推导法进行RGB-HSI转换, 将RGB中的亮度因素进行圆柱极坐标的双椎体转换, 将三维变为二维, 在平面中求出HSI模型的色调分量值。
转换公式如下:
其中:H定义颜色的波长, 称为色调;S表示颜色的深浅程度, 称为饱和度;I表示强度或亮度。
2.3 物体识别
阈值彩色图像分割
生产线机器视觉系统中拍摄的物体受光照、噪声等环境影响, 采集到的物体图像颜色会与实际颜色存在差异, 物体之间也会存在一定颜色的差异, 同一个物体不同部分也可能存在颜色差异, 要准确识别物体, 需要通过图像分割来判断相邻区域颜色的相似度[7]。阈值法图像分割需要选取合适的阈值, 将计算机获取的经过颜色模型变换的图像色彩特征与设定的阈值进行比较, 以区分工件和背景。
f (x, y) 为计算机采集的图像色彩特征;T为设定的阈值。如果将图像二值化, 则b0为0, b1为1。这种方法对被识别物体为单一颜色时较适合。
二、部分源代码
function varargout = cancer(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @cancer_OpeningFcn, ...
'gui_OutputFcn', @cancer_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{
1})
gui_State.gui_Callback = str2func(varargin{
1});
end
if nargout
[varargout{
1:nargout}] = gui_mainfcn(gui_State, varargin{
:});
else
gui_mainfcn(gui_State, varargin{
:});
end
function cancer_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = cancer_OutputFcn(hObject, eventdata, handles)
varargout{
1} = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
global I
clc
[filename, pathname] = uigetfile('*.jpg', 'Pick an Image');
if isequal(filename,0) | isequal(pathname,0)
warndlg('File is not selected');
else
I=imread(filename);
axes(handles.axes1)
imshow(I);
title 'Input Image'
end
title '输入肺图像'
function pushbutton2_Callback(hObject, eventdata, handles)
global I
t=rgb2gray(I);
he=histeq(t);
axes(handles.axes2);
imshow(he);
title '直方图均衡'
function pushbutton3_Callback(hObject, eventdata, handles)
global I
t=rgb2gray(I);
he=histeq(t);
threshold = graythresh(he);
bw = im2bw(he,threshold);
三、运行结果

四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020.
[2]杨丹,赵海滨,龙哲.MATLAB图像处理实例详解[M].清华大学出版社,2013.
[3]周品.MATLAB图像处理与图形用户界面设计[M].清华大学出版社,2013.
[4]刘成龙.精通MATLAB图像处理[M].清华大学出版社,2015.
3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除
边栏推荐
- PyTorch中在反向传播前为什么要手动将梯度清零?
- Hard disk monitoring and analysis tool: smartctl
- Torch learning notes (7) -- take lenet as an example for dataload operation (detailed explanation + reserve knowledge supplement)
- [combinatorics] exponential generating function (example of exponential generating function solving multiple set arrangement)
- High concurrency Architecture - distributed search engine (ES)
- SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
- Torch learning notes (4) -- torch's dynamic calculation diagram
- The installation path cannot be selected when installing MySQL 8.0.23
- Raft 日志复制
- my. INI file not found
猜你喜欢

虚拟机和开发板互Ping问题

我们做了一个智能零售结算平台

Add control at the top of compose lazycolumn

2022-2028 global solid phase extraction column industry research and trend analysis report

Record: pymysql is used in pycharm to connect to the database

Chisel tutorial - 06 Phased summary: implement an FIR filter (chisel implements 4-bit FIR filter and parameterized FIR filter)

Ping problem between virtual machine and development board

Implementation of cqrs architecture mode under Kratos microservice framework

组策略中开机脚本与登录脚本所使用的用户身份

Mysql45 lecture learning notes (II)
随机推荐
硬盘监控和分析工具:Smartctl
PyTorch中在反向传播前为什么要手动将梯度清零?
SQL: special update operation
application
Gao Qing, Beijing University of Aeronautics and Astronautics: CIM is a natural quantum computing platform for graph data processing
Real time split network (continuous update)
Mysql45 lecture learning notes (II)
多媒体NFT聚合平台OKALEIDO即将上线,全新的NFT时代或将来临
虚拟机和开发板互Ping问题
SSM integration - joint debugging of front and rear protocols (list function, add function, add function status processing, modify function, delete function)
Recent learning experience
Record: writing MySQL commands
Torch learning notes (2) -- 11 common operation modes of tensor
[Yu Yue education] theoretical mechanics reference materials of Shanghai Jiaotong University
Record: MySQL changes the time zone
Record: install MySQL on ubuntu18.04
Sepconv (separable revolution) code recurrence
Transformer T5 model read slowly
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time