OpenCV - yszheda/wiki GitHub Wiki
cv::Mat mask = M == 0;
M.setTo(0.5, mask);
- Convert Mat to Array/Vector in OpenCV
- Convert Mat to vector and Vector to mat in opencv
- Converting a row of cv::Mat to std::vector
// Pointer to the i-th row
const double* p = mat.ptr<double>(i);
// Copy data to a vector. Note that (p + mat.cols) points to the
// end of the row.
std::vector<double> vec(p, p + mat.cols);
Mat_<double> M(20,20);
for(int i = 0; i < M.rows; i++)
for(int j = 0; j < M.cols; j++)
M(i,j) = 1./(i+j+1);
Mat E, V;
eigen(M,E,V);
cout << E.at<double>(0,0)/E.at<double>(M.rows-1,0);
e1 = cv2.getTickCount()
# your code execution
e2 = cv2.getTickCount()
time = (e2 - e1)/ cv2.getTickFrequency()
struct CVTimer {
double pcFrequency;
double start;
double end;
CVTimer()
{
pcFrequency = static_cast<double>(cvGetTickFrequency() * 1000);
restart();
}
~CVTimer()
{
}
void restart()
{
start = static_cast<double>(cvGetTickCount());
}
double elapsedTime()
{
end = static_cast<double>(cvGetTickCount());
return (end - start) / pcFrequency;
}
}; /* ---------- end of struct OpenCVTimer ---------- */
typedef struct CVTimer CVTimer;
- OpenCV: Performance Measurement and Improvement Techniques
- Opencv计算算法运行时间
- OpenCV深入学习(3)--opencv中测量运行时间的函数
- opencv测量程序运行时间
- Image Pyramids
- How can I resize an image with OpenCV ?
- https://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html
- OpenCV - Gaussian Blur
- http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.html
- filter2D demo
- https://stackoverflow.com/questions/13981699/opencv-how-does-the-filter2d-method-actually-work
- http://docs.opencv.org/2.4/modules/imgproc/doc/miscellaneous_transformations.html?#threshold
- OpenCV二值化cvThreshold和自适应二值化cvAdaptiveThreshold及Otsu
- cv::getOptimalDFTSize --- OpenCV代码阅读
- https://github.com/opencv/opencv/blob/f1c8094f5fef19f3d381e86eb9578c5bd9981d94/modules/core/src/dxt.cpp
- File Input and Output using XML and YAML files
- https://github.com/opencv/opencv/blob/master/samples/cpp/filestorage.cpp
- File Input and Output using XML and YAML files
- OpenCV parallel_for not using multiple processors
- How to use the OpenCV parallel_for_ to parallelize your code
- How to use lambda as a parameter to parallel_for_
- core: add an ability to use c++ 11 lambda expression as a parallel_for_ body #9017
class LambdaParallLoopBody : public cv::ParallelLoopBody {
private:
std::function<void(const cv::Range&)> functor_;
public:
LambdaParallLoopBody(std::function<void(const cv::Range&)> functor):
functor_(functor) {}
virtual void operator() (const cv::Range& range) const {
functor_(range);
}
};
inline void parallel_for(const cv::Range& range, std::function<void(const cv::Range&)> functor, double nstripes = -1.) {
cv::parallel_for_(range, LambdaParallLoopBody(functor), nstripes);
}