Ask Your Question
0

Difference between a list of points and list of pixels.

asked 2017-09-24 07:05:15 -0600

infoclogged gravatar image

updated 2017-09-24 07:07:36 -0600

I am trying to understand the prev_pts and next_pts in the LK algorithm. How can I visualise these list of points intuitively? My expectation was that they are integer values basically pixel locations on the image, a location where a prospective goodFeaturesToTrack was found. Also, this question is related directly to the goodFeaturesToTrack function, where the function returns a feature array in float. How can I actually visualise this intuitively?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-09-24 09:15:03 -0600

matman gravatar image

In general a list of pixels is a list with brightness values (grayvalues or in case of RGB 3 channels with brightness values, each for red, green and blue seperate), for example an image stored in a cv::Mat. This list is typically stored in an order that allows conclusions to a pixel's location.

A list of points doesn't allow direct inferences about a pixel value, but stores the location of a pixel to it's origin. If the points are stored as floats there exists a subpixel accuracy about it's location, for example by calculating the centroid of a local neighbourhood.

edit flag offensive delete link more

Comments

yes, the points are stored as floats and prev_pts and next_pts return float points. what is meant by subpixel accuracy about its location? my main goal was to draw a quiver from every prev_pts to the corresponding next_pts. But I dont know where the tip should start and end, because the locations cannot be floats.

infoclogged gravatar imageinfoclogged ( 2017-09-25 03:24:03 -0600 )edit

Yes it's about it's location. Here is a good explanation.

If you are using OpenGL for example you can render in subpixel resolution, see Wikipedia.

To draw the contour points using cv::drawContours you can convert it back to integer accuracy using Mat::convertTo. It also rounds values correct.

matman gravatar imagematman ( 2017-09-25 11:10:28 -0600 )edit

ah, i got it regarding the subpixel. Did not know that you can dig further into the resolution. can you please give an example in your answer with respect to drawing a countour from prev_pts to next_pts. Wouldnt drawLine will be simpler, because I just need a straight line with an arrow head?

infoclogged gravatar imageinfoclogged ( 2017-09-25 11:19:11 -0600 )edit

You can use cv::arrowedLine in OpenCV 3.3 (and 3.2?). Round your points to int and pass it to the function.

matman gravatar imagematman ( 2017-09-25 14:41:22 -0600 )edit

it seems, that the round off is not required as it is done automatically by the function.

infoclogged gravatar imageinfoclogged ( 2017-09-25 17:13:50 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-24 07:05:15 -0600

Seen: 411 times

Last updated: Sep 24 '17