- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我一直在使用 SimpleCV 查找要与自动驾驶机器人一起使用的 Blob 。问题是当我在 SimpleCV 中调用 findBlobs 命令时。当我完全挡住 Kinect 相机的镜头时,PyGame 崩溃并给我这个错误:
致命的 Python 错误:(pygame parachute) Segmentation Fault
有时它可以工作,有时它会崩溃,即使镜头未被遮挡。当我运行它超过大约三十秒时,它几乎总是会崩溃。我已经重新安装并修复了 SimpleCV 中的许多问题,并尝试重新安装 Pygame,但它似乎根本没有帮助。另外,我使用 X-Box kinect 作为我的相机源。我正在使用 Ubuntu 11.04。
这是我的确切代码:
from SimpleCV import *
from SimpleCV.Display import *
from time import sleep
k = Kinect()
dis = Display()
while 1:
depth = k.getDepth()
depth = depth.invert()
depth = depth.erode()
blobs = depth.findBlobs(threshval=127, minsize=10, maxsize=0)
if blobs:
blobs.draw()
depth.save(dis)
sleep(0)
最佳答案
Kat 在这里,我编写了 SimpleCV blob 库。
在发布 1.1 版本后,我们发现 blob 库存在一些问题。两个大问题是 blob 库会达到 python 最大递归深度并退出。第二个源于实际的底层 OpenCV 包装器,并在 blob 制造商未检测到任何 blob 时导致 pygame 错误。
现在的解决方案是使用我们 github 存储库的 master 分支中的版本。补丁版本也将在本月晚些时候发布的新 SimpleCV 1.2 版本中可用。如果您想手动修复代码,我已在下面粘贴了修复的代码段:
在 BlobMaker.py 中第 55 行左右
def extractFromBinary(self,binaryImg,colorImg, minsize = 5, maxsize = -1):
#fix recursion limit bug
sys.setrecursionlimit(1000000)
if (maxsize <= 0):
maxsize = colorImg.width * colorImg.height
retVal = []
#fix all black image bug
test = binaryImg.meanColor()
if( test[0]==0.00 and test[1]==0.00 and test[2]==0.00):
return FeatureSet(retVal)
seq = cv.FindContours( binaryImg._getGrayscaleBitmap(), self.mMemStorage, cv.CV_RETR_TREE, cv.CV_CHAIN_APPROX_SIMPLE)
retVal = self._extractFromBinary(seq,False,colorImg,minsize,maxsize)
del seq
return FeatureSet(retVal)
关于python - 使用SimpleCV库findBlob函数时Pygame Segmentation错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7699704/
我在一个俄罗斯编程论坛上遇到了这个问题,但还没有想出一个优雅的解决方案。 问题: 你有一个包含N个正整数的数组,你需要将它分成M个连续的段,使得最大段的和是可能的最小值。通过段的总数,我的意思是它所有
我正在从文本“从 0 到 1 的操作系统”中学习链接脚本,并且在文本中他们展示了一个使用关键字 PHDRS 的示例; ENTRY(main); PHDRS { headers PT_P
一个小型测试程序在 64 位 Linux 上使用 gfortran (4.4.5) 返回段错误。 n=2_8**22_8 时不存在故障。 gdb 指示在循环的第一次迭代期间函数 mylen 中发生段错
我正在尝试计算一个比率,当我的分子数组充满 0 时它可以工作,但是当我在分子数组中有值时会中断程序。 223 Double_t *ratio_calculations(int bin_numbers,
我正在研究组合分页/分段系统,在我的书中有两种方法: 1.paged segmentation 2.segmented paging 我无法弄清楚两者之间的区别。我认为在分页分段中,段被分成页面,在分
语义分割只是一种重复,还是“语义分割”和“分割”之间有区别? “场景标记”和“场景解析”有区别吗? 像素级分割和像素级分割有什么区别? (附带问题:当您拥有这种逐像素注释时,您是否可以免费获得对象检测
我遇到了一个非常奇怪的行为,我正在遵循在线文档,并且在创建一个段来与我的子段一起使用时,lambda 按以下顺序执行: xray_recorder.begin_segment('segment-nam
我们正在我们的服务器上进行一些负载测试,我正在使用 tshark 将一些数据捕获到 pcap 文件,然后使用 wireshark GUI 通过转到 Analyze -> expert Info 来查看
我是一名高中生,今年开始学习汇编。 我目前正在制作 Pacman 克隆作为我的最终项目。 我遇到的唯一问题是我的代码很大,*.exe 文件几乎有 64KB。 所以我的问题是,如果我转向模型介质,我需要
前言 本系列文章是博主在工作中使用SAM模型时的学习笔记,包含三部分: SAM初步理解,简单介绍模型框架,不涉及细节和代码 SAM细节理解,对各模块结合代码进一步分析 SAM微调实例
我很困惑进程在使用虚拟内存时如何可能出现段错误。据我了解,“虚拟”内存允许进程访问所有可用内存,然后将其映射到“实际”硬件内存。通过这种转换,进程怎么可能尝试访问不允许访问的内存部分? 最佳答案 听起
Tritwise操作(向右旋转和疯狂操作)无法正确运行,并在Malbolge编译器/解释器中引发分段错误。 在看到有关Coding Challenges和Code Golf的惊人答案之后,我决定开始在
只是有关DirectX11镶嵌的问题。 在“船体着色器”中,可以设置的最大镶嵌因子为64(不确定原因)。现在,尽管对于小型飞机已经足够了,但是对于大型飞机来说,这还远远不够,所以我想知道如何渲染大型飞
我需要在 matlab 中手动分割图像。我很想使用“impoly”,但我主要需要分割圆形对象。 我在 Youtube 上的 Ali Pashaei 视频中找到了我需要的东西,在“FlowImagePr
我有下面的代码。当我取消注释 temperature(i,j) = anode_temperature 时,我会出现 SegFault。 forall(i=0:Cells(1), j=0:Cells(
我是 C 编程新手,我的代码中出现了段错误。该程序使用返回函数来询问用户他们的银行帐户中有多少钱。稍后我将添加代码来计算利息。感谢您为我查看此内容,因为我很难找出为什么会出现此错误。 #include
为了测试,我编写了一个代码来计算 #include int main(void) { int p, i, primes[50], index; boo
这个问题已经有答案了: What is a segmentation fault? (17 个回答) 已关闭 5 年前。 最近我开始研究内置函数,但遇到了一个错误,那就是: 为什么我会遇到此程序段错误
已关闭。此问题需要 debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and the
注意:我们有很多段错误,基本相同 答案,所以我试图将其分解为一个规范的问题,例如 我们有undefined reference。 尽管我们有一个关于what a segmentati
我是一名优秀的程序员,十分优秀!