weird looking on joining images

the output should be stacked images which can controlled by the trackbar as the tutorial i was following
here is the code

here is the output image below

please paste your code here, not on some external bin, and also spare us unnessecary screenshots of your ide, thank you.