Mat src,dst;
namedWindow("SRC");
namedWindow("DST");
src = imread("t1.jpg");
if (src.empty())
{
cout<<"read data error!"<<endl;
return -1;
}
imshow("SRC",src);
split(src,spl);//split
createTrackbar("thresh","DST",&threshold_value,255,on_Threshold);
on_Threshold(0,0);//CALLBACK
this is callback function
threshold(spl[0],dst,threshold_value,max_thresh,THRESH_BINARY_INV);
imshow("DST",dst);
bk = imread("Daydream.jpg");
if (bk.empty())
{
cout<<"read data error!"<<endl;
return ;
}
src.copyTo(bk,dst);//
imshow("dst2",bk);