matlab 图像上生成指定中心,指定大小的矩形窗

用matlab实现在图像上生成指定中心,指定大小的矩形窗(奇数*奇数)

function PlaneWin = PlaneWindow(CentreCoorX,CentreCoorY,RadiusX,RadiusY,SizeImRow,SizeImColumn)
% 在图像上生成指定中心,指定大小的矩形窗(奇数*奇数)
%
% Input:
% CentreCoorX(1*1)
% CentreCoorY(1*1)
% RadiusX(1*1)
% RadiusY(1*1)
% SizeImRow(1*1)
% SizeImColumn(1*1)
% Output:
% PlaneWin(SizeImRow*SizeImColumn)
%
% X.F.Zhang (2010/11/24, v1.0)
%
ZEROS_FLAG = 1;
StartRowCoor = CentreCoorX-RadiusX; StartColumnCoor = CentreCoorY-RadiusY;
if StartRowCoor < 1
StartRowCoor = 1;
elseif StartRowCoor >= SizeImRow
error('(1)The Central Coordination isn''t in the image!');
end
if StartColumnCoor < 1
StartColumnCoor = 1;
elseif StartColumnCoor >= SizeImColumn
error('(2)The Central Coordination isn''t in the image!');
end

EndRowCoor = CentreCoorX+RadiusX; EndColumnCoor = CentreCoorY+RadiusY;
if EndRowCoor > SizeImRow
EndRowCoor = SizeImRow;
elseif EndRowCoor <= 0
error('(3)The Central Coordination isn''t in the image!');
end
if EndColumnCoor > SizeImColumn
EndColumnCoor = SizeImColumn;
elseif EndColumnCoor <= 0
error('(4)The Central Coordination isn''t in the image!');
end

PlaneWin = zeros(SizeImRow, SizeImColumn);
if ZEROS_FLAG
for i = StartRowCoor:EndRowCoor
for j = StartColumnCoor:EndColumnCoor
PlaneWin(i,j) = 1;
end
end
end

end

MATLAB窗函数-矩形窗 三角窗 汉宁窗 海明窗 布拉克曼窗 恺撒窗 

相关推荐

  1. matlab 图像生成指定中心,指定大小矩形

    2023-12-29 03:54:01       66 阅读
  2. linux 生成指定大小文件——dd命令

    2023-12-29 03:54:01       29 阅读
  3. C# 生成指定图片缩略图

    2023-12-29 03:54:01       30 阅读
  4. 获取图像大小 - 编程指南

    2023-12-29 03:54:01       55 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-29 03:54:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-29 03:54:01       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-29 03:54:01       82 阅读
  4. Python语言-面向对象

    2023-12-29 03:54:01       91 阅读

热门阅读

  1. 2660. 保龄球游戏的获胜者

    2023-12-29 03:54:01       60 阅读
  2. electron-builder构建生产安装包下载失败问题

    2023-12-29 03:54:01       52 阅读
  3. 如果去掉前端请求参数中的前后空格?

    2023-12-29 03:54:01       66 阅读
  4. 第三章 语言基础-数据类型-Symbol补充

    2023-12-29 03:54:01       46 阅读
  5. 基于SpringBoot的校园生活服务平台

    2023-12-29 03:54:01       59 阅读
  6. 项目管理的核心技能

    2023-12-29 03:54:01       54 阅读
  7. 【洛谷】单词翻转

    2023-12-29 03:54:01       59 阅读
  8. react使用useState更新数组失败

    2023-12-29 03:54:01       67 阅读