c++ - I need white color like transparent color -
i have problem. have program makes black color transparent.
src=imread("0.jpg", 1); cvtcolor(src,tmp,cv_bgr2gray); threshold(tmp,alpha,100,255,thresh_binary); mat rgb[3]; split(src,rgb); mat rgba[4]={rgb[0],rgb[1],rgb[2],alpha}; merge(rgba,4,dst); imwrite("1.png",dst); and input , output is:
- http://i.imgur.com/fypbebb.jpg - input
- transparent background white places - output
but don't want black color transparent, want white transparent. can not figure out. me please? thank you.
src=imread("0.jpg", 1); cvtcolor(src,tmp,cv_bgr2gray); threshold(tmp,alpha,100,255,thresh_binary_inv); mat rgb[3]; split(src,rgb); mat rgba[4]={rgb[0],rgb[1],rgb[2],alpha}; merge(rgba,4,dst); imwrite("1.png",dst); if choose thresh_binary_inv instead of thresh_binary. output is: black background transparent places. whole problem , solved.
Comments
Post a Comment