C 或 C++用于模式识别/图像处理?

发布于 2024-09-28 06:11:04 字数 146 浏览 8 评论 0原文

我即将参加一些模式识别课程。 由于我对 C 或 C++ 没有先验知识,所以我的教授告诉我在课程之前学习其中的一些知识,并在学习课程时学习更多内容。

我应该选择哪一个?

我之前的编程知识主要限于 C#,但也有一些 PHP、SQL 和 Prolog。

I about to take some courses in Pattern Recognition.
As i have no prior knowledge in either C or C++, my professors told me to learn a bit of one of them before the course, and learn more when doing the course.

Which one should i pick?

The prior knowledge in programming i have is limited to mostly C# but some PHP, SQL and Prolog as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

无名指的心愿 2024-10-05 06:11:04

选择 C ​​或 C++ 等低级语言可能意味着您会以牺牲开发时间为代价来追求性能。

如果这是您的第一种低级语言,那么学习 C。它是一种简单、强大且经过验证的语言,并且允许编写快速代码。它拥有数十年的可移植性记录。将 C 代码与其他语言编写的代码集成起来要容易得多。使用 C++ 很容易出错。 C++ 需要更高程度的语言掌握和更多程序员的注意力才能把事情做好。虽然可以用 C++ 编写快速代码,但它比用 C 编写同样的事情更像是一门艺术。

如果您只有几个月的时间来学习,那么最终您将能够编写出不错的 C 代码,但是这段时间根本不足以获得足够的 C++ 经验,因此你在头一两年编写的 C++ 代码将会很糟糕。

例如,请参阅 Linus Torvalds 对 C++ 的严厉批评: C++ 是一种可怕的语言C++ 生产力。基本上,它可以归结为即使对于专业程序员来说,C++ 也太复杂了,而且 C++ 代码与上下文相关的行为不明确(这可能被认为是高级语言功能,但它使得推断性能变得更加困难)。

OpenCV 是计算机视觉的主要开源库之一,可用于 C 和 C++,但它也可用于 Python,这是一种更容易快速完成工作的语言(并且也可以作为第一语言来学习) )。顺便说一句,我假设如果你设法将大部分工作卸载到库中,而库本身是用 C/C++ 编写的,那么 Python 的性能成本不会很大(但通常 Python 比 C 慢 10 倍)。

The choice of a low-level language like C or C++ probably means you are into performance at the cost of the development time.

If this is your first low-level language, then learn C. It is simple, robust and proven language, and it allows to write the fast code. It has a decades long record of portability. It is much easier to integrate C code with code written in other languages. With C++ it is too easy to make things wrong. C++ requires much greater degree of language mastery and much more programmer's attention to make things right. While it is possible to write fast code in C++, it's more of an art than doing the same thing in C.

If you have only a few months to learn, then at the end you'll be able to write an OK C code, but this time is simply not enough to get enough experience with C++, hence your C++ code written in the first year or two will be awful.

See, for example, severe criticism of C++ from Linus Torvalds: C++ is a horrible language and C++ productivity. Basically, it boils down to C++ being too complicated even for professional programmers, and C++ code being ambiguous with context-dependent behaviour (this may be considered a higher-level language feature, but it makes more difficult to reason about the performance).

One of the major open source libraries for computer vision, OpenCV, is available both for C and C++, but it is also available for Python, which is a much easier language to get the things done quickly (and also to learn as a first language). BTW, I assume if you manage to offload most of the work to the library, which itself is written in C/C++, the performance cost of Python won't be huge (but generally Python is 10x slower than C).

梦罢 2024-10-05 06:11:04

Stroustrup(C++ 的发明者)认为 C++ 比 C 更容易学习

手动捕获的类型错误将会减少[...]需要学习的技巧[...]更少,并且可用的库会更好。

考虑到这一点,选择 C++。

Stroustrup (inventor of C++) argues that C++ is easier to learn than C:

There will be less type errors to catch manually […] fewer tricks to learn […], and better libraries available.

With that in mind, go for C++.

我要还你自由 2024-10-05 06:11:04

C 和 C++ 在编程方式上有根本的不同。如果您有 C# 经验,C++ 将是一个选择,因为它也是面向对象的。此外,即使它们不同,了解 C++ 也能让您阅读(并且大部分理解)C 代码。另外,请查看此问题,了解有关这些之间差异的一些信息语言。

C and C++ are fundamentally different in the way they approach programming. If you have experience with C#, C++ would be a choice since it is object oriented as well. Also, even though they are different, knowing C++ will let you read (and mostly understand) C code as well. Also, check out this question for some information on the differences between these languages.

半寸时光 2024-10-05 06:11:04

我建议学习 C++,因为如果您了解 C# 的类等,这可能是最简单的。您还可以用 C++ 编写自由函数,但用 C 编写类则更困难。

I would recommend learning C++ as this probably be easiest if you know about classes etc from C#. Also you can write free functions in C++ but is harder to write classes in C.

提笔落墨 2024-10-05 06:11:04

您可能会使用的标准库是 opencv

C# 将使您有利于掌握 C/C++。您可能能够浏览 opencv 代码示例并理解它们。

您可能可以通过学习这些示例并熟悉它们来掌握足够的 C 语言。本课程的重点将放在算法上,而不是你的代码有多花哨。

听起来像是一门有趣的课程!祝你好运。

A standard library you will likely use is opencv.

C# will set you in good stead to master C/C++. You will probably be able to see through the opencv code examples and understand them.

You can likely get by with enough C you pick up from working through the examples and becoming familiar with them. The focus of the course will be on the algorithms and not how fancy your code is.

Sounds like a fun course! Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文