function sourad = globalni2(obr_gr)


lvl = prah_kittler2(obr_gr);
obr_p = im2bw(obr_gr, lvl);
% 
% figure(1)
% imshow(obr_gr,[])
% 
% figure(2)
% imshow(obr_p,[])


obr_p = bwmorph(obr_p,'bridge',12);
obr_p = bwmorph(obr_p,'clean');
obr_p = bwmorph(obr_p,'dilate',3);
obr_p = bwmorph(obr_p,'thin',40);

obr_p = bwmorph(obr_p,'clean');



% figure(3)
% imshow(obr_p,[])

[sourad count] = krizeni3(obr_p);
% imwrite(obr_p, 'obr_thin.bmp')
