read .txt file and convert in to MAT

asked 2019-01-31 02:50:16 -0600

I am a beginner to openCV and I have a .txt file which contains the map data of x and y in the format of [x:y] = [1:3, 3:5, 5:7, 8:9, 10:5, 7:3, ...... ] where the data before : is x and after : is y and how do I convert the data of x as row and y as column and write the above values in to the mat using OPENCV. any help would be appreciated.

edit retag flag offensive close merge delete

Comments

it's unclear, what you try to do with it. what is this for ?

are there really only coordinates in your txt file ?

berak gravatar imageberak ( 2019-01-31 02:57:33 -0600 )edit
1

Yes the coordinates are stored in the above format I have to places this coordinates in the mat format and check for the values of x and y is in the path of travel for the path planning algorithm.

rathish gravatar imagerathish ( 2019-01-31 03:06:38 -0600 )edit

maybe you could highlight, how your Mat should look like ? (why a cv::Mat, even ?)

berak gravatar imageberak ( 2019-01-31 03:09:07 -0600 )edit

how do I convert the data of x as row and y as column

this unfortunately does not make any sense to me. you have a series of points there, not a 2d distribution of "values" (there are no values)

again, what is it for , why do you need a cv::Mat for it ?

berak gravatar imageberak ( 2019-02-02 04:46:58 -0600 )edit