Ask Your Question

angel.spatial's profile - activity

2020-05-17 02:10:05 -0500 received badge  Notable Question (source)
2019-10-09 00:42:30 -0500 received badge  Notable Question (source)
2018-11-18 09:32:25 -0500 received badge  Popular Question (source)
2018-07-16 10:48:08 -0500 received badge  Popular Question (source)
2014-11-16 13:18:49 -0500 received badge  Good Question (source)
2014-06-27 12:14:37 -0500 asked a question improfile (matlab) equivalent in OpenCV Python

What I'm trying to do is generate two lines on a binary image (one vertical, one horizontal). Then return all of the row/column values along with pixel values underneath that line and place them into a list. In matlab you could do this similarly by running improfile() on a binary image where you set the binary image to have "10/255" pixel values by im2bw(image,10/255).

Is this even possible?

2014-06-21 14:25:05 -0500 asked a question Python: Running estimateRigidTransform in opencv/python; 8uC1 or 8uC3 error

I currently have two matching point sets built into a numpy array of float32:

points1 = 
[[  346.70220947  9076.38476562]
 [  922.99554443  9096.4921875 ]
 [  776.96466064  9108.79101562]
 [  449.0173645   9080.61816406]
 [ 2843.19433594  1226.93212891]
 [  779.95275879  9094.76855469]
 [  451.46853638  9092.5078125 ]
 [ 3981.4621582   1237.50964355]
 [  132.38700867  9086.7890625 ]
 [  819.10943604  8286.74023438]
 [ 1963.64025879  1220.06921387]
 [ 1253.79321289  9095.75292969]]

points2 = 
[[ 55110.36328125   9405.07519531]
 [ 55686.71875      9423.63574219]
 [ 55540.8515625    9435.80078125]
 [ 55212.58203125   9408.00585938]
 [ 57598.76171875   1551.92956543]
 [ 55543.78125      9421.88769531]
 [ 55214.40625      9420.46972656]
 [ 58737.41796875   1561.14831543]
 [ 54895.9296875    9414.58203125]
 [ 55581.87109375   8613.87011719]
 [ 56718.76953125   1546.02197266]
 [ 56017.8125       9422.52050781]]

and I'm trying to run:

affine = cv2.estimateRigidTransform(points2,points1,True)
print affine

so that I can generate an affine matrix that can then be translated into a world file (.tfw). The world file is for GIS software that will project these on-the-fly.

At the moment I am getting an error:

Both input images must have either 8uC1 or 8uC3 type in function cvEstimateRigidTransform

I'm not really sure what's going on here. I thought I could use two points sets as parameters as long as I have 6 or more pairs.

Any thoughts or recommendations would be much appreciated!

2014-06-20 09:02:24 -0500 received badge  Supporter (source)
2014-06-19 14:47:11 -0500 received badge  Nice Question (source)
2014-06-19 09:48:18 -0500 received badge  Student (source)
2014-06-19 07:59:24 -0500 asked a question OpenCV and Python: Problems with knnMatch arguments

I am trying to follow the opencv tutorial here. Unfortunately, it fails at flann.knnMatch(des1,des2,k=2). Here is my code:

import cv2
import time
import numpy as np

im1 = cv2.imread('61_a.tif')
im2 = cv2.imread('61_b.tif')

surf = cv2.SURF(500,3,4,1,0) 
print "Detect and Compute"
kp1 = surf.detect(im1,None)
kp2 = surf.detect(im2,None)

des1 = surf.compute(im1,kp1)
des2 = surf.compute(im2,kp2)

MIN_MATCH_COUNT = 5
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks = 50)

flann = cv2.FlannBasedMatcher(index_params,search_params)
matches = flann.knnMatch(des1,des2,k=2)

I get the error:

matches = matcher.knnMatch(des1,des2,k=2)
TypeError: Argument given by name ('k') and position (2)

I have tried to change the matching to mirror the fix in this question like so:

flann = cv2.flann_Index(des2, index_params)
matches = flann.knnMatch(des1,2,params={})

BUT then I get this error:

flann = cv2.flann_Index(des2, index_params)
TypeError: features is not a numerical tuple

I'm really not sure what I'm doing wrong. Can someone point me in the right direction?

If you happen to know of a working PYTHON example of SURF or ORB for panorama/stitching that's fairly straightforward, I would appreciate that too. I have googled around quite a bit and have only found pieces of operations about how it might be accomplished (or it's written in C) or have only found unfinished/broken examples.

Thanks!