我通过表示图像中每个像素强度的整数列表来表示图像。每个点都是0或1.根据这些数据,我如何计算抗锯齿值,以便最终结果是平滑的?
示例数据:
// What I have
const aliased = [
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 0, 0, 1, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0,
0, 1, 0, 1, 0,
0, 0, 1, 0, 0,
0, 0, 0, 0, 0,
];
// What I want to calculate
const smoothed = [
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 0, 0, 1, 0,
0, 0, 1, 0, 0.5, // <- point with intensity of 50%
0, 0, 0, 1, 0,
0, 1, 0, 1, 0,
0, 0, 1, 0, 0,
0, 0, 0, 0, 0,
];