ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.12k stars 439 forks source link

Can this read a CSV file that only has numbers, in one go? #39

Closed anshulvj closed 7 years ago

anshulvj commented 7 years ago

So I have a csv file which contains 480 rows of 640 comma-separated numbers (so 640 columns of 480 values each) - representing a 480x640 matrix that was stored in the csv file. Is it possible to read this file into a cv::Mat or a standard float[][] matrix in C++ in one go? i.e. instead of copying 640 columns and figuring out the mapping to a Mat, can this copy all this data into a matrix? I don't have any headers.

ben-strasser commented 7 years ago

You can use the LineReader to read a file line by line but you will have to split the line by hand.