1、  从 http://ukoethe.github.io/vigra/ 下载最新源代码vigra-1.10.0-src-with-docu.tar.gz,并加压缩到D:\soft\vigra,生成vigra-1.10.0文件夹;

2、  从http://www.cmake.org/cmake/resources/software.html下载CMake并安装;

3、  打开CMake,Where is thesource code: D:/soft/vigra/vigra-1.10.; Where to build the binaries: D:/soft/vigra/;

4、  点击Configure,-->Specify the generator for this project:Visual Studio 10, Use default nativecompilers, 点击finish;

5、  将VIGRA_STATIC_LIB勾选,点击Generate,如果有红色框出现,再次点击Generate即可;

6、  打开vs2010下的vigra.sln工程,首先选中vigraimpex工程,属性中的RuntimeLibrary,release下改为Multi-threaded(/MT),debug下改为Multi-threaded Debug(/MTd),然后分别在Debug和Release下选SolutionExplorer中的Solution ‘vigra’工程,点击右键,运行”Rebuild Solution”,会在D:\soft\vigra\vs2010\src\impex目录下生成Debug/vigraimpex.lib和/Release/vigraimpex.lib ;

7、新建一个控制台工程TestVigra, (1)、在debug下,将Code Generation下的Runtime Library改为Multi-threaded Debug(/MTd), 在release下,将Runtime Library 改为Multi-threaded(/MT) ;(2)、分别在debug和release下,在vc++ directories中,Include directories: D:\soft\vigra\vigra-1.10.0\include; (3)、分别在debug和release下,属性C/C++的Additional Include Directories:D:\soft\vigra\vigra-1.10.0\include; Preprocessor的Preprocessor Definitions: VIGRA_STATIC_LIB;(4)、属性中Character Set: Use Multi-Byte Character Set

stdafx.h:

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//#pragma once#include "targetver.h"#include <stdio.h>
#include <tchar.h>#include "vigra/stdimage.hxx"
#include "vigra/impex.hxx"//Image import and export functions
#include "vigra/edgedetection.hxx"using namespace vigra;// TODO: reference additional headers your program requires here

stdafx.cpp:

// stdafx.cpp : source file that includes just the standard includes
// TestVigra.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information#include "stdafx.h"// TODO: reference any additional headers you need in STDAFX.H
// and not in this file#ifdef _DEBUG#pragma comment(lib, "D:/soft/vigra/vs2010/src/impex/Debug/vigraimpex.lib")
#else#pragma comment(lib, "D:/soft/vigra/vs2010/src/impex/Release/vigraimpex.lib")
#endif

main.cpp:

#include "stdafx.h"
#include <iostream>
#include <string>using namespace std;int main(int argc, char* argv[])
{try {cout<<"supported formats: "<<vigra::impexListFormats()<<endl;string strImageName = "base.bmp";string strOutImage  = "new.bmp";ImageImportInfo info(strImageName.c_str(), 0);//read image//vigra_precondition(info.isGrayscale(), "Sorry, cannot operate on color images");double threshold=200, scale=0.5;if (info.isGrayscale()) {BImage out(info.width(), info.height()); // create a gray scale image of appropriate sizeBImage in(info.width(), info.height());importImage(info, destImage(in));out = 255;// paint output image whiteimportImage(info, destImage(out));// import the image just read//differenceOfExponentialEdgeImage(srcImageRange(in), destImage(out), scale, threshold, 0);//cannyEdgeImage(srcImageRange(in), destImage(out), scale, threshold, 0);// call edge detection algorithmtransformImage(srcImageRange(in), destImage(out), linearIntensityTransform(-1, -255));//invert imageexportImage(srcImageRange(out), ImageExportInfo(strOutImage.c_str()));// write the image to the file} else {BRGBImage out(info.width(), info.height());// create a RGB image of appropriate sizeBRGBImage in(info.width(), info.height());importImage(info, destImage(out));importImage(info, destImage(in));//RGBValue<int> offset(-255, -255, -255);//transformImage(srcImageRange(in), destImage(out), linearIntensityTransform(-1, offset));double sizefactor = 1.2;int nw = (int)(sizefactor*(info.width()-1) + 1.5); // calculate new image sizeint nh = (int)(sizefactor*(info.height()-1) + 1.5);BRGBImage out1(nw, nh);resizeImageSplineInterpolation(srcImageRange(in), destImageRange(out1));// resize the image, using a bi-cubic spline algorithmsexportImage(srcImageRange(out1), ImageExportInfo(strOutImage.c_str()));}} catch (StdException &e) {cout<<e.what()<<endl;// catch any errors that might have occurred and print their reasonreturn 1;}cout<<"ok!"<<endl;return 0;
}

GitHub:https://github.com/fengbingchun/Vigra_Test

用vs2010编译vigra静态库及简单使用举例相关推荐

  1. VS2010,C++ 制作静态库(*.lib),并使用

    VS2010,C++ 制作静态库(*.lib),并使用 原文链接:https://blog.csdn.net/qq_41472037/article/details/100001322 简单来说,就是 ...

  2. pytorch 矩阵相乘_编译PyTorch静态库

    背景 众所周知,PyTorch项目作为一个C++工程,是基于CMake进行构建的.然而当你想基于CMake来构建PyTorch静态库时,你会发现: 静态编译相关的文档不全: CMake文件bug太多, ...

  3. linux编译c++ 静态库,C/C++ 条件编译静态库

    ==>windows 下方法: 1.方法一:VS工程中中直接添加 1.1在VS的属性->常规->附加库目录,添上文件夹的路径:例如:lib/x64: 1.2输入的附加依赖项,添加上库 ...

  4. cmake 编译 linux 库,使用CMake编译跨平台静态库

    在开始介绍如何使用CMake编译跨平台的静态库以前,先讲讲我在没有使用CMake以前所趟过的坑.由于不少开源的程序,好比png,都是自带编译脚本的.咱们可使用下列脚原本进行编译:linux . / c ...

  5. PHP编译为静态库,Linux下将Tinyxml编译为静态库

    转载请注明来源:Linux下将Tinyxml编译为静态库 一个应用需要在linux服务器上运行,不能保证每个服务器都有应用依赖的库,又懒得每个服务器都去安装下,也不太现实,于是就将应用所用到的库全部编 ...

  6. iOS架构-C/C++lame库在Mac下编译通用静态库.a库(13)

    C/C++ 有很多成熟的库,还有很多特殊功能的库,有时候iOS 平台开发一些比较前沿或者冷门的功能时,iOS并没有提供解决方案,这时候就可以研究C/C++的一些库,为我们使用.但是在Xcode编译C/ ...

  7. Linux中gcc的编译、静态库和动态库的制作

    欢迎大家关注笔者,你的关注是我持续更博的最大动力 Linux中gcc的编译.静态库.动态库 文章目录: 1 gcc的编译过程 1.1 gcc的编译过程 1.2 gcc的常用参数 2 gcc 静态库的制 ...

  8. Linux基础——gcc编译、静态库与动态库(共享库)

    Linux基础--gcc编译.静态库与动态库(共享库) https://blog.csdn.net/daidaihema/article/details/80902012 Linux基础--gcc编译 ...

  9. 【转】iOS编译OpenSSL静态库(使用脚本自动编译)

    原文网址:https://www.jianshu.com/p/651513cab181 本篇文章为大家推荐两个脚本,用来iOS系统下编译OpenSSL通用库,如果想了解编译具体过程,请参看<iO ...

最新文章

  1. Single Page Application概览
  2. 今晚有直播 | 全国大学生智能汽车竞赛人工智能创意赛来啦!
  3. ping无法访问目标主机 0丢失_预渗透之目标识别
  4. 关于《红楼梦》的读后感优秀范文2000字
  5. VS2008如何自动添加消息映射
  6. 锁分区提升并发,以及锁等待实例
  7. boost::msm::mpl_graph::adjacency_list_graph相关的测试程序
  8. ant编译web项目
  9. 文件管理系统源码_基于Spring Cloud微服务构建多平台功能完善小说弹幕网站源码分享...
  10. python实现单张图像拼接与批量图片拼接
  11. Rust的所有权(Ownership)
  12. iOS开发之33 款主宰 2017 iOS 开发的开源库
  13. Java简单ztree树
  14. 计算机水平考试模块数量,职称计算机考试科目、模块数量是什么
  15. 2019 年数据仓库 BI 及 Data Science 最全书单
  16. 怎么将多个Excel工作簿合并成一个新的工作簿
  17. bootstrap4-Collapse 折叠 酷炫特效
  18. kali渗透综合靶机(九)--Typhoon靶机
  19. 给罗永浩和王自如打个分
  20. 【Learn and record】 天气现象选码原则

热门文章

  1. 如何快速设计元器件原理图库和PCB封装库?
  2. 单目深度估计与伪雷达点云、可视化
  3. R19436221 区间第k小 主席树
  4. C++实现图像的绘制并实现鼠标交互
  5. 鱼眼图像的unwarping过程
  6. Keras输出网络结构图
  7. C++和Python的OpenCV中关于图像坐标的注意事项
  8. leecode第二十题(有效的括号)
  9. 从Excel中导入数据时,提示“未在本地计算机上注册“Microsoft.ACE.OLEDB.12.0”提供程序”的解决办法...
  10. 【视觉SLAM14讲】ch3课后题答案