识别 20x20 像素正方形中线条的有效方法
识别 20x20 像素正方形中的线条和边缘的有效方法。我正在迭代 20x20 像素块中的图像,想要识别亮度存在明显差异的位置并突出显示所有这些边缘。同一个正方形中可以有多条线相互重叠。
我正在形成一个 20x20 像素块的数组,其中像素亮度为 l = (0-255),像素位置为 [x, y] array = [[l, [x, y]], ...]
到目前为止,我已尝试过:
- 查找范围以突出显示较大差异的块,但这无助于拾取更细微的差异图片中注意到的变化。
- 与平均值相差 3 倍标准差
我迭代图像的方式是从中间顶部的 20x20 正方形开始,然后向下、向左和向右(以橙色表示)。进一步遵循相同的模式(浅蓝色)
将需要更复杂的分析来捕捉像素颜色的细微变化。有人能指出我正确的方向吗?
Efficient ways of recognizing lines and edges in a 20x20 pixel square. I am iterating through an image in 20x20 pixel blocks and want to recognize where there are distinct differences in luminance and highlight all of these edges. There can be multiple lines in the same square overlapping each other.
I am forming an array of the 20x20 pixel block where pixel luminance is l = (0-255) and pixel location is [x, y]
array = [[l, [x, y]], ...]
I have attempted so far:
- Finding range to highlight blocks of large differences, however this does not help with picking up the more subtle changes noted in the picture.
- 3xstandard deviation away from average
The way I am iterating through the image is starting at the middle top 20x20 square then working out downwards, left and right (demonstrated by orange). Further following the same pattern (light blue)
It is going to require more complex analysis to pick up the subtle changes in pixel colour. Can anyone point me in the correct direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这或多或少就是卷积神经网络识别不同特征的作用,您可以阅读它。
您需要制作一个内核(即矩阵)。内核将对您要查找的形状进行编码,正数通常在 0 到 1 之间。
然后您对图像进行内核卷积,它将输出另一个图像(矩阵),突出显示与您的图像更相似的位置内核,即你的角和线。
可以在 scipy 找到一个简单的实现
This is more or less what a convolutional neuronal network does to recognize different features, you can read about it.
You need to make a kernel (that is a matrix). The kernel will encode the shape you are looking for, with positive numbers normally between 0 and 1.
Then you make a convolution of your kernel over the image, and it will output another image (matrix) highlight the places that are more similar to your kernel, i.e. your corners and lines.
A simple implementation could be found at scipy