0
하나의 이미지를 다른 창 위에 표시하려고하지만 동일한 창에 표시하려고합니다. 나는 나란히 서있는 게시물을 보았지만 이미 그 일을하는 법을 알고 있습니다. 여기에 지금까지 가지고 무엇 : 이것처럼CImg.h 라이브러리를 사용하여 하나의 이미지를 다른 이미지 위에 어떻게 표시합니까?
string firstFile = "";
string secondFile = "";
cout << "Enter the filenames corresponding to the Image and the Logo (in that order): " << endl;
cin >> firstFile;
cin >> secondFile;
const char* filename = firstFile.c_str();
CImg<unsigned char> img1(filename);
const char* filename2 = secondFile.c_str();
CImg<unsigned char> img2(filename2);
int w = img1.width();
int h = img1.height();
int channels = img1.spectrum();
cout << "Successfully loaded image " << firstFile << " of size " << w << " x " << h << " x " << channels << endl;
int w2 = img2.width();
int h2 = img2.height();
channels = img2.spectrum();
cout << "Successfully loaded image " << secondFile << " of size " << w2 << " x " << h2 << " x " << channels << endl;
cout << "Enter the position in (x, y) coordinates where this logo must be placed." << endl << "x must be between 0 and 239 and y must be between 0 and 191." << endl;
int x1, y1;
cin >> x1;
cin >> y1;
char title[100];
sprintf(title, "%s (%d x %d x %d)", filename, w, h, channels);
CImgDisplay disp(img1, title, 0);
img1.display(disp, false);
감사합니다! 내가 가지고있는 문제를 가지고있는 다른 사람들을 주목하기 위해 img1이 표시되기 전에 나는이 진술서를 써야했다. –