如何像素化一组线成矩阵 [英] How to pixelate a set of lines into a matrix

查看:262
本文介绍了如何像素化一组线成矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来很简单的问题。 有许多线路可以作为他们的两个端点。 现在的问题是如何离散成一个矩阵。则矩阵可以用于图像处理的用途。 在下面的图中的例子线(黄色)和它们相应的像素化的示范显示。 一块code中的任何语言​​,将有很大的帮助,强烈推荐,当然是提前AP preciated。 需要注意的是性能和精度是非常重要的因素。
另外,作为展示的每一点行必须只有一个像素(即矩阵的元素)相关联。

It looks a very simple question. There are many lines available as their two endpoints. The question is how to discretize them into a matrix. Then the matrix can be used for image processing purposes. At the following figure example lines (yellow) and their corresponding pixelated demonstrations are shown. A piece of code in any language would be of great help and strongly recommended and of course is in advance appreciated. Note that performance and accuracy are very important factors.
Also as demonstrated each point of line must have only one pixel (i.e., element of matrix) associated.

推荐答案

最简单的方法是使用 Bressenham算法

这篇关于如何像素化一组线成矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆