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:

  1. http://i.imgur.com/fypbebb.jpg - input
  2. 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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -