简体   繁体   English

用于图像处理的PHP或Python?

[英]PHP or Python for Image Processing?

I am writing an application for image processing. 我正在写一个图像处理应用程序。 I am just wondering which programming language would be the best fit. 我只是想知道哪种编程语言最合适。 Python or PHP. Python或PHP。 This process is system based not web based so I am just thinking if Python could be of more help. 这个过程是基于系统而不是基于Web的,所以我只是在考虑Python是否可以提供更多帮助。

Let me know your thoughts! 让我知道你的想法!

Python has stuff like SciPy and PIL so probably Python. Python有像SciPyPIL这样的东西,所以很可能是Python。

Here is how people use it: 以下是人们如何使用它:
Peak detection in a 2D array 2D阵列中的峰值检测
How can I improve my paw detection? 如何改善我的爪子检测?

One cannot suggest much without knowing the kind of image processing you have in mind. 如果不了解您想到的图像处理类型,就无法提出太多建议。

  • If you just want to do some generic rotate/resize/etc then I guess there isn't much difference. 如果你只是想做一些通用的旋转/调整/等等,那么我猜没有太大区别。

  • If you want to do something more complex, then study the libraries and decide which fits best for your particular task. 如果您想要做一些更复杂的事情,那么请研究这些库并确定最适合您特定任务的库。

  • If you want to do something really custom, then C or similar language might be a better fit for the task. 如果你想做一些非常自定义的事情,那么C或类似的语言可能更适合这项任务。

Possibly neither; 可能两者都没有; it depends on what you want to do. 这取决于你想做什么。

Both PHP and Python are scripting languages, and are therefore not suited for high-performance numerical routines (which most image processing requires). PHP和Python都是脚本语言,因此不适用于高性能数值例程(大多数图像处理需要)。 However, they both have a number of image-processing libraries available for them, the innards of which are probably written in C. These will be fast. 但是,它们都有许多可用的图像处理库,其内部可能用C语言编写。这些很快。

If these libraries do what you want, then fine. 如果这些库做你想要的,那很好。 If you need to so something custom, then you're probably better off with C or C++ (or Pascal, or whatever) if speed of execution is of concern. 如果您需要自定义内容,那么如果执行速度受到关注,您可能最好使用C或C ++(或Pascal,或其他)。

Python is more clean and readable. Python更干净,更易读。 For image processing there is the imageMagic library available for Python and PHP too. 对于图像处理,还有可用于Python和PHP的imageMagic库。

If you want to do some other complex image processing, which cannot by done using a library and you still want to do it in Python or PHP, then Python is defenitely the answer as Python can be extended with C -- But, wait, you didn't mention programming in C, well, there is Cython! 如果你想做一些其他复杂的图像处理,这些处理无法使用库完成,你仍然希望用Python或PHP来完成,那么Python就是答案,因为Python可以用C扩展 - 但是,等等,你没有提到用C编程,好吧,有Cython! It would allow you to write Python modules which are afterwards compiled to C 它允许你编写后来编译为C的Python模块

It really depends on what you want to do with the images. 这实际上取决于你想对图像做什么。 You probably should just use a batch or similar script to run a command that does the processing your looking for. 您可能应该使用批处理或类似的脚本来运行执行您要查找的处理的命令。

Between the two languages, I would go with python. 在两种语言之间,我会选择python。 The command line interface for php is only a recent addition, while python was designed primarily as a scripting language, not for serving pages. php的命令行界面只是最近添加的,而python主要是作为脚本语言设计的,而不是用于提供页面。 For a console application, python is a better fit. 对于控制台应用程序,python更适合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM