AForge.NET - 帮助图像识别 [英] AForge.NET - Help with Image Recognition

查看:144
本文介绍了AForge.NET - 帮助图像识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的希望你能帮助我,我真的被困了。



我已经是C#商业应用程序开发人员10年了,我想我会有一些图像检测,因为它是我真正感兴趣的东西。



我的项目的基本轮廓,用于测量照片中的对象。我在地板上有一张A4纸,上面放一只脚,一只手,一支笔 - 一个苹果......不管怎么样......应用程序会测量它。


所以,到目前为止我已经尝试了以下过滤器..



1)灰度图像,

2 )CannyEdgeDetector过滤器,

3)添加二进制过滤器



然后我......



处理图像中的Blob,

在blob周围绘制矩形并将矩形尺寸存储在一个数组中。



Image在这里: Clicky [ ^ ]



(这是我的脚)



我试着检测一张纸(我知道尺寸是210mm x 294mm所以我做了一些简单的数学计算。



然后我尝试找到对象矩形和以毫米为单位返回它的大小(使用A4作为参考点)



我的问题是:



1)我使用的是正确的过滤器 - 是否有更好的过滤器可以用来使图像更易于检测形状?

2)我使用正确的方法吗?我应该探索另一类/一套程序吗?

3)我应该放弃吗?



谢谢,

Lee

Really hoping you can help me, I'm really stuck.

I've been a C# business apps developer for 10 years, I thought I'd have a go at some image detection as it's something that really interests me.

Basic outline of my project it to measure an object from a photo. I have an A4 sheet of paper on the floor, on which I'll put a foot, hand, a pen - apple.. whatever... and the app will measure it.

So, I've tried the following filters in order so far..

1) Grayscaled image,
2) CannyEdgeDetector filter,
3) Added Binary Filter

I then...

Process the Blobs in the image,
Draw rectangles around the blobs and store the rectangle dimensions in an array.

Image Here : Clicky[^]

(That's my foot)

I try to detect the sheet of paper (I know the dimensions are 210mm x 294mm So I do some simple maths to work out the scale.

I then try and find the object rectangle and return the size of it in millimetres (Using the A4 as a point of reference)

My question is this:

1) Am I using the correct filters - is there a better set of filters I can use to make the image easier to detect shapes on?
2) Am I using the correct method? Is there another class/set of procedures I should be exploring?
3) Should I give up?

Thanks,
Lee

推荐答案

您的问题不仅仅是图像过滤,还会将预期空间的坐标转换为真实空间。你说你有一张尺寸为210mm x 294mm的纸张,但拍摄的图像并不是出于多种原因。


首先,它以像素为单位。您需要确定mm的像素是多少。这当然取决于相机与物体的距离。如果你需要它是动态的,它会变得更加复杂。为简单起见,我们假设您将相机和纸张放在固定位置。这允许你说1个像素等于XXmm。



然而这只是最佳的。事实上,镜头是用于所有目的的一个点,而纸是一个平面。这意味着某些区域有1个像素到XXmm,但是当你从这些位置进一步观察时,错误和失真会增加。



必须确定这个错误然后适用于其他对象。它来自于平面上的每个点与相机的距离不同,涉及所有3个坐标X,Y和Z(请记住,镜头可能相对于表面有最轻微的倾斜)。要计算此错误,您必须在纸上找到已知区域。例如,您知道角是直角。您可以使用它们来计算纸张的扭曲。然而,随着远离这些点,失真会增加。这意味着越多越好。

例如,相反,你使用的是绘图纸。现在,您的图像已经捕获了一张应该包含大量正方形的图纸。既然你知道这些正方形正好是1厘米(或其他)并且具有完美的角度,你可以通过飞机更准确地计算失真。



一旦你拥有真正的价值您可以将它们与期望值一起使用来计算对象尺寸。
Your problem is not just image filtering but also transforming the coordinates of expected space to real space. You say you have a piece of paper that measures 210mm x 294mm, however the image captured is not for multiple reasons.

First, it is in pixels. You will need to determine what a pixel to a mm is. This of course depends on the distance of the camera from the object. If you need this to be dynamic, it gets even more complicated. For the sake of simplicity lets say you place the camera and the piece of paper at a fixed location. This allows you to say 1 pixel equals XXmm.

This is however only optimally true. The truth is the lens is for all purposes a "point" while the paper is a plane. Meaning that some areas have 1 pixel to XXmm, but as you observe further from those locations the error and distortion will grow.

This "error" must be determined and then applied to the other object. It comes from the fact that each point on the plane is a different distance from the camera involving all 3 coordinates X,Y, and Z (keep in mind the lens may have the slightest tilt in relation to the surface). In order to calculate this error you must find known areas on the piece of paper. For example you know the corners are right angles. You could use those to calculate the distortion of the paper. However, as move away from those points the distortion would grow. This means the more points the better.
For example, say instead you used graphing paper. Now your image has captured a sheet that should have numerous squares all over. Since you know these squares are exactly 1cm (or whatever) and have perfect angles you could calculate the distortion more accurately through out the plane.

Once you have the real values you can use them with the expected values to calculate the objects dimensions.


这篇关于AForge.NET - 帮助图像识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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