Ask Your Question

Ruchir's profile - activity

2017-06-08 22:10:01 -0600 received badge  Necromancer (source)
2015-08-17 02:42:34 -0600 received badge  Editor (source)
2015-08-17 02:41:51 -0600 answered a question how to read matrix from text file to Mat in opencv

This works for me for reading .txt files. Please include the relevant header files.

//To read data from a text file. 
//filename is the name of the text file
//rows and cols show dimensions of the matrix written in the text file


using namespace std;
using namespace cv;

Mat ReadMatFromTxt(string filename, int rows,int cols)
    double m;
    Mat out = Mat::zeros(rows, cols, CV_64FC1);//Matrix to store values

    ifstream fileStream(filename);
    int cnt = 0;//index starts from 0
    while (fileStream >> m)
        int temprow = cnt / cols;
        int tempcol = cnt % cols;<double>(temprow, tempcol) = m;
    return out;

However, you must know the dimensions of the matrix beforehand. Any improvement is appreciated.

2015-06-29 05:41:45 -0600 received badge  Necromancer (source)
2015-06-23 03:53:11 -0600 answered a question Visual studio 2013 - msvcp110d.dll missing (Windows 8.1 x64)

I am new to openCV and had the same problem using openCV 2.4.10 with Visual Studio Express 2013 on a Windows 7, 32-bit platform. If I made a simple program without using OpenCV, the program ran but when I used OpenCV I got the missing DLL error. @kraster might have solved the issue but wanted to share this answer for others.

I tried a lot of options as suggested on related posts:

None of them worked for me. The following post made things clear:

I guess the problem I had was not with my Visual Studio but my OpenCV. The OpenCV was compiled on a version of visual studio which required MSVCP110.dll. I could have tried another version of OpenCV or compiled OpenCV again using VS2013 but I was short of time. Instead, I found the dll file elsewhere and placed it in my system32 folder. This fixed the problem. However I won't recommend downloading the dll from external website due to security issues.