Image difference after Image registration and alignment

I have two images which are similar but one image is having lighter shade of color compared to other. When I try to get difference between two images everything is shown as different even though objects are just having different shades of gray color. Is there any way to ignore the color / shade difference while finding difference?

Code:

imageA = cv2.imread(“Image1.png”)
imageB = cv2.imread(“Image2.png”)

grayA = cv2.cvtColor(imageA, cv2.COLOR_BGR2GRAY)
grayB = cv2.cvtColor(imageB, cv2.COLOR_BGR2GRAY)

diff = cv2.absdiff(grayA, grayB)

thresh = cv2.threshold(diff, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)

for c in cnts:
(x, y, w, h) = cv2.boundingRect(c);
cv2.rectangle(imageA, (x, y), (x + w, y + h), (0, 0, 255), 2)

cv2.imwrite(“result.png”, imageA)

Appreciate the help.