如果你安装的是使用Microsoft Visual Studio编译器的Qt(例如我安装的这个Qt,安装包文件名为:qt-windows-opensource-5.2.0- msvc 2012-x86-offline.exe),则不需要网传的对OpenCV进行编译的这个麻烦过程,直接利用VS的预编译文件即可。 需要注意的一点是Q
如果你安装的是使用Microsoft Visual Studio编译器的Qt(例如我安装的这个Qt,安装包文件名为:qt-windows-opensource-5.2.0-msvc2012-x86-offline.exe),则不需要网传的对OpenCV进行编译的这个麻烦过程,直接利用VS的预编译文件即可。
需要注意的一点是Qt不支持Visual Studio Express版。另外你最好先在Visual Studio下完成OpenCV简单demo的编译(参看我之前的博文),确保OpenCV环境设置正确。
使用Qt Creator这个IDE而不是VS的好处在于Qt Creator能够非常方便地调用所有Qt的组件,而且更加轻量级、启动也很快速,开发跨平台应用时也更加方便(主流平台下都有Qt Creator,而只有Windows才有Visual Studio)。
Qt程序的项目配置文件保存在.pro文件里,类似于VS2012中所配置的,Qt也没有“全局”的INCLUDE和LIB(库)路径的修改功能,而是通过对pro文件的改动来配置编译时需要包含的路径和库文件。
在Qt Creator里,新建一个项目,Qt控制台应用就可以了。然后在“编辑”面板里打开项目的pro文件,如下图所示:
添加下面几行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
路径使用斜杠(/)而不是反斜杠(\),INCLUDEPATH是项目编译时会包含的头文件目录,后面加上的是OpenCV预编译文件的include(这里的路径和我之前那篇Visual Studio 2012配置OpenCV环境的是一样的),LIBS则是编译时需要链接的文件,-L后紧跟的是目录,-l后则紧跟对应的动态链接,和VS中不太一样的是不用写出完整的文件名(没有后面的.lib后缀),和VS2012中类似的则是这里通过CONFIG来确认编译类型是debug还是release来使用debug链接或release链接。前面用win32则保证这些链接仅在Windows下编译时被链接器链接。
前面几行的末尾的反斜杠是用来把一行内容分成多行写(类似C++的语法),这样做的目的主要是清晰易读,不必写一行超长的语句。
pro文件修改完成后保存,回到main.cpp文件里,一个简单的OpenCV demo内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
它会载入D:/demo.png这个图片文件,你可能需要进行一些改动以便让该demo顺利运行。另外之前改动了pro文件,但是Qt Creator很可能认为项目配置没有变化,因此不会自动重新运行qmake,需要手动运行一次以免出现“LNK 2019”链接错误或者找不到包含目录的错误。“构建->执行qmake”,然后再“构建->重新构建项目”。以后没有改动pro的话,就不需要执行qmake了,直接点左侧面板上那个榔头(Ctrl+B)构建项目就可以了,绿色三角形(Ctrl+R)运行程序,绿色三角形带虫子(F5)调试程序。

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
