[ASIFT 1] Load images
来源:互联网 发布:动态分配二维数组 编辑:程序博客网 时间:2024/06/10 09:43
int main(int argc, char**argv[]){ if ((argc != 8) && (argc != 9)) { std::cerr << " ******************************************************************************* " << std::endl << " *************************** ASIFT image matching **************************** " << std::endl << " ******************************************************************************* " << std::endl << "Usage: " << argv[0] << " imgIn1.png imgIn2.png imgOutVert.png imgOutHori.png " << std::endl << " matchings.txt keys1.txt keys2.txt [Resize option: 0/1] " << std::endl << "- imgIn1.png, imgIn2.png: input images (in PNG format). " << std::endl << "- imgOutVert.png, imgOutHori.png: output images (vertical/horizontal concatenated, " << std::endl << " in PNG format.) The detected matchings are connected by write lines." << std::endl << "- matchings.txt: coordinates of matched points (col1, row1, col2, row2). " << std::endl << "- keys1.txt keys2.txt: ASIFT keypoints of the two images." << std::endl << "- [optional 0/1]. 1: input images resize to 800x600 (default). 0: no resize. " << std::endl << " ******************************************************************************* " << std::endl << " ********************* Jean-Michel Morel, Guoshen Yu, 2010 ******************** " << std::endl << " ******************************************************************************* " << std::endl; return 1; } }argc: number of the parameters from the command line
this project needs 8 or 9 parameters when you want to run it;
argv[]: argv[0] shows the name of the project
use argv[1] to get the first string parameter, argv[2].......
as you know, you can use char* to store a string, such as ' hello_world'. So, char **argv[] can store a set of char*. But when your parameters are numbers, you can use char* argv[] to store them.
/**************************input images******************************/
// Read image1 float * iarr1; size_t w1, h1; if (NULL == (iarr1 = read_png_f32_gray(argv[1], &w1, &h1))) { std::cerr << "Unable to load image file " << argv[1] << std::endl; return 1; } std::vector<float> ipixels1(iarr1, iarr1 + w1 * h1); free(iarr1); /*memcheck*/ // Read image2 float * iarr2; size_t w2, h2; if (NULL == (iarr2 = read_png_f32_gray(argv[2], &w2, &h2))) { std::cerr << "Unable to load image file " << argv[2] << std::endl; return 1; } std::vector<float> ipixels2(iarr2, iarr2 + w2 * h2); free(iarr2); /*memcheck*/
argv[1] and argv[2] are the names of the images, then the width and height of the images are stored in w1,h1 and w2,h2 respectively.
read_png_f32_gray : read .png image. you can learn it in theipol.
0 0
- [ASIFT 1] Load images
- [ASIFT 2] ASIFT Resize Images and simulate a tilt
- ASIFT
- ASIFT
- Lazy Load Images jQuery Plugin
- do a lazy load of images in ListView
- Android ImageLoader - load images sequencially in the background
- iphone development NSBundle pathForResource load images from subfolder problem
- Learn To Save and Load External Images in Google Android
- Tensorflow Image Processing Basic 2: Load Images from folder
- images
- images
- images
- images
- images
- images
- [ASIFT 3] Computing ASIFT keypoints and matching
- [ASIFT 0] ASIFT算法深入讲解
- c++ socket编程
- 百度地图定位
- Freemarker数字格式化总结
- Linux查看程序占用的端口-lsof
- 环境变量配置window7和window10
- [ASIFT 1] Load images
- CCF NOI1046 打印方阵
- Bmob移动支付学习Demo
- c++ socket 异步编程
- [BZOJ4353]Play with tree(树链剖分+线段树)
- 我如何从一个本科双非报考帝都985最后调剂到帝都221的故事
- 【正一专栏】从人民的名义看失败的婚姻关系
- 【正一专栏】一直的梦想——我的读书记
- NYOJ 248