处理此算法的最佳方法是什么? [英] What is the best way to approach this algorithm?

查看:130
本文介绍了处理此算法的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我目前正在使用AForge Framework开展项目。我正在尝试实现一种称为三步搜索的算法。它将用于通过网络摄像头进行运动检测。





三步搜索(TSS)[1,2]



这个算法是由Koga等人于1981年引入的。它因其简单性和稳健性以及近乎最佳的性能而变得非常流行。它以粗到精的搜索模式搜索最佳运动矢量。该算法可以描述为:



步骤1:选择初始步长。挑选距离中心(中心区域周围)步长的八个街区进行比较。



步骤2:步长减半。中心移动到失真最小的点。



重复步骤1和2,直到步长小于1.一个特定的收敛路径该算法如下所示:



http://www.ece.cmu.edu/~ee899/project/r4-1.gif [ ^ ]



图2:三步收敛的示例路径搜索



资料来源: http://www.ece.cmu.edu/~ee899/project/deepak_mid.htm [ ^ ]





我遇到的问题我们正在理解如何为它所说的选择初始步长的部分设置坐标。距离的八个街区从中心(中心区域周围)的步长进行选择以进行比较。



我知道这些块是使用称为均方误差的公式进行比较的。如果我能想出一种创建搜索块的方法,那么在确定如何实现该算法的其余部分方面会有很长的路要走。如果这有点令人困惑,请道歉。我试图以最好的方式解释它。我可能会以完全错误的方式解决这个问题,因为我对C#及其概念相对较新。



我一直在Matlab网站上找到了源码算法的代码,但它是为Matlab编写的,我不明白。



我在这里上传了Matlab代码,这有助于理解它。



http://pastebin.com/sCKXZhKx [ ^ ]

Hi,

I am currently working on a project using the AForge Framework. I am trying implement an algorithm called the "three step search". It will be used for motion detection via a webcam.


Three Step Search (TSS) [1,2]

This algorithm was introduced by Koga et al in 1981. It became very popular because of its simplicity and also robust and near optimal performance. It searches for the best motion vectors in a coarse to fine search pattern. The algorithm may be described as:

Step 1: An initial step size is picked. Eight blocks at a distance of step size from the centre (around the centre block) are picked for comparison.

Step 2: The step size is halved. The centre is moved to the point with the minimum distortion.

Steps 1 and 2 are repeated till the step size becomes smaller than 1. A particular path for the convergence of this algorithm is shown below:

http://www.ece.cmu.edu/~ee899/project/r4-1.gif[^]

Fig 2 : Example path for convergence of Three Step Search

Source: http://www.ece.cmu.edu/~ee899/project/deepak_mid.htm[^]


The problem I have having is understanding how the coordinates are set for the part where it says "An initial step size is picked. Eight blocks at a distance of step size from the centre (around the centre block) are picked for comparison."

I do know that these blocks are compared using a formula called mean square error. If I could just figure out a way of creating the search block then it would go a long way in figuring out how to implement the rest of this algorithm. Apologies if this is a bit confusing to understand. I have tried to explain it the best way possible. I could be going about this the total wrong way as I am relatively new to C# and its concepts.

I have been on the Matlab website where I have found the source code for the algorithm but it is written for Matlab which I do not understand.

I have uploaded the Matlab code here is that helps understand it more.

http://pastebin.com/sCKXZhKx[^]

推荐答案

问题,据我所知,正在确定您的STARTING参考象限。您的意图是使用网络摄像头。网络摄像头具有可变但有限数量的可能步长,如果我们想将其作为我们考虑的单位,则使用象限,因为步骤将会改进。



看起来您的初始象限应该被定义为一个功能,它可以分割出可用的像素,这是一个变量,具体取决于所用摄像机的功能。在这个用例中,像素(或块)是定义象限的度量单位。



让x =水平像素,y =垂直像素



q1 =(0,0)到(x / 2-1,y / 2-1)

q2 =(x / 2,0)到(x,y / 2-1)

q3 =(0,y / 2)到(x / 2-1,y)

q4 =(x / 2,y / 2)到(x,y)



这是你的起始条件。
The issue, as I understand it, is determining your STARTING reference quadrants. Your intent is to use a webcam. A webcam has a variable but finite number of possible steps sizes, or quadrants if we want to use that as our unit of consideration, as that's what the steps will refine.

It would appear that your initial quadrants should be defined as a function which segments out the pixels available, which is a variable depending on the capabilities of the camera being used. In this use case, pixels(or blocks of) are your unit of measure to define quadrants.

let x=horizontal pixels, y = vertical pixels

q1 = (0,0) to (x/2-1,y/2-1)
q2 = (x/2,0) to (x,y/2-1)
q3 = (0,y/2) to (x/2-1,y)
q4 = (x/2,y/2) to (x,y)

This is your starting condition.


这篇关于处理此算法的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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