首页 \ 问答 \ camshift和opencv的组合(Combination of camshift and opencv)

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?


原文:
更新时间:2022-01-08 20:01

最满意答案

您可以循环运行表单中的每个数据。 您还必须注意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 use 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 */

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预备语句版本

    相关文章

    更多
  • 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的基本操作命令。。。