Ex

cv::Mat img, dist_img;

//二値化
cv::threshold(img, img, 250, 255, cv::THRESH_BINARY);
//距離場計算
cv::distanceTransform(img, dist_img, CV_DIST_L2, 5);