Ask Your Question

Raki's profile - activity

2019-07-26 09:14:18 -0500 edited question What's the frame OpenCV uses?

What's the frame OpenCV uses? I have two cameras, monocular and stereo. I calibrated both and they're mounted at a fix r

2019-07-26 09:11:23 -0500 edited question What's the frame OpenCV uses?

What's the frame OPENCV uses? I have two cameras, monocular and stereo. I calibrated both and they're mounted at a fix r

2019-07-26 09:10:35 -0500 asked a question What's the frame OpenCV uses?

What's the frame OPENCV uses? I have two cameras, monocular and stereo. I calibrated both and they're mounted at a fix r

2019-07-15 21:50:09 -0500 received badge  Self-Learner (source)
2019-07-15 07:43:24 -0500 marked best answer findChessboardCorners() does not work[SOLVED]

I've my checkerboard fixed at a flat surface and I am looking at it with a 4K monocular camera, yet, the code provided does not work. My goal is to find the board's pose w.r.t the camera.

# algorithm parameters
WINDOW_SIZE = 100 # for 4k image
CHECKERBOARD_WIDTH = 6
CHECKERBOARD_HEIGHT = 4
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objp = np.zeros((CHECKERBOARD_HEIGHT * CHECKERBOARD_WIDTH, 3), np.float32)
objp[:,:2] = np.mgrid[0:CHECKERBOARD_HEIGHT, 0:CHECKERBOARD_WIDTH].T.reshape(-1,2)


 # read the input image
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=True,  help='Path to the image')
args = vars(ap.parse_args())
img = cv2.imread(args['image'])

gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, corners = cv2.findChessboardCorners(gray, (CHECKERBOARD_HEIGHT,CHECKERBOARD_WIDTH),None)

it can't continue from the last line, which means it cannot find the squares/corners. Here is my checkerboard

I thought it was not finding it due to the scratches and dirt, so I tried with a better image and it still did not work.

Is this function kinda buggy or somehow sensitive that it takes such a big effort to make it work?

EDIT: Changing the lightning conditions did not help either:

image description

2019-07-15 07:42:42 -0500 answered a question findChessboardCorners() does not work[SOLVED]

Okay, got it, the problem was while passing the image.png, I did not use the appropriate path, so the function never eve

2019-07-15 07:28:00 -0500 edited question findChessboardCorners() does not work[SOLVED]

findChessboardCorners() does not work I've my checkerboard fixed at a flat surface and I am looking at it with a 4K mono

2019-07-15 07:23:18 -0500 asked a question findChessboardCorners() does not work[SOLVED]

findChessboardCorners() does not work I've my checkerboard fixed at a flat surface and I am looking at it with a 4K mono

2019-07-15 06:53:48 -0500 commented answer How to generate checkerboard for camera calibration?

Would circle one work for monocular camera calibration, or is it used for stereo?

2019-07-02 04:49:08 -0500 edited question Camera Pose from Checkerboard Pose

Camera Pose from Checkerboard Pose I am using the code given by the OpenCV to find tvecs and rvecs of the camera which I

2019-03-13 04:06:15 -0500 commented question OpenCV Error: Null pointer (NULL guiReceiver (please create a window))

Facing the same. Unbelievable that no one has replied yet.

2019-03-13 04:05:26 -0500 commented question Camera Pose from Checkerboard Pose

Yes I used that code, as I wrote in the question body.

2019-03-06 10:55:37 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 10:54:17 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 10:43:41 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 10:35:30 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 09:01:35 -0500 commented question Camera Pose from Checkerboard Pose

These matrices can be passed in to the function like this : retval, rvecs, tvecs, inliers = cv2.solvePnPRansac(objp, cor

2019-03-06 09:00:28 -0500 commented question Camera Pose from Checkerboard Pose

As an example, here are mine: M_MATRIX = np.asmatrix([21696.117836, 0.000000, 1956.264838, 0.000000, 22075.059632, 531.

2019-03-06 08:59:23 -0500 commented question Camera Pose from Checkerboard Pose

@supra56 That is the output of your intrinsic calibration procedure, but you can also simply create two arrays containin

2019-03-06 03:14:12 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 03:12:42 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 03:12:39 -0500 received badge  Self-Learner (source)
2019-03-06 03:12:20 -0500 marked best answer Camera Pose from Checkerboard Pose

I am using the code given by the OpenCV to find tvecs and rvecs of the camera which I calibrated intrinsically. I do get these two vectors, no problem.

image description

rvecs: [[-0.73059634]
 [-0.02493155]
 [ 0.1556929 ]]
tvecs: [[-2.8194188 ]
 [ 1.25920043]
 [77.38695895]]

However, I am not sure if these are the values for my camera or my checkerboard. The language used in the tutorial isn't totally clear. But I think these are the values for the checkerboard, like, this isn't the pose of the camera, but rather the pose of the board, which is not why people use this code in the first place.

Also, if these are actually the camera parameters, then one must multiply 77 with the size of one checker that he uses. Mine has 11 mm side, so for me the height would correspond to 77 * 1.1, which is also wrong since I measured the height and it's not that high.

Something is fishy here.

My question is, how could we go to camera extrinsics from these vectors?

2019-03-06 03:12:01 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 03:11:39 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 03:10:21 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 03:09:46 -0500 edited answer Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Get the matrices required for the calculati

2019-03-06 03:06:18 -0500 answered a question Camera Pose from Checkerboard Pose

So, this is how it is done. First, you calibrate your camera intrinsically. Then, you place your pattern on a fixed l

2019-03-06 03:00:30 -0500 commented question Camera Pose from Checkerboard Pose

Yes, I am trying to find rvecs and tvecs for the camera, so that I can modify the urdf model in ROS and set it up. I tho

2019-03-06 02:53:59 -0500 commented question Camera Pose from Checkerboard Pose

Yes, I am trying to find rvecs and tvecs for the camera, so that I can modify the urdf model in ROS and set it up. I tho

2019-03-06 02:48:08 -0500 edited question Camera Pose from Checkerboard Pose

Camera Pose from Checkerboard Pose I am using the code given by the OpenCV to find tvecs and rvecs of the camera which I

2019-03-06 02:45:33 -0500 edited question Camera Pose from Checkerboard Pose

Camera Pose from Checkerboard Pose I am using the code given by the OpenCV to find tvecs and rvecs of the camera which I

2019-03-06 02:43:35 -0500 asked a question Camera Pose from Checkerboard Pose

Camera Pose from Checkerboard Pose I am using the code given by the OpenCV to find tvecs and rvecs of the camera which I

2019-03-05 06:00:17 -0500 marked best answer Resize and Remap

I have a camera which only provides 4K image, and I cannot really do the image processing I want to do on these images. It's extremely slow.

I thought of resizing the image before the processing starts, but then all the pixel coordinates shift and I cannot get the world coordinates correct, so remapping is needed.

In order to learn how the function works, I am having the following:

import cv2
import numpy as np
import argparse

RESIZE_FACTOR = 0.3 # make it this smaller
POINT = (447, 63)

if __name__ == '__main__':

    # read the input image
    ap = argparse.ArgumentParser()
    ap.add_argument('-i', '--image', required=True,  help='Path to the image')
    args = vars(ap.parse_args())
    raw_img = cv2.imread(args['image'], 1)

    # draw a point on the raw image
    cv2.circle(raw_img,POINT, 63, (0,0,255), -1)
    cv2.imshow('raw',raw_img)

    # resize the raw image and redraw
    raw_img = cv2.imread(args['image'], 1)
    resized_img = cv2.resize(raw_img, (0,0), fx=RESIZE_FACTOR, fy=RESIZE_FACTOR) 
    cv2.circle(resized_img,POINT, 63, (0,0,255), -1)

   # use a function to map the pixels

    # compare the results
    cv2.imshow('resized',resized_img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

As you can imagine, the red dot I drew shifted greatly between the raw and resized images, expectedly. Now I would like to use a function (possibly called remap()) to get the actual pixel coordinate of the dot on the raw image.

However, I am not sure if this function would do the magic, neither I am sure how to use it. I think I need to find homography between these images, and it's not a straightforward process.

Is there a simple way of doing what I am having in mind?