一分钟了解"用matlab计算信杂比SCR 以及 背景区域的标准差"
2017-08-11 22:05
573 查看
%求SCR和方差的方法
clear,clc,close all
imgName=input('请输入bmp文件名,要有单引号,要有后缀:');
img=imread(imgName);
figure,imshow(img,[])
leftupPointRow=input('请输入目标的左上角的行数(第二坐标):');
leftupPointCol=input('请输入目标的左上角的列数(第一坐标):');
rightdownPointRow=input('请输入目标的右下角的行数(第二坐标):');
rightdownPointCol=input('请输入目标的右下角的列数(第一坐标):');
backgroundAreaWidth=10;
targetVector=img(leftupPointRow:rightdownPointRow,leftupPointCol:rightdownPointCol)
targetSize=size(targetVector);
targetVector=double( targetVector(:) );
backgroundVector1=img(leftupPointRow-10:rightdownPointRow+10,leftupPointCol-backgroundAreaWidth:leftupPointCol-1)
backgroundVector2=img(leftupPointRow-10:rightdownPointRow+10,rightdownPointCol+1:rightdownPointCol+10)
backgroundVector3=img(leftupPointRow-10:leftupPointRow-1,leftupPointCol:rightdownPointCol)
backgroundVector4=img(rightdownPointRow+1:rightdownPointRow+10,leftupPointCol:rightdownPointCol)
backgroundVector=[backgroundVector1(:);backgroundVector2(:);backgroundVector3(:);backgroundVector4(:)];
backgroundVector=double(backgroundVector);
scr=(mean(targetVector)-mean(backgroundVector))/std(backgroundVector);
fprintf(['目标的尺寸是',num2str(targetSize(1)),'x',num2str(targetSize(2)),'\n']);
fprintf(['SCR=',num2str(scr),'\n']);
fprintf(['std(background)=',num2str(std(backgroundVector)),'\n']);
clear,clc,close all
imgName=input('请输入bmp文件名,要有单引号,要有后缀:');
img=imread(imgName);
figure,imshow(img,[])
leftupPointRow=input('请输入目标的左上角的行数(第二坐标):');
leftupPointCol=input('请输入目标的左上角的列数(第一坐标):');
rightdownPointRow=input('请输入目标的右下角的行数(第二坐标):');
rightdownPointCol=input('请输入目标的右下角的列数(第一坐标):');
backgroundAreaWidth=10;
targetVector=img(leftupPointRow:rightdownPointRow,leftupPointCol:rightdownPointCol)
targetSize=size(targetVector);
targetVector=double( targetVector(:) );
backgroundVector1=img(leftupPointRow-10:rightdownPointRow+10,leftupPointCol-backgroundAreaWidth:leftupPointCol-1)
backgroundVector2=img(leftupPointRow-10:rightdownPointRow+10,rightdownPointCol+1:rightdownPointCol+10)
backgroundVector3=img(leftupPointRow-10:leftupPointRow-1,leftupPointCol:rightdownPointCol)
backgroundVector4=img(rightdownPointRow+1:rightdownPointRow+10,leftupPointCol:rightdownPointCol)
backgroundVector=[backgroundVector1(:);backgroundVector2(:);backgroundVector3(:);backgroundVector4(:)];
backgroundVector=double(backgroundVector);
scr=(mean(targetVector)-mean(backgroundVector))/std(backgroundVector);
fprintf(['目标的尺寸是',num2str(targetSize(1)),'x',num2str(targetSize(2)),'\n']);
fprintf(['SCR=',num2str(scr),'\n']);
fprintf(['std(background)=',num2str(std(backgroundVector)),'\n']);
相关文章推荐
- 一分钟了解"matlab绘3D图_mesh和surf以及其区别"
- 一分钟了解"matlab与c混合编程mex"
- 一分钟了解"如何把matlab代码变成不需要输入输出的函数"
- 一分钟了解"形容背景很复杂的英语词汇"
- 一分钟了解"matlab用meshgrid实现for循环的遍历功能"
- 一分钟了解"matlab在命令窗口显示句子命令disp"
- 一分钟了解"matlab给图片加噪声imnoise"
- 一分钟了解"matlab把指定的变量保存在mat文件中的语句save"
- 一分钟了解"matlab进行特征值分解"
- 一分钟了解"matlab小数取整运算"
- 一分钟了解"matlab自动把彩色图转换成灰度图"
- 一分钟了解"matlab进行奇异值分解SVD"
- 第一步,我想我总算找到用Matlab计算"卷积"以及,进行"可逆"的"解卷积"的途径了
- 一分钟了解“Matlab矩阵 [~,a,b,c]的~是什么意思”
- 一分钟了解"c语言求绝对值函数abs"
- 用PostgreSQL了解一些统计学术语以及计算方法和表示方法 - 1
- 一分钟了解“MATLAB对图像任意mask滤波”
- 一分钟了解"英语表达变化取值范围及其变化的原因"
- 一分钟了解“Matlab实现tophat变换”
- 一分钟了解“Matlab实现max-median滤波”