首页 \ 问答 \ CodeIgniter助手函数可以使用数据库函数吗?(Can CodeIgniter Helper Functions use database functions?)

CodeIgniter助手函数可以使用数据库函数吗?(Can CodeIgniter Helper Functions use database functions?)

我的一个CodeIgniter控制器函数需要调用递归函数作为其功能的一部分。 该函数调用扼流器,如果我把它放在控制器类中,并且它不能访问数据库函数($this->db->get())如果我把它放在类之外的话。 会使它成为一个帮手功能解决这个问题吗?


One of my CodeIgniter Controller functions needs to call a recursive function as part of its functionality. The function call chokes if I put it inside the controller class, and it can't access database functions ($this->db->get()) if I put it outside the class. Would making it a helper function fix this problem?


原文:https://stackoverflow.com/questions/15888332
更新时间:2021-09-11 22:09

最满意答案

最新的SVN版本的OpenCV包含基于HOG的行人检测(无证)实现。 它甚至配备了一个预先训练好的探测器和一个python包装器。 基本用法如下:

from cv import *

storage = CreateMemStorage(0)
img = LoadImage(file)  # or read from camera

found = list(HOGDetectMultiScale(img, storage, win_stride=(8,8),
                padding=(32,32), scale=1.05, group_threshold=2))

因此,不用跟踪,您可以在每个帧中运行检测器并直接使用其输出。

有关实现的信息,请参阅src/cvaux/cvhog.cpp ;有关更完整的python示例(均在OpenCV源代码中),请参阅samples/python/peopledetect.py


The latest SVN version of OpenCV contains an (undocumented) implementation of HOG-based pedestrian detection. It even comes with a pre-trained detector and a python wrapper. The basic usage is as follows:

from cv import *

storage = CreateMemStorage(0)
img = LoadImage(file)  # or read from camera

found = list(HOGDetectMultiScale(img, storage, win_stride=(8,8),
                padding=(32,32), scale=1.05, group_threshold=2))

So instead of tracking, you might just run the detector in each frame and use its output directly.

See src/cvaux/cvhog.cpp for the implementation and samples/python/peopledetect.py for a more complete python example (both in the OpenCV sources).

相关问答

更多
  • 最新的SVN版本的OpenCV包含基于HOG的行人检测(无证)实现。 它甚至配备了一个预先训练好的探测器和一个python包装器。 基本用法如下: from cv import * storage = CreateMemStorage(0) img = LoadImage(file) # or read from camera found = list(HOGDetectMultiScale(img, storage, win_stride=(8,8), padding ...
  • 这是一个使用猪描述符,你可以在samples / python / peopledetect.py中找到示例。我使用了opencv安装提供的示例视频。 import numpy as np import cv2 def inside(r, q): rx, ry, rw, rh = r qx, qy, qw, qh = q return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh def dra ...
  • 假设你有一个你的对象(参考图像)的图片,并检测特征并提取关键点。 为了在场景中使用从2D图像到3D坐标的单应变换,您的物体应该是平面的 。 现在,您必须处理帧,从场景中提取关键点。 什么将允许您检测对象是参考图像中的关键点与场景中的关键点的匹配 。 你的对象被检测到,但是如果你想知道它的3D位置,你必须使用findHomography()和匹配对(它将使用整个集合中的四个匹配)。 所以关键是匹配。 首先阅读这个 : Supose you have a picture of your object (refe ...
  • 我建议看一下The Machine Perception Toolbox ( MPT Library )。 我有机会在Goldsmiths的Openframeworks OpenCV研讨会上玩一下,并且有一个c ++ 微笑检测示例 。 我想你可以用openframeworks试用iPhone的MPT Library或者直接链接到iPhone项目的库。 有时由于背景而无法检测到人脸。 一个理想的照明设置将保证更好的结果,但考虑到你想在移动设备上使用它,你必须通知你的用户,在极端条件下微笑检测可能会失败(光线不 ...
  • Python OpenCV中createTrackbar的语法是: cv.CreateTrackbar(trackbarName, windowName, value, count, onChange) 请查看以下链接以获取更多信息:( http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html?highlight=createtrackbar ) 在Python OpenCV中显示图像的语法是: cv2.imshow(window ...
  • 由于您的视图控制器实现是在objective-c ++中(它在您的第一个链接上说明了),并且如果您使用编译器Apple LLVM 2.0或更高版本,您可以在obj-c ++实现文件中使用c ++代码(扩展名.mm) 。 导入c ++标头并在那里声明所有类范围的变量,而不是在接口文件中,如下所示: #import "ViewController.h" #import "DetectionBasedTracker.h" //class extension in your implementation fil ...
  • 我可以在Python中找到的最快方法是使用切片来比较每个通道。 经过几次测试后,此方法比两个嵌套for循环快200倍以上。 bg = im[:,:,0] == im[:,:,1] # B == G gr = im[:,:,1] == im[:,:,2] # G == R slices = np.bitwise_and(bg, gr, dtype= np.uint8) * 255 这将生成一个二进制图像,灰色物体用白色像素表示。 如果您不需要二进制图像,而只需要一个逻辑数组,其中灰色像素由True值指示,则 ...
  • 我成功地使它成功了。 事实证明,CV_8UC1矩阵不是正确的,虽然openCV没有说明,当我将它传递给detectMultiScale方法时出现问题。 当我将CV_8UC4转换为CV_8UC3时 -(cv::Mat) CVMat3Channels { cv::Mat rgbaMat = [self CVMat]; cv::Mat rgbMat(self.size.height, self.size.width, CV_8UC3); // 8 bits per component, 3 channe ...
  • 如果我理解正确,您会担心检测到您正在跟踪的对象(缺少检测器/跟踪器通信)。 在这种情况下,你可以: 预检 - 在检测期间排除已经跟踪对象或区域的区域 检查后 - 丢弃被检测到的物体,这些物体接近被跟踪的物体(如果出于某种原因,您的进近无法进行“选择性”检测) 有几种可能的实现方式。 面具 。 创建二进制掩码,其中跟踪对象附近的区域被“标记”(例如,跟踪对象附近的区域和其他地方的零)。 给定这样的掩模,在特定位置检测之前,您可以快速检查是否在那里跟踪了某些东西,并且如果您坚持使用Post-check方法,则中 ...
  • 这个问题看起来有点旧,但我也在研究类似的问题,并得到了我自己的解决方案,我在这里解释。 对于使用任何OCR引擎阅读文本,有很多挑战,以获得良好的准确性,包括以下主要情况: 由于图像质量差/背景区域中不需要的元素/斑点而存在噪声。 这将需要一些预处理,如噪声消除,这可以使用高斯滤波器或普通中值滤波器方法轻松完成。 这些也可以在opencv中找到 。 图像方向错误:由于方向错误,OCR引擎无法正确分割图像中的线条和单词,从而导致精度最差。 行的存在:在进行单词或行分割时,OCR引擎有时也会尝试将单词和行合并在一 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)