Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

fixed points in findHomography

hey guys, im trying to use opencv's cv.findChessboardCorners, cv.findHomography and cv.warpPerspective to find a chessboard in my video feed and display it with the original perspective. My problem is that the result is sometimes inverted. the chessboard is displayed correctly and the perspective is also correct, but the homography is upside down (you can see this in the 2. image, the color of the drawn keypoints are not correct) I think this is because the chessboard has no orientation, i.e its the same if i flip it.But i don't know how to fix that since it seems inherent for a chessboard. Is it possible to set the orientation of the warpedPerspective, so that its always "one way"? What can i do to make the homography always register in one direction?

here the orientation is correct and the kp match here the kp are inverted

Here is a part of the code i wrote:

       # checkerboard is a uint8 array that i created, corner_count is the tuple with patternSize
        _, self.cb_corners = cv.findChessboardCorners(checkerboard, corner_count)
       found_board, corners = cv.findChessboardCorners(
            image=frame,
            patternSize=self.corner_count,
            flags=cv.CALIB_CB_FAST_CHECK +
                  cv.CALIB_CB_NORMALIZE_IMAGE +
                  cv.CALIB_CB_ADAPTIVE_THRESH)
        if found_board:
             retval, mask = cv.findHomography(self.cb_corners, corners)   
             dst = cv.warpPerspective(frame, self.homography, (1920, 1080))
             cv.imshow("dst", dst)

fixed points in findHomography

hey guys, im trying to use opencv's cv.findChessboardCorners, cv.findHomography and cv.warpPerspective to find a chessboard in my video feed and display it with the original perspective. perspective.

My problem is that the result is sometimes inverted. the chessboard is displayed correctly and the perspective is also correct, but the homography is upside down (you can see this in the 2. image, the color of the drawn keypoints are not correct) correct)

I think this is because the chessboard has no orientation, i.e its the same if i flip it.But i don't know how to fix that since it seems inherent for a chessboard. Is it possible to set the orientation of the warpedPerspective, so that its always "one way"? What can i do to make the homography always register in one direction?

here the orientation is correct and the kp match here the kp are inverted

Here is a part of the code i wrote:

       # checkerboard is a uint8 array that i created, corner_count is the tuple with patternSize
        _, self.cb_corners = cv.findChessboardCorners(checkerboard, corner_count)
       found_board, corners = cv.findChessboardCorners(
            image=frame,
            patternSize=self.corner_count,
            flags=cv.CALIB_CB_FAST_CHECK +
                  cv.CALIB_CB_NORMALIZE_IMAGE +
                  cv.CALIB_CB_ADAPTIVE_THRESH)
        if found_board:
             retval, mask = cv.findHomography(self.cb_corners, corners)   
             dst = cv.warpPerspective(frame, self.homography, (1920, 1080))
             cv.imshow("dst", dst)

fixed points in findHomography

hey guys, im trying to use opencv's cv.findChessboardCorners, cv.findHomography and cv.warpPerspective to find a chessboard in my video feed and display it with the original perspective.

My problem is that the result is sometimes inverted. the chessboard is displayed correctly and the perspective is also correct, but the homography is upside down (you can see this in the 2. image, the color of the drawn keypoints are not correct)

I think this is because the chessboard has no orientation, i.e its the same if i flip it.But i don't know how to fix that since it seems inherent for a chessboard. chessboard.

Is it possible to set the orientation of the warpedPerspective, so that its always "one way"? way"? What can i do to make the homography always register in one direction? (i can assume that its never actually going to be upside down in the actual camera feed)

here the orientation is correct and the kp match here the kp are inverted

Here is a part of the code i wrote:

       # checkerboard is a uint8 array that i created, corner_count is the tuple with patternSize
        _, self.cb_corners = cv.findChessboardCorners(checkerboard, corner_count)
       found_board, corners = cv.findChessboardCorners(
            image=frame,
            patternSize=self.corner_count,
            flags=cv.CALIB_CB_FAST_CHECK +
                  cv.CALIB_CB_NORMALIZE_IMAGE +
                  cv.CALIB_CB_ADAPTIVE_THRESH)
        if found_board:
             retval, mask = cv.findHomography(self.cb_corners, corners)   
             dst = cv.warpPerspective(frame, self.homography, (1920, 1080))
             cv.imshow("dst", dst)

fixed points in findHomography

hey guys, im trying to use opencv's cv.findChessboardCorners, cv.findHomography and cv.warpPerspective to find a chessboard in my video feed and display it with the original perspective.

My problem is that the result is sometimes inverted. the chessboard is displayed correctly and the perspective is also correct, but the homography is upside down (you can see this in the 2. image, the color of the drawn keypoints are not correct)

I think this is because the chessboard has no orientation, i.e its the same if i flip it.But i don't know how to fix that since it seems inherent for a chessboard.

Why is this happening? Is it possible to set the orientation of the warpedPerspective, so that its always "one way"? What can i do to make the homography always register in one direction? (i can assume that its never actually going to be upside down in the actual camera feed)

here the orientation is correct and the kp match here the kp are inverted

Here is a part of the code i wrote:

       # checkerboard is a uint8 array that i created, corner_count is the tuple with patternSize
        _, self.cb_corners = cv.findChessboardCorners(checkerboard, corner_count)
       found_board, corners = cv.findChessboardCorners(
            image=frame,
            patternSize=self.corner_count,
            flags=cv.CALIB_CB_FAST_CHECK +
                  cv.CALIB_CB_NORMALIZE_IMAGE +
                  cv.CALIB_CB_ADAPTIVE_THRESH)
        if found_board:
             retval, mask = cv.findHomography(self.cb_corners, corners)   
             dst = cv.warpPerspective(frame, self.homography, (1920, 1080))
             cv.imshow("dst", dst)