Ask Your Question

tamina's profile - activity

2021-07-19 01:38:31 -0600 received badge  Famous Question (source)
2019-12-18 10:37:30 -0600 received badge  Notable Question (source)
2018-10-20 21:24:21 -0600 received badge  Popular Question (source)
2017-01-16 16:39:28 -0600 commented question How to convert Keypoints to an argument for findhomography()?

I somehow got this to run without errors now, I had used a separate function to get the keypoints and matches, by putting it all into 1 function the error was removed. (Maybe there was some data lost in the function call, or I had a typo somewhere)

2017-01-16 16:39:13 -0600 commented question How to convert Keypoints to an argument for findhomography()?

@berak Isn't the reshape essentially the same thing as converting it into Point2f form? This is what Keypoint_convert appears to do also.

2017-01-15 20:39:35 -0600 asked a question How to convert Keypoints to an argument for findhomography()?

I've seen some tutorials use this code to convert Keypoints (from a list of matches) to an argument for findHomography().

src_pts = np.float32([ kp1[m.queryIdx].pt for m in good ]).reshape(-1,1,2)
dst_pts = np.float32([ kp2[m.trainIdx].pt for m in good ]).reshape(-1,1,2)

I would prefer to use an existing function if it exists( ie. Keypoint_convert() ) for better readability. However when I try this:

  kp_template_match = [kp_template[m.queryIdx].pt for m in matches]
  kp_scene_match = [kp_scene[m.trainIdx].pt for m in matches]

  src_pts = cv2.KeyPoint_convert(kp_template_match)
  dst_pts = cv2.KeyPoint_convert(kp_scene_match)

  homography, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC)

, I get this error:

> TypeError: srcPoints is not a numpy array, neither a scalar

Can anyone explain why?

2016-12-15 22:32:37 -0600 received badge  Enthusiast
2016-12-13 18:17:53 -0600 commented question Detect sub-image(Irrespective of scale/angle) and crop that part from main image

I'm interested in this. Did you find a solution?

2016-12-11 18:27:19 -0600 received badge  Self-Learner (source)
2016-12-11 17:47:55 -0600 received badge  Editor (source)
2016-12-11 17:43:24 -0600 answered a question Using cv reduce in Python

I ended up updating my version of OpenCV to 3.1.0 because I heard there had been an update on the Python bindings to cv::reduce since 2.4.13.

I also changed the function call to include 'dtype=' which I think is needed for all the optional arguments

dst = cv2.reduce(img, 0, cv2.REDUCE_SUM, dtype=cv2.CV_32S)

I no longer get an error! :)

Notes

  • img = the edges of an image that I imported

  • dst did not need to be initialised

  • cv2.cv.CV_REDUCE_SUM changed to cv2.REDUCE_SUM somewhere between versions (I didn't see any documentation on this, I just got an error saying it was no longer there and I guessed the new name.

2016-12-11 17:06:05 -0600 commented question Using cv reduce in Python

@pi-null-mezon I haven't initialized it. In Python there is normally no need to initialize. Should I initialize?

2016-12-08 22:00:41 -0600 commented question Using cv reduce in Python

@pi-null-mezon I have tried these and keep getting the same error.

2016-12-07 19:49:53 -0600 commented question Using cv reduce in Python

img is actually the edges of my original picture

  img = cv2.imread('test.jpg', 0)
  img = cv2.medianBlur(img, 39)
  img = cv2.Canny(img, 30, 40)
2016-12-07 18:50:23 -0600 asked a question Using cv reduce in Python

I'm trying to use cv reduce to get the projection of an image onto the x and y axis.

I used:

x_sum = cv2.reduce(img, 0, cv2.cv.CV_REDUCE_SUM, cv2.CV_32S)

I get this error:

OpenCV Error: Unsupported format or combination of formats (Unsupported combination of input and output array formats) in reduce.

I can't find any more detailed documentation on how to use reduce in Python. Does anyone know where I've gone wrong?

Alternatively, is there another method I could use? calcHist() seems to only find the colour histogram of the image.