Continuous monochrome image sampling

1 vue (au cours des 30 derniers jours)
Ahmad Alosta
Ahmad Alosta le 8 Sep 2022
Commenté : Ahmad Alosta le 25 Sep 2022
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??

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Sep 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 commentaires
Walter Roberson
Walter Roberson le 9 Sep 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))
Ahmad Alosta
Ahmad Alosta le 25 Sep 2022
Thanks a lot :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by