3
votes

I am continuously getting this warning

Warning 1 warning C4566: character represented by universal-character-name '\u202A' cannot be represented in the current code page (1252) C:\Users\ankitdeora2856\Downloads\opencvFiles\main.cpp 1088

while running my opencv code in c++ in visual studio 2012. My code is building without any errors but this warning is creating issues, not getting the expected output. I am trying to add two images using addweighted() function but not getting the output due to this warning.

#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;
}
1
Somebody inserted UTF-8 sequence E2 80 AA between " and pic1.jpg, just rewrite this line. Same goes for next linemyaut
Of course, it the actual file names contain those characters, you'll also need to rename the files, or they will not be found.celtschk

1 Answers

0
votes

A UTF-8 character ('\u202A' ) is somewhere in your code but it can't be seen with your current encoding.

I had this issue as well, to solve it I pasted the code into Notepad++ and then at the top under Encoding I changed it to ANSI, the hidden characters appeared and I was able to delete them and paste the result back into Visual Studio.