Transferred from: Http://blog.csdn.net/zfdxx369/article/details/9091953?utm_source=tuicool
This article is Zhang's classic image refinement paper, the effect is very good, the use of parallel computing, the speed is very fast;
Below is the "smart vision" on the csdn of this paper program of a transformation, pro-Test available!
Since OPENCV does not have its own image thinning function, the basic on-line is based on the 1.0 interface, so hands-on into the 2.0 Mat type interface, easy to use. In the refinement method, when the classical Zhang parallel fast thinning algorithm, the contour movement after refinement and the original image is relatively good.
depth_8u binary Image Refinement classic Zhang parallel fast thinning algorithm void thin (const mat &SRC, Mat &dst, const int iterations) {const int HEI Ght =src.rows-1; const int width =src.cols-1; Copy an array to another array if (src.data! = dst.data) {src.copyto (DST); } int n = 0,i = 0,j = 0; Mat tmpimg; Uchar *pu, *pc, *PD; BOOL isfinished =false; for (n=0; n<iterations; n++) {dst.copyto (tmpimg); Isfinished =false; One-time pre-column scan starts//scanning process starts for (I=1; iAn example of OPENCV image refinement