MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在Matlab中光栅化图像? (https://www.labfans.com/bbs/showthread.php?t=24180)

poster 2019-12-10 20:48

如何在Matlab中光栅化图像?
 
我需要在matlab中光栅化图像。我有一个黑白图像,想将其分成8x8的块,并从每个块中获取平均值。然后,我想用一个由1和0组成的新块替换该块,其数量取决于原始块的平均值。

提前致谢!



[B]回答:[/B]

这将使您入门。它是降采样的图像,其中每个值都在零和块大小的平方之间。您可以自行将整数扩展为子矩阵。

bs = 8 a = imread('trees.tif'); [r,c] = size(a); d = imresize(a,[round(r/bs), round(c/bs)]); figure(1) imshow(a) figure(2) imshow(d) mv = max(d(:)) d = round(double(d)/double(mv)*bs*bs); figure(3) imagesc(d)

[url=https://stackoverflow.com/questions/4344980]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:07

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.