【发布时间】:2015-05-03 06:13:34
【问题描述】:
我不断收到此警告
Warning 1 警告 C4566: 由通用字符名 '\u202A' 表示的字符无法在当前代码页中表示 (1252) C:\Users\ankitdeora2856\Downloads\opencvFiles\main.cpp 1088
在 Visual Studio 2012 中以 c++ 运行我的 opencv 代码时。我的代码正在构建且没有任何错误,但此警告会产生问题,无法获得预期的输出。我正在尝试使用 addweighted() 函数添加两个图像,但由于此警告而没有得到输出。
#include <cv.h>
#include <highgui.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
double alpha = 0.5; double beta; double input;
Mat src1, src2, dst;
/// Ask the user enter alpha
std::cout<<" Simple Linear Blender "<<std::endl;
std::cout<<"-----------------------"<<std::endl;
std::cout<<"* Enter alpha [0-1]: ";
std::cin>>input;
/// We use the alpha provided by the user if it is between 0 and 1
if( input >= 0.0 && input <= 1.0 )
{ alpha = input; }
/// Read image ( same size, same type )
src1 = imread("pic1.jpg");
src2 = imread("pic2.jpg");
if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
/// Create Windows
namedWindow("Linear Blend", 1);
beta = ( 1.0 - alpha );
addWeighted( src1, alpha, src2, beta, 0.0, dst);
imshow( "Linear Blend", dst );
waitKey(0);
return 0;
}
【问题讨论】:
-
有人在 " 和 pic1.jpg 之间插入了UTF-8 sequence E2 80 AA,只需重写这一行。下一行也是如此
-
当然,如果实际文件名包含这些字符,您还需要重命名文件,否则将找不到。
标签: c++ opencv visual-studio-2012