小编Ala*_*ler的帖子

获取在变量参数列表中传递的参数类型

我编写了一个带有变量参数列表的函数

void cvShowMatImages( char* title, int nArgs, ...)  // Mat Images
Run Code Online (Sandbox Code Playgroud)

传递的参数是openCV图像.我实际上有两种不同的功能,用于2种图像格式IplImage和Mat,上面提到的和第二种

void cvShowIplImages( char* title, int nArgs, ...)  // Ipl Images
Run Code Online (Sandbox Code Playgroud)

但我无法混合两种类型的图像.如果我能够确定传递的参数类型,我可以解决我的问题,但我不知道该怎么做.这就是我读这个论点的方式:

// Get the images passed as arguments
va_list args;
// Initialize the variable argument list
va_start( args, nArgs );
// Loop on each image
for ( int num = 0; num < nArgs; num++ )
{
   // Get the image to be copied from the argument list
   srcImg = va_arg( args, Mat );
   ...
Run Code Online (Sandbox Code Playgroud)

对于IplImage:

srcImg = …
Run Code Online (Sandbox Code Playgroud)

c++ opencv variadic-functions

5
推荐指数
1
解决办法
1126
查看次数

标签 统计

c++ ×1

opencv ×1

variadic-functions ×1