Ask Your Question

Katri's profile - activity

2019-12-18 03:47:19 -0600 received badge  Popular Question (source)
2018-01-14 04:57:59 -0600 received badge  Famous Question (source)
2016-07-21 11:08:03 -0600 received badge  Notable Question (source)
2015-10-26 07:30:25 -0600 received badge  Popular Question (source)
2013-12-09 01:47:01 -0600 asked a question alternate to opencv cv.waitkey in python or pygtk

I am writing a code which saves an image, when space bar is pressed. I used opencv's cv.waitkey() but this functions only if a GUI window is active. I donot want to depend on a GUI Window.

I tried using pygtk's key-press-event, but this doesnot wait for key press. It only does the specified function when a key is presses. I have a pygtk window open

How do i wait for a particular key press in python or pygtk??

Any help is appreciated. Thanks

2013-11-29 04:37:16 -0600 commented answer Calculating distance from the pixel value of a disparity map

this seems to return the same matrix for every image. a 4x4 matrix. how to get depth from that?

2013-11-25 23:09:29 -0600 commented answer ReprojectImage to 3d

thanx maham khan, it was very useful.. http://robocv.blogspot.in/2012/01/minoru-3d-webcam-for-real-time-stereo.html the link u posted wasnt complete.

2013-11-25 12:19:00 -0600 received badge  Student (source)
2013-11-25 04:38:26 -0600 asked a question ReprojectImage to 3d

Hi,

I am trying to find the distance from the camera to bject

I used stereoCalibrate stereoRectify reprojectImageto3D

The output z values i get lie in between 0 and 1. How do I transform these to the real cordinate system?

Thanks in advance

2013-11-25 03:27:52 -0600 commented answer opencv ReprojectImageto3D gives values tending to infinity

okay, so how do we map these values to the distance.

2013-11-25 03:12:32 -0600 commented answer opencv ReprojectImageto3D gives values tending to infinity

okay, thanx berak

2013-11-25 03:07:54 -0600 commented answer opencv ReprojectImageto3D gives values tending to infinity

@berak,

okay, so what can be done is to just remove those values with a threshold I guess right. and are these values in pixels? the output in the depth map. basically am trying tgo find depth. and the values I get are similar to these

0.017291443422436714 033600419759750366. i am not sure if what am getting is right or wrong

2013-11-25 00:59:14 -0600 asked a question opencv ReprojectImageto3D gives values tending to infinity

I am using stereocalibrate and stereorectify to get the Q matrix. I am giving this as input to cv.ReprojectImageto3D to get the depth map. But when I try to show the results, many values are calculated as infinity.

Do I need to change or scale anything before reprojecting. And is the result which we get in pixels?

(roi1,roi2) = cv.StereoRectify(camMatrix1, camMatrix2, d1, d2,(320,240), r, t, r1, r2, p1, p2, q, cv.CV_CALIB_ZERO_DISPARITY, -1, (0, 0))
np.savetxt('Q_mat.txt',q)
disparity  = getDisparity(img_r, img_l, "BM")
disp = cv.fromarray(disparity)
Image = cv.CreateMat(disp.rows, disp.cols, cv.CV_32FC3)
Q = np.loadtxt('Q_mat.txt')
Q = np.reshape(Q,(4,4))
Q1 = cv.fromarray(Q)
cv.ReprojectImageTo3D(disp, Image, Q1, 0)

Thanks in advance

2013-11-21 04:43:40 -0600 received badge  Scholar (source)
2013-11-21 02:33:14 -0600 commented question OpenCV Android with python

thanx berak. i guess i will go with java. seems like an easier and better option

2013-11-21 01:29:58 -0600 commented question OpenCV Android with python

thanks berak, Guess I do have to learn Java. Do you think we can extend the code from python to java and then use it? btw do you have any idea id OpenCV plans to launch this with python?

2013-11-20 06:51:02 -0600 asked a question OpenCV Android with python

Hi,

I am working with OpenCV python. I wish to launch my application in a mobile device i.e. android device. But OpenCV android seems to support only Java. Is there a way where I can use my Python script for OpenCV4Android. Or does anyone know if a future version compatible with python is being released?

Thanks in advance,

2013-10-31 04:59:25 -0600 received badge  Editor (source)
2013-10-31 04:30:44 -0600 asked a question camera Calibration in opencv (python stereo camera). Error:too many value to unpack

Hi, I am trying the stereo calibration in opencv using python. I am using python version 2.7.1 and openCV version 2.4.2 When i run the code, I get an error saying too many values to unpack. Below is my code:

objpts=[]
objPoints = []
pointCounts = hor*ver
R = [8]
T = [8]
E=[]  
F=[]
R1 = []
R2 = []
P1=[]
P2 =[]
objectPoints = []
imgPoints1 = []
imgPoints2 = []
imagePoints2 = []
imagePoints1 = []

while ((len(imagePoints1) < hor*ver) and (len(imagePoints2)< hor*ver)): #hor x ver

ret,imgr  = webCamHndlr_r.read(0)
ret,imgl  = webCamHndlr_l.read(1)
grey_imgr = cv2.cvtColor(imgr, cv.CV_BGR2GRAY)
grey_imgl = cv2.cvtColor(imgl, cv.CV_BGR2GRAY)
ret, cornersr =cv2.findChessboardCorners(grey_imgr,dims)
cv2.drawChessboardCorners(grey_imgr,dims,cornersr,0)
ret, cornersl =cv2.findChessboardCorners(grey_imgl,dims)
cv2.drawChessboardCorners(grey_imgl,dims,cornersl,0)
cv2.imshow("chessboard", grey_imgr)
cv2.imshow("chessboard1", grey_imgl)

objPoints = np.zeros((hor*ver,3), np.float32)
objPoints[:,:2] = np.mgrid[0:hor,0:ver].T.reshape(-1,2)

if cv.WaitKey(-1) == 32:

    imagePoints1.append(cornersl)
    imagePoints2.append(cornersr)
    print len(imagePoints1)
    objectPoints.append(objPoints)
    cv2.imwrite("./test_images/img_r"+str(i)+".jpg",imgr)
    cv2.imwrite("./test_images/img_l"+str(i)+".jpg",imgl)
    i = i+1;


    if cv2.waitKey(10) == 27:
        break

objectPoints = [np.asarray(x)
                   for x in objectPoints]
imagePoints1 = [np.asarray(x)
                for x in imagePoints1]
imagePoints2 = [np.asarray(x)
              for x in imagePoints2]


if( len(imagePoints1[0])== len(imagePoints2[0]) == len(objectPoints[0]) == len(objectPoints)==      len(imagePoints2) == len(imagePoints1) ) :
 print len(imagePoints1[0])

 cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F =          cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, (320,240))
  print R

  cv.StereoRectify(cameraMatrix1, cameraMatrix2, distCoeffs1, distCoeffs2,(imgr.width,imgr.height), R, T, R1, R2, P1, P2, Q, CV_CALIB_ZERO_DISPARITY, -1, (0, 0))
 print  Q
 np.savetxt('Q_mat.txt',Q)

and the error I get is :

Traceback (most recent call last): File "depth_estimation.py", line 82, in <module> cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F = cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, (320,240)) ValueError: too many values to unpack

I am giving an array of objectpoints each of which in turn is an array of points.

Any help in this issue will be appreciated. Thanks a lot.