
#include <bits/stdc++.h>
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/video.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/ml.hpp"
#define inf 2333333333333333
#define N 100010
#define p(a) putchar(a)
#define For(i,a,b) for(int i=a;i<=b;++i)
//by war
//2020.10.27
using namespace std;
using namespace cv;
int n;
double k,t;
Mat image,dist,img0,out,labels,stats,centroids;
void in(int &x){
int y=1;char c=getchar();x=0;
while(c<'0'||c>'9'){if(c=='-')y=-1;c=getchar();}
while(c<='9'&&c>='0'){ x=(x<<1)+(x<<3)+c-'0';c=getchar();}
x*=y;
}
void o(int x){
if(x<0){p('-');x=-x;}
if(x>9)o(x/10);
p(x%10+'0');
}
signed main(){
img0 = imread("/Users/war/Downloads/2.png",0);
threshold(img0, image, 128, 255, THRESH_BINARY);
imshow("oooo", image);
distanceTransform(image,dist,labels,DIST_L2,DIST_MASK_3,DIST_LABEL_CCOMP);
normalize(dist,dist,0.0,255.0,NORM_MINMAX);
dist.convertTo(out, CV_8U);
imshow("out",out);
waitKey();
return 0;
}