在过去的两个月里,我使用计算机视觉库(OpenCV)开发了一个简单的应用程序。
我希望直接从网络摄像头运行该应用程序,而不需要操作系统。 我很想知道我的应用程序是否可以被烧录到芯片中,以便没有操作系统来运行它。
当然这个过程可能很昂贵,但我只是好奇。 你有相关的链接吗?
ps:该应用程序是用 C 编写的。
In the last two months I've worked as a simple application using a computer vision library(OpenCV).
I wish to run that application directly from the webcam without the need of an OS. I'm curious to know if that my application can be burned into a chip in order to not have the OS to run it.
Ofcorse the process can be expensive, but I'm just curious. Do you have any links about that?
ps: the application is written in C.
发布评论
评论(5)
是的。 理论上可以将您的应用程序移植到 PIC 芯片上。
但是...
PIC芯片有C编译器,但是,由于微控制器的限制,您可能会发现编译器和微控制器本身对于计算机视觉工作来说太有限了,特别是如果您对该应用程序的初始实现是在一台成熟的 PC 上完成的:
在大多数情况下,您只能使用整数数学(如果不是全部的话)(不能引用我的话,但我们的开发人员在工作中,他们的 PIC 应用程序没有浮点数学,这会导致他们的立方体发出许多脏话)。 要么这样,要么你需要连接到外部数学协处理器。
您必须弄清楚如何让 PIC 芯片通过 USB 与相机通信。 我知道这是可能的,但需要额外的硬件和研发时间。
如果你需要严格的时序控制,
你甚至可能需要编程
汇编程序中的应用程序。
如果还没有的话,您必须将 OpenCV 的部分内容移植到 PIC 芯片上。 我的猜测不是。
如果您还不熟悉微控制器编程,您将需要一些时间来快速了解台式 PC 编程和微控制器编程之间的差异,并且您必须在这方面获得一些经验。 这对您来说可能不是问题。
基本上,考虑到 PIC 芯片的限制,最好从头开始重写整个程序。 不过,好的事情是,您已经完成了大量的设计工作。 主要是硬件/移植工作。
或者...
您可以尝试使用小型嵌入式 x86 单板 PC,也许在 PC/104 外形尺寸,您的操作系统/应用程序位于 CF 卡上。 这是一台真正的 PC,您只需添加您的软件即可。 好消息是,您可能不必重新编写应用程序,除非它的内存占用量非常可笑。 嵌入式 PC 供应商开始提供基于 1 GHz Intel Atoms 的主板,如果您需要更多帮助,您也许可以将子板连接到 PC-104 总线上。 当您使用与开发应用程序的 PC 等效的平台时,您将解决上面列出的所有限制。 而且它有 USB 端口! 如果您进行彻底的成本分析并且喜欢更大的外形尺寸,您可能会发现使用基于 SBC 的系统比使用 PIC 芯片/微控制器的解决方案更便宜/更快。
在 Google 上快速搜索 PC-104 会发现许多 SBC 供应商。
或者...
而且这真的很便宜 - 只要买一个现成的便宜的上网本,覆盖 OEM 操作系统,并在其中运行代码。 黑客,但便宜,而且非常简单 - 您的硬件问题将在一周内得到解决。
只是一些想法。
Yes. It is theoretically possible to port your app to PIC chips.
But...
There are C compilers for the PIC chip, however, due to the limitations of a microcontroller, you might find that the compiler, and the microcontroller itself is far too limited for computer vision work, especially if your initial implementation of the app was done on a full-blown PC:
You'll only have integer math available to you, in most cases, if not all (can't quote me on that, but our devs at work don't have floating point math for their PIC apps and it causes many foul words to emanate from their cubes). Either that, or you'll need to hook to an external math coprocessor.
You'll have to figure out how to get the PIC chip to talk USB to the camera. I know this is possible, but it will require additional hardware, and R&D time.
If you need strict timing control,
you might even have to program the
app in assembler.
You'd have to port portions of OpenCV to the PIC chip, if it hasn't been already. My guess is not.
If your'e not already familiar with microcontroller programming, you'll need some time to get up to speed on the differences between desktop PC programming and microcontroller programming, and you'll have to gain some experience in that. This may not be an issue for you.
Basically, it would probably be best to re-write the whole program from scratch given a PIC chip constraint. Good thing is though, you've done a lot of design work already. It would mainly be hardware/porting work.
OR...
You could try using a small embedded x86 single-board PC, perhaps in the PC/104 form factor, with your OS/app on a CF card. It's a real bone fide PC, you just add your software. Good thing is, you probably wouldn't have to re-write your app, unless it had ridiculous memory footprint. Embedded PC vendors are starting to ship boards based on 1 GHz Intel Atoms, and if you needed more help you could perhaps hook a daughterboard onto the PC-104 bus. You'll work around all of the limitations listed above, as your using an equivalent platform to the PC you developed your app on. And it has USB ports! If you do a thorough cost analysis and if your'e cool with a larger form factor, you might find it to be cheaper/quicker to use a system based on a SBC than rolling a solution using PIC chips/microcontrollers.
A quick search of PC-104 on Google would reveal many vendors of SBCs.
OR...
And this would be really cheap - just get a off-the-shelf cheap Netbook, overwrite the OEM OS, and run the code on there. Hackish, but cheap, and really easy - your hardware issues would be resolved within a week.
Just some ideas.
我想你会发现这可能会发展成为相当大的项目。
显然可以实现一个独立的硬件解决方案来完成这样的事情。 在我的脑海中,Rabbit 的解决方案可能会让您更快地到达终点线。 但您也许可以找到一些本土的 Beagle Board 或 Gumstix 项目 也是如此。
我想强调的两个 Google 链接:
I think you'll find this might grow into pretty large project.
It's obviously possible to implement a stand-alone hardware solution to do something like this. Off the top of my head, Rabbit's solutions might get you to the finish-line faster. But you might be able to find some home-grown Beagle Board or Gumstix projects as well.
Two Google links I wanted to emphasize:
我会使用比 PIC 更大的东西,例如小型 32 位 ARM 处理器。
I'd use something bigger than a PIC, for example a small 32 bit ARM processor.
我赞同 Nate 的建议,看看 Rabbit 的核心模块。
此外,GHIElectronics 有一款名为 Embedded Master 的产品,它运行 .Net MicroFramework 并具有 USB 主机/内置设备功能以及丰富的库(.Net 框架的子集)。 它在 Arm 处理器上运行,并且相当便宜(> 85 美元)。 虽然不像单个 PIC 芯片那么便宜,但它确实在模块上预先构建了许多胶合逻辑。
I would second Nate's recommendation to take a look at Rabbit's core modules.
Also, GHIElectronics has a product called the Embedded Master that runs .Net MicroFramework and has USB host/device capabilities built-in as well as a rich library that is a subset of the .Net framework. It runs on an Arm processor and is fairly inexpensive (> $85). Though not nearly as cheap as a single PIC chip it does come with a lot of glue logic pre-built onto the module.
CMUCam
我认为您应该看看 CMUcam 项目,该项目提供价格实惠的服务硬件和在其硬件上运行的图像处理库。
CMUCam
I think you should have a look at the CMUcam project, which offers affordable hardware and an image processing library which runs on their hardware.