SimpleCV image stitching: color space changes after warping

I use SimpleCV to stitch images. I made some changes to the SimpleCV GitHub code and ended up converting the image correctly. But the problem is that the color of the image changes after transformation.

I used these images http://imgur.com/a/lrGw4 . The output of my code is: http://i.imgur.com/2J722h.jpg

This is my code:

from SimpleCV import *
import cv2
import cv

img1 = Image("s.jpg")
img2 = Image("t.jpg")

dst = Image((2000, 1600))

# Find the keypoints.
ofimg = img1.findKeypointMatch(img2)

# The homography matrix.
homo = ofimg[1]
eh = dst.getMatrix()

# transform the image.
x = Image(cv2.warpPerspective(np.array((img2.getMatrix())), homo,
  (eh.rows, eh.cols+300), np.array(eh), cv.INTER_CUBIC))

# blit the img1 now on coordinate (0, 0).
x = x.blit(img1, alpha=0.4)
x.save("rishi1.jpg")
+5
source share
1 answer

It seems you are using the old SimpleCV revision. In the latest version, a way to get a homography matrix [ 1 ]:

ofimg[0].getHomography()

Edit:

, , , . , , , :

x = Image(cv2.warpPerspective(np.array((img2.getMatrix())), homo,
  (eh.rows, eh.cols+300), np.array(eh), cv.INTER_CUBIC), colorSpace=ColorSpace.RGB).toBGR()

, , BGR, SimpleCV RGB. , , .

+3

All Articles