Image Sampling of Varying Line Frequencies and Pixel Fill Factors

版本 1.0.0.0 (3.1 KB) 作者: Costas Vlachos
Simulates image sampling of varying line frequencies.
49.0 次下载
更新时间 2017/1/15

查看许可证

IMG = image_sampling(CYCLES,TYPE,FMIN,FMAX,FILL,W,H,OUT) computes a grayscale image of dimensions W by H pixels, stored in matrix IMG, which results by sampling an image resolution chart containing CYCLES spatial cycles of line frequencies from FMIN to FMAX cycles/pixel. The type of cycles is specified in TYPE, and can be 'sine' (for sinusoidal line intensity variations) or 'square' (for a B&W chart). The pixel fill factor is specified in FILL, and can range from 0 (for sampling a zero-area point at each pixel, with no averaging), to 1 (for sampling the average values in the entire area occupied by each pixel), and can even be greater than 1 (for sampling an area of several pixels around each pixel). If OUT = 'show', the resulting image is shown in a figure. If OUT = 'save', the image is saved in file 'image_sampling.tif'. If OUT is omitted, nothing is shown or saved.

The following example shows three image resolution charts with line frequencies from 0.05 to 1 cycle/pixel (twice the Nyquist limit). The three charts correspond to pixel fill factors of 0, 1, and 2 (from top to bottom). The resulting images demonstrate the aliasing effects that occur as the line frequency goes beyond the Nyquist limit, and how they can be limited by increasing the pixel fill factor (i.e., by using an anti-aliasing filter).

IMG_F0 = image_sampling(10,'square',0.05,1,0,800,200);
IMG_F1 = image_sampling(10,'square',0.05,1,1,800,200);
IMG_F2 = image_sampling(10,'square',0.05,1,2,800,200);
imshow([IMG_F0 ; IMG_F1 ; IMG_F2])

If the values of parameters W, H, and CYCLES, are not even integers, they are rounded to the nearest even integers.

引用格式

Costas Vlachos (2024). Image Sampling of Varying Line Frequencies and Pixel Fill Factors (https://www.mathworks.com/matlabcentral/fileexchange/61157-image-sampling-of-varying-line-frequencies-and-pixel-fill-factors), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2016b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Improved description layout.