Software Testing:简要描述领你印象最深的error在你的项目

problem:

In a program that uses Opencv for image processing. My goal is to use the camera to identify the precise coordinates of multiple balls. But because of the light, in the identification process, the coordinates of the ball sometimes accurate sometimes sometimes inaccurate, in order to make each identified the ball coordinates can be more accurate. We need to each ball to identify the coordinates of the average to get a more accurate coordinates.

I use the following way to average the ball coordinates.

First, we should save the coordinates identified this time to the array ballpre [], and then to the next time to identify the ball in the process, with the coordinates (x, y) and ballpre [] coordinates in the calculation of the distance. The minimum distance is to identify the coordinates of a same small ball, and then add them together. Finally using the sum of coordinates divided by the number of times identified by the coordinates.

At first I thought that my method was right, but at the time of the run, I found that the result was wrong.

Why this error impress I most?

Because this problem I spent a lot of time, at first thought that the algorithm error, and constantly to check the algorithm and grammar. There is another reason that this project is submitted in my first time to participate in the competition.

How did I find it?    What is the error?

And then I print out the data every time, analyze it, I found that the reason is that some of the ball in a recognition process has not been identified, so it is divided by the number of identification should not be the total number of identification.

Solution:Add an array to control the number of times the ball is recognized. We use the elements in this array as the denominator of the above formula.

The following is the specific code:

for (int i = 0; i < MIN(count_x, 20); i++)

{

if (ci == 0)

{

xx1[i] = x[i];

yy1[i] = y[i];

sum_x[i] += x[i];

sum_y[i] += y[i];

for (int i = 0; i < count_x; i++)

{

sumx[i] = 1;

}

for (int i = count_x; i < 100; i++)

{

sumx[i] = 0;

}

}

for (int j = 0; j < count_x; j++)

{

//float * q = (float *)cvGetSeqElem(cir, j);

if (ci > 0)

{

double a = pow(x[j] - xx1[i], 2) + pow(y[j] - yy1[i], 2);

if (cvRound(sqrt(a)) <= 15)

{

//cout << cvRound(q[0]) << "   " << x1[i] << endl;

//cout << cvRound(q[1]) << "   " << y1[i] << endl;

//cout << "sqrt(a)" << sqrt(a) << endl;

sum_x[i] += x[j];

sum_y[i] += y[j];

sumx[i]++;

break;

}

if (j == count_x&&cvRound(sqrt(a)) > 15)

{

sum_x[j] += x[j];

sum_y[j] += y[j];

sumx[j]++;

}

}

}

xx[i] = sum_x[i] / sumx[i];

yy[i] = sum_y[i] / sumx[i];

}

}

时间: 2024-11-16 05:28:44

Software Testing:简要描述领你印象最深的error在你的项目的相关文章

Exploratory Software Testing

最近找到去年上半年看过一本关于测试方面书籍的总结笔记,一直放在我的个人U盘里,当时是用Xmind记录的,现在重新整理下分享给大家了! James A.Whittaker [美] 詹姆斯·惠特克(软件测试领域绝对的大师)著作<Exploratory Software Testing>,中文名<探索式软件测试>,记得当时被这本书深深吸引啦(我不知道有多少做测试的小伙伴看过这本书)!感觉是测试方面一本必不可少的书籍,瞬间感觉测试的魅力!废话不多说,直接来干货,希望可以给对探索式测试喜欢或

Software Testing Techniques LAB 02: Selenium

1. Installing 1. Install firefox 38.5.1 2. Install SeleniumIDE    After installing, I set the view of toolbox, then we can see this 3. Install Selenium Client & WebDrive 4. Install Selenium Standalone Server 5. Installed Test After downloading we hav

简要描述客户端发送的http request header都包含哪些内容

http://blog.csdn.net/albert528108/article/details/21745167 2014-03-21 21:34 10829人阅读 评论(2) 收藏 举报  分类: Socket开发(5)  目录(?)[+] 问题描述: 请简要描述客户端发送的http request header都包含哪些内容? 解答: HTTP Request header 当今web程序的开发技术真是百家争鸣,ASP.NET, PHP, JSP,Perl, AJAX 等等. 无论Web

MySQL 复制简要描述及示例

主从复制技术在MySQL中被广泛使用,主要用于同步一台服务器上的数据至多台从服务器,可以用于实现负载均衡,高可用和故障切换,以及提供备份等等.MySQL支持多种不同的复制技术,诸如单向,半同步异步复制等以及不同级别的复制,诸如数据库级别,表级,跨库同步等等.本文简要描述了一个基本的主从复制并给出示例. 1.复制的基本原理(步骤)    a.在主库上把数据更改记录的二进制日志(binary log)    b.从库上的I/O线程连接到主库并请求发送其二进制日志文件(主库上的binlog dump线

Software Testing Concepts

Software Testing Concepts

Software Testing, Lab 1

Software Testing, Lab 1 一.实验要求: Install Junit(4.12), Hamcrest(1.3) with Eclipse Install Eclemma with Eclipse Write a java program for the triangle problem and test the program with Junit. a)       Description of triangle problem: Function triangle ta

《马向阳下乡记》看完了,你对谁的印象最深

刚开始看<马向阳下乡记>,感觉一般般,慢慢的又坚持看了两集,入戏了,觉得越来越有点意思了,比起本山那个还是更有的看一点.看完这四十集,说实话,我记得对梁会计印象最深,演的不错!甚至我记得比马向阳都演得要更棒点! 不管是要写代码,也要享受一下生活,看看电视剧,有的说浪费时间,有的说陶冶情操,哎,每个人看法不一样,有些戏是有点扯蛋,如果它不扯蛋,你又怎么知道扯蛋的意思,更只会停留在纸面上.人无完人,电影电视也一样,他们也是人创造的,有局限性,棒的导演导出好的片子,好的架构师设计出优秀的架构,做出好

安装jmeter以后打开会弹出命令窗口提示:WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0 x80000002. Windows RegCreateKeyEx(...) returned error code 5.

安装jmeter以后打开会弹出命令窗口提示: WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0 x80000002. Windows RegCreateKeyEx(...) returned error code 5. 应该怎么解决: win+R输入regedit 打开REGEDIT.EXE(真恨微软和其regedit.reg). 然后找到HKEY_LOCAL_MACHINE \ SO

软件测试技术 homework1 印象最深的错误

我印象最深的一次错误是关于==与equals的,是在写数据库的时候遇到的. 比如: String a = "123"; String b = new String("123"); System.out.println(b.equals(a)); System.out.println(b == a); 结果是前者是true,后者是false. 后来,经过查阅资料,我发现: ==比较的是引用变量的值,也就是比较的对象的内存地址.当两个引用变量指向同一个对象时返回true