Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 matlab 中栅格化图像。我有 ab/w 图像,想将它分成 8x8 块并从每个块中获取平均值。然后我想用一个由 1 和 0 组成的新块替换该块,其中的数量取决于原始块的平均值。
提前致谢!
这会让你开始。它是下采样图像,其中每个值都介于零和块大小的平方之间。您自己将该整数扩展为子矩阵。
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)