Home Database Mysql Tutorial 一个系统中同时使用VC6.0+OpenCV1.0和VS2010+OpenCV2.4.6.0的方

一个系统中同时使用VC6.0+OpenCV1.0和VS2010+OpenCV2.4.6.0的方

Jun 07, 2016 pm 03:38 PM
vs use system

From: http://blog.csdn.net/zzy7222872/article/details/6047446 以前用的是VC6.0OpenCV1.0的组合,一直用的很好。一般的图像处理算法都可以实现,现在突然想搞一下立体视觉方面的东西,查看了OpenCV的手册,发现立体视觉上的大部分函数只有OpenCV1.0以上版

From:  http://blog.csdn.net/zzy7222872/article/details/6047446

以前用的是VC6.0+OpenCV1.0的组合,一直用的很好。一般的图像处理算法都可以实现,现在突然想搞一下立体视觉方面的东西,查看了OpenCV的手册,发现立体视觉上的大部分函数只有OpenCV1.0以上版本才有。于是乎准备鸟枪换炮上OpenCV2.0,一查资料,发现OpenCV2.0不能再VC6.0下跑,于是乎只好装VS2005,但是又怕装了以后和原来的VC6.0冲突,导致以前的工程都不能用。上网查了资料说装在不同路径下是没问题的。于是大胆安装在其他目录下,装好后果然不冲突,看来只要路径不同就没问题,微软的工程师也不是菜鸟啊。接下来搞定OpenCV2.0,我想在能用原来1.0版本的情况下也可以用2.0的版本,于是将OpenCV2.0装在了和原来版本不同的目录下,装完Ok,没有问题。接下来是配置。OpenCV2.0的配置没有原来1.0的简单,需要自己下载CMAKE来产生需要的dll和lib文件。一下参考了一篇帖子如下。

1.Opencv2.0下载地址:
http://www.opencv.org.cn/index.php/Download
安装时选择默认路径,安装后检查C:/OpenCV2.0/bin
是否已经被加入到环境变量PATH,如果没有,请加入。
加入后需要注销当前Windows用户(或重启)后重新登陆才生效。
2.配置IDE,打开VS2005,选择菜单:Tools -> Options,在弹出窗口中选择
Projects and Solutions -> VC++ Directories
首先,从“Show Directories for”的list box中选择“Include files”,
添加路径“C:/OpenCV2.0/include/opencv”。
3.添加库文件(library files),需要下载CMAKE,用来生产所需的库文件,cmake下载地址:
http://www.cmake.org/cmake/resources/software.html
打开cmake-gui。在第一个路径处选择opencv的安装路径,记得是CMakeLists.txt所在的那个路径。
第二个路径是 make得到的工程保存位置。
点击Configure并选择合适的编译器。选择完编译器之后需点击Configure两次,
最后点击Generate生成我们想要的工程文件(.lib  .dll)。
4.打开make得到的工程保存位置中的OpenCV.sln文件,build solution后在工程目录下得到bin和lib的文件夹,
将bin/debug中的.dll文件复制到C:/OpenCV2.0/bin,将lib/debug中的.lib文件复制到C:/OpenCV2.0/lib,
5.添加库文件(library files),选择菜单:Tools -> Options,在弹出窗口中
选择Projects and Solutions -> VC++ Directories,首先,从“Show Directories for”的list box中
选择“Library files”,添加路径“C:/OpenCV2.0/lib”。选择“source files”,
添加路径“C:/OpenCV2.0/src/cv”,“C:/OpenCV2.0/src/cvaux”,“
C:/OpenCV2.0/src/cxcore”,“C:/OpenCV2.0/src/highgui”,“C:/OpenCV2.0/src/ml”。
6.建立project后要设置项目所需要的lib,
选择菜单Project -> Properties -> Configuration Properties -> Linker -> Input,
在additional dependencies中加入cxcore.lib cv.lib ml.lib cvaux.lib highgui.lib等需要的库。
注意加入的库文件要和第3步生成的文件名一致,假如在第3步中选择VS2005的编译器时,
生成的文件名含有200d(不知道其他的编译器会不会),此时加入的库文件应该
cxcore200d.lib cv200d.lib ml200d.lib cvaux200d.lib highgui200d.lib
每次新建一个project都要添加项目所需的lib

按上面的提示配置完后拷贝了以OpenCV中文论坛上的2.0版本的helloworld程序,发现有fatal error C1010: unexpected end of file while looking的错误, 查了下是预编译头的问题,解决方法是在设置那C/C++的Category的选项框选择Precompiled Headers 然后再选择Not using precompiled headers,这样再编译一下,Ok通过。运行一下,终于看到了经典的lena照片。

现在情况如下,我在VC6.0平台下使用OpenCV1.0库,在VS2005下使用OpenCV2.0库,暂时运行正常,没有冲突。写段文章总结一下,防止以后忘了,想双平台运行的朋友也可以参考一下。如有Bug出现,也希望大家提出来。


=================================================================================

以下为个人整理的内容:

根据参考的那篇博文说:需要自己下载CMake来产生需要的dll和lib文件!

但是我是从网上下载了OpenCV2.4.6.0, 双击解压后,发现里面有现成的dll和lib文件,可以直接使用,不需要下载CMake来编译产生dll和lib文件


下面的源代码来自http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html

本人实现了下,环境:vc2010 + OpenCV2.4.6.0

/*
	环境:winXP + vc2010 + OpenCV2.4.6.0(http://jaist.dl.sourceforge.net/project/opencvlibrary/opencv-win/2.4.6/OpenCV-2.4.6.0.exe)
	OpenCV2.4.6.0安装目录:D:\opensource\opencv

	1. 添加头文件所在目录:
		D:\opensource\opencv\modules\core\include
		D:\opensource\opencv\modules\imgproc\include
		D:\opensource\opencv\modules\highgui\include

		注:以上三个目录可用“D:\opensource\opencv\build\include”一个代替!

	2. 添加lib文件所在目录:
		D:\opensource\opencv\build\x86\vc10\lib

	3. 为项目添加使用到的lib文件:
		opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;
	
	配置完成,编译成功!
	运行时,可能会出现提示:缺少xxx.dll,这时只要将相关dll复制到可执行程序同一目录或将dll所在目录加入到Path环境变量中!
		我采取的是将“D:\opensource\opencv\build\x86\vc10\bin”加入到Path环境变量中!
		再次运行,OK!
*/

// Video Image PSNR and SSIM
#include <iostream> // for standard I/O
#include <string>   // for strings
#include <iomanip>  // for controlling float print precision
#include <sstream>  // string to number conversion

#include <opencv2>  // Gaussian Blur
#include <opencv2>        // Basic OpenCV structures (cv::Mat, Scalar)
#include <opencv2>  // OpenCV window I/O

using namespace std;
using namespace cv;

double getPSNR ( const Mat& I1, const Mat& I2);
Scalar getMSSIM( const Mat& I1, const Mat& I2);

static void help()
{
	cout
		> psnrTriggerValue >> delay;// take out the numbers

	char c;
	int frameNum = -1;          // Frame counter

	VideoCapture captRefrnc(sourceReference), captUndTst(sourceCompareWith);

	if ( !captRefrnc.isOpened())
	{
		cout  > frameReference;
		captUndTst >> frameUnderTest;

		if( frameReference.empty()  || frameUnderTest.empty())
		{
			cout  > > ";
			break;
		}

		++frameNum;
		cout <br>
<br>
<br>
<br>


</opencv2></opencv2></opencv2></sstream></iomanip></string></iostream>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What software is crystaldiskmark? -How to use crystaldiskmark? What software is crystaldiskmark? -How to use crystaldiskmark? Mar 18, 2024 pm 02:58 PM

CrystalDiskMark is a small HDD benchmark tool for hard drives that quickly measures sequential and random read/write speeds. Next, let the editor introduce CrystalDiskMark to you and how to use crystaldiskmark~ 1. Introduction to CrystalDiskMark CrystalDiskMark is a widely used disk performance testing tool used to evaluate the read and write speed and performance of mechanical hard drives and solid-state drives (SSD). Random I/O performance. It is a free Windows application and provides a user-friendly interface and various test modes to evaluate different aspects of hard drive performance and is widely used in hardware reviews

CUDA's universal matrix multiplication: from entry to proficiency! CUDA's universal matrix multiplication: from entry to proficiency! Mar 25, 2024 pm 12:30 PM

General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

How to download foobar2000? -How to use foobar2000 How to download foobar2000? -How to use foobar2000 Mar 18, 2024 am 10:58 AM

foobar2000 is a software that can listen to music resources at any time. It brings you all kinds of music with lossless sound quality. The enhanced version of the music player allows you to get a more comprehensive and comfortable music experience. Its design concept is to play the advanced audio on the computer The device is transplanted to mobile phones to provide a more convenient and efficient music playback experience. The interface design is simple, clear and easy to use. It adopts a minimalist design style without too many decorations and cumbersome operations to get started quickly. It also supports a variety of skins and Theme, personalize settings according to your own preferences, and create an exclusive music player that supports the playback of multiple audio formats. It also supports the audio gain function to adjust the volume according to your own hearing conditions to avoid hearing damage caused by excessive volume. Next, let me help you

How to use NetEase Mailbox Master How to use NetEase Mailbox Master Mar 27, 2024 pm 05:32 PM

NetEase Mailbox, as an email address widely used by Chinese netizens, has always won the trust of users with its stable and efficient services. NetEase Mailbox Master is an email software specially created for mobile phone users. It greatly simplifies the process of sending and receiving emails and makes our email processing more convenient. So how to use NetEase Mailbox Master, and what specific functions it has. Below, the editor of this site will give you a detailed introduction, hoping to help you! First, you can search and download the NetEase Mailbox Master app in the mobile app store. Search for "NetEase Mailbox Master" in App Store or Baidu Mobile Assistant, and then follow the prompts to install it. After the download and installation is completed, we open the NetEase email account and log in. The login interface is as shown below

How to use Baidu Netdisk app How to use Baidu Netdisk app Mar 27, 2024 pm 06:46 PM

Cloud storage has become an indispensable part of our daily life and work nowadays. As one of the leading cloud storage services in China, Baidu Netdisk has won the favor of a large number of users with its powerful storage functions, efficient transmission speed and convenient operation experience. And whether you want to back up important files, share information, watch videos online, or listen to music, Baidu Cloud Disk can meet your needs. However, many users may not understand the specific use method of Baidu Netdisk app, so this tutorial will introduce in detail how to use Baidu Netdisk app. Users who are still confused can follow this article to learn more. ! How to use Baidu Cloud Network Disk: 1. Installation First, when downloading and installing Baidu Cloud software, please select the custom installation option.

Base DEX Faucet: Aerodrome VS Curve Base DEX Faucet: Aerodrome VS Curve Mar 26, 2024 pm 04:31 PM

The Velodrome model is inspired by veCRV and aims to achieve superior consistency among the three key participants of DEX, including liquidity providers (LPs), token holders, and projects that require liquidity. However, many participants in the DeFi field still do not fully understand the underlying reasons. By reading this article in-depth, you will be able to get out of this dilemma and get to the bottom of it. Today we will discuss Velodrome/Aerodrome, a real success story in the DeFi field. This article will compare the two models and explain how Velodrome improves on the veCRV model and what significant impact these small differences have. First, let me state

BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange? BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange? Apr 26, 2024 am 09:40 AM

MetaMask (also called Little Fox Wallet in Chinese) is a free and well-received encryption wallet software. Currently, BTCC supports binding to the MetaMask wallet. After binding, you can use the MetaMask wallet to quickly log in, store value, buy coins, etc., and you can also get 20 USDT trial bonus for the first time binding. In the BTCCMetaMask wallet tutorial, we will introduce in detail how to register and use MetaMask, and how to bind and use the Little Fox wallet in BTCC. What is MetaMask wallet? With over 30 million users, MetaMask Little Fox Wallet is one of the most popular cryptocurrency wallets today. It is free to use and can be installed on the network as an extension

See all articles