Image comparison using Appium

I am using Appium and I have a scenerio wherein I need to capture an image from the app under test, preserve that image as a baseline image and then capture another image from that app under test and then perform an image comparison between these two images.

Can anyone guide me how to do this please.

You can get the image and store at local and compare with Sikuli , you cane compare two image using equal operator
imagePath1 = capture();
imagePath2 = capture();

if myRegion.exists(image2): #look in the region
print “hello” #yeah it’s in the region of the screen
print “hi” #nope not there…

If possible, can you tell the code to capture the image of the object in the screen of the app that I am testing with please.