camshift和opencv的组合(Combination of camshift and opencv)
我正在尝试使用OpenCV进行对象检测作业。 但是有些东西让我困惑。 像camshift和kalman滤波器这样的跟踪和预测算法可以完成跟踪任务,而SURF匹配方法也可以做到这一点。
我不太明白这两种方法之间的区别。 我已经完成了一些基于feature2d(使用了SURF)和OpenCV教程的motion_analysis_and_object_tracking(使用camshift)的编码。 看起来他们只是一个目的的两种手段。 我是对的还是我错过了一些概念?
将camshift跟踪与SURF特征匹配相结合是一种好方法吗?也许可以应用更多的东西,比如轮廓匹配?I'm trying to do object detecting jobs using OpenCV. But there is something confuses me. Tracking & predicting algorithm like camshift and kalman filters can fulfill the task of tracking while SURF matching methods can also do that.
I don't quite understand the difference between the two approaches. I have done some codings based on feature2d (SURF is used) and motion_analysis_and_object_tracking (camshift is used) of OpenCV tutorial. It seems like they're just two means of one purpose. Am I right or am I missing out some concept?
And is it a good way to combine camshift tracking with SURF feature matching?...maybe more stuff can be applied, like contour matching?
原文:
最满意答案
您可以循环运行表单中的每个数据。 您还必须注意
mysql
已经被弃用 ,因此建议至少使用mysqli prepared statement
:if(isset($_POST["add"])){ /* START OF INSERTING NAME AND SEC_NAME */ $stmt = $con->prepare("INSERT INTO tb_job (name, sec_name) VALUES (?, ?)"); /* PREPARE YOUR QUERY */ $stmt->bind_param("ss", $_POST["name"], $_POST["sec_name"]); /* BIND THIS DATA TO YOUR QUERY */ $stmt->execute(); /* EXECUTE THE QUERY */ $lid = $stmt->insert_id; /* GET THE ID OF THE INSERTED NAME */ $stmt->close(); /* CLOSE THE PREPARED QUERY */ /* START OF LOOP; CHECK EACH JOB INPUT OF USER */ for($x = 0; $x < count($_POST["pre_job"]); $x++){ if(!empty($_POST["pre_job"][$x])){ /* CHECK IF PRE_JOB[N] IS NOT EMPTY */ /* START INSERTING THE DYNAMIC INPUT JOB(S) */ $stmt = $con->prepare("INSERT INTO tb_job_skills (id_job, pre_job, date_start, date_end) VALUES (?, ?, ?, ?)"); $stmt->bind_param("isss", $lid, $_POST["pre_job"][$x], $_POST["date_start"][$x], $_POST["date_end"][$x]); $stmt->execute(); $stmt->close(); } /* END OF IF; CHECKING IF THE INPUT IS NOT EMPTY */ } /* END OF FOR LOOP */ } /* END OF ISSET */
另请注意,您必须在
mysqli
中建立连接才能使上述工作正常:/* JUST REPLACE NECESSARY DATA */ $con = new mysqli("Host", "Username", "Password", "Database"); /* CHECK CONNECTION */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); }
You can run each data from your form in a loop. You also have to note that
mysql
is already deprecated, so it is recommended to at least usemysqli prepared statement
:if(isset($_POST["add"])){ /* START OF INSERTING NAME AND SEC_NAME */ $stmt = $con->prepare("INSERT INTO tb_job (name, sec_name) VALUES (?, ?)"); /* PREPARE YOUR QUERY */ $stmt->bind_param("ss", $_POST["name"], $_POST["sec_name"]); /* BIND THIS DATA TO YOUR QUERY */ $stmt->execute(); /* EXECUTE THE QUERY */ $lid = $stmt->insert_id; /* GET THE ID OF THE INSERTED NAME */ $stmt->close(); /* CLOSE THE PREPARED QUERY */ /* START OF LOOP; CHECK EACH JOB INPUT OF USER */ for($x = 0; $x < count($_POST["pre_job"]); $x++){ if(!empty($_POST["pre_job"][$x])){ /* CHECK IF PRE_JOB[N] IS NOT EMPTY */ /* START INSERTING THE DYNAMIC INPUT JOB(S) */ $stmt = $con->prepare("INSERT INTO tb_job_skills (id_job, pre_job, date_start, date_end) VALUES (?, ?, ?, ?)"); $stmt->bind_param("isss", $lid, $_POST["pre_job"][$x], $_POST["date_start"][$x], $_POST["date_end"][$x]); $stmt->execute(); $stmt->close(); } /* END OF IF; CHECKING IF THE INPUT IS NOT EMPTY */ } /* END OF FOR LOOP */ } /* END OF ISSET */
Also note that you have to establish your connection in
mysqli
in order for the above to work:/* JUST REPLACE NECESSARY DATA */ $con = new mysqli("Host", "Username", "Password", "Database"); /* CHECK CONNECTION */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); }
相关问答
更多-
“现在我将变量名称从ID更改为id_photo并且它正在工作,谢谢。” 根据我原来的评论: “尝试将隐藏的表单字段名称重命名为id_photo ,看看是否有帮助。” 使用ID作为变量不是建议使用的值,因为它可能会导致其他地方的冲突,例如在DB中。 编辑 在查看OP的代码后,应该使用以下代码: if(isset($_POST['ID'])而不是if(isset($_POST)因为$_POST是一个自动全局并且始终设置。 它需要检查是否已设置值而不是全局POST值或Glavić在给出的答案中建议。 "Now I ...
-
下面是一个面向对象的mysqli预备语句版本
-
您可以拥有多个提交表单,但只需使用所有
-
Php和形式问题(Php and forms problem)[2022-07-19]
前言:既然你说这是一个学习练习,我将跳过关于最佳实践和OOP的许多和各种美德的道貌岸然的宣言。 ;)你的书可能详细描述了我通常会在这样的解决方案中提出的每一个可怕的警告/严厉讲座。 是否可以执行form action =“DeleteOrAdd.php:doAddDeleteRecord()? 简而言之,是的。 实现目标的最简单方法是在表单操作中引用您的文件,就像您所做的那样: -
如何使用(document.forms)复选框名称作为数组(PHP)(how to use the (document.forms) with the checkbox name as an array (PHP))[2021-12-24]
使用语法访问表单 myForm["myelement"] 与myForm.myelement具有相同的结果,除了它还允许javascript非法标识符或语法结构会导致意外结果(在您的情况下:尝试将未定义的元素作为数组访问而不是按名称获取元素使用PHP期望的数组表示法) Accessing the form with the syntax myForm["myelement"] has the same result as myForm.myelement, except that it also all ... -
您没有从$_POST变量中读取状态。 您正在从数据库中读取$status : $status = $row['status']; 然后你再次设置它 $query = mysqli_query("UPDATE overzicht SET status=$status WHERE ordernr=$ordernr"); 因此,您将其设置为与现有值相同的值。 添加$status = $_POST['status']; 在查询之前。 此外,您没有从$_POST读取$ordernr ,因此您始终将状态设置为从数据 ...
-
在表单中创建输入组,并通过PHP中的POST访问它们(Create input groups within forms and access them via POST in PHP)[2022-05-29]
是的,您可以为该属性使用分组名称,以便在提交时对其进行分组。 该div中的组name=""不正确,它必须位于输入元素上。 例: '; print_r($products); // check the result ... -
PHP形成动态输入(PHP form dynamic inputs)[2023-02-10]
更改您的代码: echo '' . $result . ' - ('.$i.' images)
'; 这段代码: echo '' . $result . ' - ('.$i.' images)
您可以循环运行表单中的每个数据。 您还必须注意mysql已经被弃用 ,因此建议至少使用mysqli prepared statement : if(isset($_POST["add"])){ /* START OF INSERTING NAME AND SEC_NAME */ $stmt = $con->prepare("INSERT INTO tb_job (name, sec_name) VALUES (?, ?)"); /* PREPARE YOUR QUERY */ $stmt->b ...在PHP中,这段代码在表单所需的字段中做了什么?(In PHP, what does this block of code do in forms required field?)[2021-05-29]
它能做什么 trim()从开头和结尾删除空格, stripslashes()如果magic_quotes处于活动状态(这取决于您的PHP配置和版本)可能添加的任何斜杠,并且htmlspecialchars()再次添加斜杠。 为什么 这里的主题是XSS预防 。 但是,除了在使用echo输出之前简单地应用htmlspecialchars() ,还有更多要了解这一点。 您可以在SO上搜索此主题 。 此外,一个有趣的方式来了解这个是这个网站 ,它提出了你尝试扮演黑客的挑战。 What it does trim() ...相关文章
更多- jqgrid 中组合框的值和key
- 求帮忙,java中关于数组的组合
- 推荐!国外程序员整理的机器学习资源大全(转)
- 推荐!国外程序员整理的机器学习资源大全
- 机器学习资源大全【转】
- UML类图中的关联、聚合、组合
- JAVA设计模式学习10——组合模式
- 怎么把2个数组里面相同的元素组合成一个新的数组
- Hadoop中的排序器/组合器/合并器
- UML 继承、实现、依赖、关联、聚合、组合的联系与区别
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。