提交 33d23ef2 编写于 作者: V Vadim Pisarevsky

fixed several typos in docs; make MLData capable of reading csv files with...

fixed several typos in docs; make MLData capable of reading csv files with much more columns than before
上级 3e7fbd21
......@@ -1725,7 +1725,7 @@ Mat\& Mat::setTo(const Scalar\& s, const Mat\& mask=Mat());
This is the advanced variant of \texttt{Mat::operator=(const Scalar\& s)} operator.
\cvCppFunc{reshape}
\cvCppFunc{Mat::reshape}
Changes the 2D matrix's shape and/or the number of channels without copying the data.
\cvdefCpp{
......@@ -1758,7 +1758,7 @@ Mat pointMat = Mat(vec). // convert vector to Mat, O(1) operation
\end{lstlisting}
\cvCppFunc{Mat::t()}
\cvCppFunc{Mat::t}
Transposes the matrix
\cvdefCpp{
......
......@@ -725,18 +725,18 @@ public:
// from the left-most point to the right most,
// not to depend on the ordering of pt1 and pt2 parameters
LineIterator(const Mat& img, Point pt1, Point pt2,
int connectivity=8, bool leftToRight=false);newline
int connectivity=8, bool leftToRight=false);
// returns pointer to the current line pixel
uchar* operator *();newline
uchar* operator *();
// move the iterator to the next pixel
LineIterator& operator ++();newline
LineIterator operator ++(int);newline
LineIterator& operator ++();
LineIterator operator ++(int);
// internal state of the iterator
uchar* ptr;newline
int err, count;newline
int minusDelta, plusDelta;newline
int minusStep, plusStep;newline
uchar* ptr;
int err, count;
int minusDelta, plusDelta;
int minusStep, plusStep;
};
\end{lstlisting}
......
......@@ -183,7 +183,7 @@ void drawCircle(Mat &image, int R, Point center)
}
\end{lstlisting}
\section{Namespace \texttt{cv} and Function Naming}
\section{Namespace cv and Function Naming}
All the newly introduced classes and functions are placed into \texttt{cv} namespace. Therefore, to access this functionality from your code, use \texttt{cv::} specifier or \texttt{"using namespace cv;"} directive:
\begin{lstlisting}
......
......@@ -646,18 +646,18 @@ public:
// various constructors and the copy operation
Exception() { code = 0; line = 0; }
Exception(int _code, const string& _err,
const string& _func, const string& _file, int _line);newline
Exception(const Exception& exc);newline
Exception& operator = (const Exception& exc);newline
const string& _func, const string& _file, int _line);
Exception(const Exception& exc);
Exception& operator = (const Exception& exc);
// the error code
int code;newline
int code;
// the error text message
string err;newline
string err;
// function name where the error happened
string func;newline
string func;
// the source file name where the error happened
string file;newline
string file;
// the source file line where the error happened
int line;
};
......
......@@ -905,14 +905,14 @@ Kalman filter class
class KalmanFilter
{
public:
KalmanFilter();newline
KalmanFilter(int dynamParams, int measureParams, int controlParams=0);newline
void init(int dynamParams, int measureParams, int controlParams=0);newline
KalmanFilter();
KalmanFilter(int dynamParams, int measureParams, int controlParams=0);
void init(int dynamParams, int measureParams, int controlParams=0);
// predicts statePre from statePost
const Mat& predict(const Mat& control=Mat());newline
const Mat& predict(const Mat& control=Mat());
// corrects statePre based on the input measurement vector
// and stores the result to statePost.
const Mat& correct(const Mat& measurement);newline
const Mat& correct(const Mat& measurement);
Mat statePre; // predicted state (x'(k)):
// x(k)=A*x(k-1)+B*u(k)
......
......@@ -139,14 +139,13 @@ static char *fgets_chomp(char *str, int n, FILE *stream)
}
int CvMLData :: read_csv(const char* filename)
int CvMLData::read_csv(const char* filename)
{
const int M = 50000;
const int M = 1000000;
const char str_delimiter[3] = { ' ', delimiter, '\0' };
FILE* file = 0;
CvMemStorage* storage;
CvSeq* seq;
char *buf;
char *ptr;
float* el_ptr;
CvSeqReader reader;
......@@ -161,7 +160,8 @@ int CvMLData :: read_csv(const char* filename)
return -1;
// read the first line and determine the number of variables
buf = new char[M];
std::vector<char> _buf(M);
char* buf = &_buf[0];
if( !fgets_chomp( buf, M, file ))
{
fclose(file);
......@@ -242,7 +242,6 @@ int CvMLData :: read_csv(const char* filename)
cvReleaseMemStorage( &storage );
delete []el_ptr;
delete []buf;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册