✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
文章应用机器视觉技术,采集回流之前的球栅阵列(BGA)芯片图像,对图像进行预处理后,运用点分析方法对图像中各个焊球区域进行标记,建立判断标准并依次序对这些信息进行比对,从而判断芯片合格与否,并对不合格芯片判断其缺陷类型;研究采用MATLAB完成图像预处理以及具体的检测程序编写;实验结果证明,此方法可以正确识别缺陷类型,在检测速度以及可靠性方面有很好的保证.
⛄ 部分代码
% Program to find the two lung regions in a CT cross sectional image.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 22;
%===============================================================================
% Check that user has the Image Processing Toolbox installed.
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end
%===============================================================================
% 读取芯片图像.
folder = pwd;
baseFileName = 'sr.bmp';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows, columns, numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale.
grayImage = rgb2gray(grayImage); % Take green channel.
end
% 对图像进行中值滤波
% grayImage = medfilt2(grayImage,[5,5]);
% Display the original gray scale image.
subplot(2, 3, 1);
imshow(grayImage,[]);
axis on;
title('Original Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
⛄ 运行结果
⛄ 参考文献
[1] 夏链, 贾伟妙, 崔鹏,等. 基于机器视觉的BGA芯片缺陷检测及其MATLAB实现[J]. 合肥工业大学学报:自然科学版, 2009, 32(11):4.
[2] 吴文轩, 陈方斯, 刘建锋,等. 基于MATLAB软件的图像处理技术在电子元器件引脚缺陷检测的应用[J]. 福建轻纺, 2018(1):5.
[3] 杨飞, 祝诗平, 邱青苗. 基于计算机视觉的花椒外观品质检测及其MATLAB实现[J]. 农业工程学报, 2008, 24(1):5.
[4] 李帮建. 基于计算机视觉的表面缺陷检测及应用[D]. 东南大学, 2016.