ios - OpenCV : thresold value has no effect while converting image to black and white? -
ios - OpenCV : thresold value has no effect while converting image to black and white? -
i'm trying convert image black , white, not absolutely black white, , utilize mask.
+ (uiimage *) getblackandwhiteimage:(uiimage *)image; { iplimage* im_rgb = [self createiplimagefromuiimage:image]; iplimage *im_gray = cvcreateimage(cvgetsize(im_rgb),ipl_depth_8u,1); cvcvtcolor(im_rgb,im_gray,cv_rgb2gray); iplimage* im_bw = cvcreateimage(cvgetsize(im_gray),ipl_depth_8u,1); cvthreshold(im_gray, im_bw, 127, 255, cv_thresh_binary | cv_thresh_otsu); // have alter 127 10 :255 has no effect homecoming [self uiimagefromiplimage:im_bw]; }
how can proper black , whilte image ?
don't pass cv_thresh_otsu
cvthreshold()
. if pass flag, provided threshold ignored , otsu's method used instead, automatically selects threshold.
your invocation should this:
cvthreshold(im_gray, im_bw, 127, 255, cv_thresh_binary);
ios objective-c opencv
Comments
Post a Comment