数字图像处理-函数矩阵

1 题目一

1.1 实验题目

1)随机生成一个 0-1 的 8 行 10 列的矩阵,将小于 0.5 的数赋值为 0,大于 0.5 的数赋值为 1

2)利用循环给数组赋值,并用 image 函数显示

1.2 程序源代码

Matlab 复制代码
A = rand(8,10);
B = A;
disp(A);
subplot(2,1,1);
image(A);
title('原始矩阵');
for count_i = 1:8
for count_j = 1:10
if A(count_i, count_j) < 0.5
B(count_i, count_j) = 0;
else
B(count_i, count_j) = 1;
end
end
end
disp(B);
subplot(2,1,2);
image(B);
title('处理结果');

1.3 运行结果

2 题目二

2.1 实验题目

阐述并配合必要的运行结果展示 imshow 和 image 区别与联系;

2.2 题目解答

image 是用来显示附标图像,即显示的图像上有 x,y 坐标轴的显示,可以看到图像 的像素大小。imshow 只是显示图像。

2.3 程序代码说明

Matlab 复制代码
A = imread('testjpg.jpg');
x1 = A(:,:,1);
x2 = A(:,:,2);
x3 = A(:,:,3);
figure(1)
subplot(2,2,1),imshow(A)
subplot(2,2,2),imshow(x1)
subplot(2,2,3),imshow(x2)
subplot(2,2,4),imshow(x3)
figure(2)
subplot(2,2,1),image(A)
subplot(2,2,2),image(x1)
subplot(2,2,3),image(x2)
subplot(2,2,4),image(x3)
相关推荐
sqc233sqc7 分钟前
第 J8 周:ResNeXt-50 算法解析
人工智能·算法
hanlin0310 小时前
刷题笔记:力扣第32题-最长有效括号
笔记·算法·leetcode
All for pursuit.10 小时前
【动态规划-21】312.戳气球
数据结构·c++·算法·leetcode·动态规划
碧海银沙音频科技研究院12 小时前
基于炬芯ATS3089X自研AEC声学回声消除算法
算法
通问AI13 小时前
在两台 Mac Studio 上跑 800B 模型:MLX + RDMA over Thunderbolt 实测与四道门选型法
算法
ZywOo62313 小时前
《算法竞赛进阶指南》0x03 前缀和与差分
算法
Scintilla_y13 小时前
DAY2 滑动窗口
算法·leetcode·散列表
lvwangshu13 小时前
笛卡尔树
算法·图论
026d2313 小时前
状态信号只知“其然”不知“其所以然”:变工况机械故障诊断的物理盲区
算法
姜鱼问生14 小时前
备份和服务器在同一台机器上,等于没备份
算法·架构