Continuous monochrome image sampling

1 visualizzazione (ultimi 30 giorni)
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??

Risposta accettata

Walter Roberson
Walter Roberson il 8 Set 2022
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 Commenti
Walter Roberson
Walter Roberson il 9 Set 2022
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))

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Images in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by