Python中的机器视觉 [英] Machine vision in Python

查看:1308
本文介绍了Python中的机器视觉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Python执行一些基本的机器视觉任务,我想知道我在哪里可以找到教程来帮助我开始。

I would like to perform a few basic machine vision tasks using Python and I'd like to know where I could find tutorials to help me get started.

据我所知,用于Python的唯一免费的执行机器视觉的库是 PyCV (这是一个包装器 OpenCV ),但我找不到任何适当的教程。

As far as I know, the only free library for Python that does machine vision is PyCV (which is a wrapper for OpenCV apparently), but I can't find any appropriate tutorials.

我的主要任务是从FireWire获取图像。在不同区域中分割图像。然后对每个区域执行统计以确定像素面积和质心。

My main tasks are to acquire an image from FireWire. Segment the image in different regions. And then perform statistics on each regions to determine pixel area and center of mass.

以前,我使用Matlab的图像处理Tootlbox 没有任何问题。我想在Python中找到一个等效的函数是 graythresh regionprops gray2ind

Previously, I've used Matlab's Image Processing Tootlbox without any problems. The functions I would like to find an equivalent in Python are graythresh, regionprops and gray2ind.

谢谢!

推荐答案

OpenCV可能是你图书馆最好的选择;你有你的选择包装他们。我查看了标准OpenCV安装附带的SWIG包装,但最终使用 ctypes-opencv 因为内存管理看起来更干净。

OpenCV is probably your best bet for a library; you have your choice of wrappers for them. I looked at the SWIG wrapper that comes with the standard OpenCV install, but ended up using ctypes-opencv because the memory management seemed cleaner.

它们都是C代码的非常薄的包装器,所以你可以找到的任何C引用适用于Python 。

They are both very thin wrappers around the C code, so any C references you can find will be applicable to the Python.

OpenCV是巨大的,并没有特别详细的文档,但有一些体面的样本包括在样本目录,你可以使用开始。可搜索的OpenCV API参考是此处

OpenCV is huge and not especially well documented, but there are some decent samples included in the samples directory that you can use to get started. A searchable OpenCV API reference is here.

您没有提及是否在寻找在线或打印来源,但我有 O'Reilly 书,它相当不错(在C中的例子,但很容易翻译)。

You didn't mention if you were looking for online or print sources, but I have the O'Reilly book and it's quite good (examples in C, but easily translatable).

FindContours 函数有点类似于regionprops;它会给你一个连接的组件的列表,然后你可以检查他们的信息。

The FindContours function is a bit similar to regionprops; it will get you a list of the connected components, which you can then inspect to get their info.

对于阈值,你可以尝试阈值。我确信你可以传递一个标志使用Otsu的方法,但它似乎没有列在文档中。

For thresholding you can try Threshold. I was sure you could pass a flag to it to use Otsu's method, but it doesn't seem to be listed in the docs there.

我没有遇到具体函数对应于gray2ind,但它们可能在那里。

I haven't come across specific functions corresponding to gray2ind, but they may be in there.

这篇关于Python中的机器视觉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆