OpenCV一个窗口显示多张图片

这篇博客介绍了如何在OpenCV中使用代码显示多张图片,重点提到了cvShowManyImages函数,并指出了该函数仅支持3通道图像。同时,文章讨论了cvLoadImage和imread函数在处理灰度图时的注意事项,包括通道数的要求和保存图像的规则。
摘要由CSDN通过智能技术生成

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

这个以前的时候,采取的是把要显示的图片copy到一张大图片上去~ 这个也忒麻烦了点

然后 在 http://download.csdn.net/detail/zhazhiqiang2010/3614993#comment 这里发现一个好用的代码。。。。

感谢上传者,记录在这里只为了以后方便使用~~~

#include <cv.h>#include <highgui.h>#include <stdio.h>#include <stdarg.h>#include <time.h>#include <iostream>#pragma comment(lib, "cv.lib")#pragma comment(lib, "cxcore.lib")#pragma comment(lib, "highgui.lib")void cvShowManyImages(char* title, int nArgs, ...) // img - Used for getting the arguments  IplImage *img; // DispImage - the image in which input images are to be copied IplImage *DispImage; int size; int i; int m, n; int x, y; // w - Maximum number of images in a row  // h - Maximum number of images in a column  int w, h; // scale - How much we have to resize the image float scale; int max; // If the number of arguments is lesser than 0 or greater than 12 // return without displaying  if(nArgs <= 0) {  printf("Number of arguments too small....\n");  return; } else if(nArgs > 12) {  printf("Number of arguments too large....\n");  return; } // Determine the size of the image, and the number of rows/cols  from number of arguments  else if (nArgs == 1) {  w = h = 1;  size = 300; } else if (nArgs == 2) {  w = 2; h = 1;  size = 300; } else if (nArgs == 3 || nArgs == 4) {  w = 2; h = 2;  size = 300; } else if (nArgs == 5 || nArgs == 6) {  w = 3; h = 2;  size = 200; } else if (nArgs == 7 || nArgs == 8) {  w = 4; h = 2;  size = 200; } else {  w = 4; h = 3;  size = 150; } // Create a new 3 channel image0 DispImage = cvCreateImage( cvSize( 100+ size*w, 60 + size*h), 8, 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值