Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Load a csv containing string

I have a csv file that contains file paths.

eg:

col1  |         col2
 1    | 173/d234c34a87ffb7.jpg
 1    | 173/de9f04d2497222.jpg

I want to read this file and store it in opencv. How can i do it? I have tried the code below but it only reads col1 correct.

CvMLData cvml;
    cvml.read_csv("/home/damiya/test/compcars/sv_data/CSV/asd.csv");
    cvml.set_response_idx(0);
    const CvMat* vs = cvml.get_values();
    cout << "Rows: " << vs->rows << " Cols: " << vs->cols << endl;
    for(int i = 0; i < vs->rows; i++ )
    {
        cout << vs->data.fl[i*vs->cols] << "\n";

    }