Continuous monochrome image sampling

2 ビュー (過去 30 日間)
Ahmad Alosta
Ahmad Alosta 2022 年 9 月 8 日
コメント済み: Ahmad Alosta 2022 年 9 月 25 日
How can I sample a continuous monochrome image (f(x, y) = x(1 − y) + y(1 − x), 0 ≤ x ≤ 1, 0 ≤ y ≤ 1) to a discrete image with with 5 x 7 pixels by letting the lower left pixel be a sample from point (0,0) and the upper right from (1,1)?
How it could be quantify the discrete image with 32 different gray levels from 0 to 31??

採用された回答

Walter Roberson
Walter Roberson 2022 年 9 月 8 日
xvec = linspace(0,1,7); %x is columns
yvec = linspace(0,1,5); %y is rows
[X, Y] = meshgrid(xvec, yvec);
F = X.*(1-Y) + Y.*(1-X);
imagesc(F); colormap(gray)
  4 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 9 日
For the case where what you care about is 32 gray levels
xvec = linspace(0,1,7); %x is columns
yvec = linspace(0,1,5); %y is rows
[X, Y] = meshgrid(xvec, yvec);
F = X.*(1-Y) + Y.*(1-X);
imagesc(F); colormap(gray(32))
For the case where you do care about the array being represented as 0 to 31
xvec = linspace(0,1,7); %x is columns
yvec = linspace(0,1,5); %y is rows
[X, Y] = meshgrid(xvec, yvec);
F = X.*(1-Y) + Y.*(1-X);
Fq = floor(rescale(F,0,32*(1-eps)));
imagesc(Fq); colormap(gray(32))
Ahmad Alosta
Ahmad Alosta 2022 年 9 月 25 日
Thanks a lot :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by