drawContours from dataset [closed]

asked 2017-01-24 13:40:44 -0600

updated 2020-08-16 12:05:39 -0600

Hi,

I got a dataset (from excel csv file). I need to draw contours from this data set.

Basically, i can read the data file, and create an array of data either one or two dimensional array.

The confusing part is: input for drawContours is a list of MatOfPoint. MatOfPoint is in fact a list Point. Each point will require the x and y coordinate. However, in my data set, each point is a value. I don't know how to make it become a Point. Because we can convert from x and y coordinate to a value (length of the vector) but i can't convert from value to vector.

Could you help me out? this is done in java. assume my data

row1: |4, 5, 6, 7, 8, 8 |
row2: |5, 5, 0, 0, 0, 0|

....

thank you for your help,

Long

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-08-16 12:05:52.140826

Comments

As long as you do not have an x and y coordinate in your csv file, you will simply not get a contour, because as said, it is a collection/vector of Point elements, which have an x and y coordinate. I am still not grasping why you would want to push a single value into a point ...

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-25 03:47:53 -0600 )edit

maybe you can "zip" the x y values in excel already to a single line with alternating x,y values.

berak gravatar imageberak ( 2017-01-25 03:56:49 -0600 )edit