Ask Your Question

Revision history [back]

Although my answer is late, call moveWindow() after each imshow() call.

I am using Java SE8 with OpenCV 4.2. This method works for me. Screenshot of an example in action.

image description

@yes123 Here is a Java+OpenCV code snippet for the display part:

 ... 

//display image. Using OpenCV HighGui class methods.
String inputWindowName = "This window shows input image";
String outputWindowName = "This window shows output image";

HighGui displayWindow = new HighGui();

displayWindow.imshow(inputWindowName, img1);

displayWindow.imshow(outputWindowName, img2);
displayWindow.moveWindow(outputWindowName, img1.cols()+40, 0);

displayWindow.waitKey(7000);
displayWindow.waitKey(1);