Wednesday 15 June 2011

How to cropping circle image openvc android -



How to cropping circle image openvc android -

i want cropping circle shape in image. have input image grayness scale image. in image have circle shape. need it. how utilize open cv android ? can't it. help me please. sorry, can't tag image in post.

input image enter link description here

bitmap bmpproces = bitmapfactory.decodefile(path+inpuimage); mat imagemat = new mat ( bmpproces.getheight(), bmpproces.getwidth(), cvtype.cv_8u); bitmap mybitmap32 = bmpproces.copy(bitmap.config.argb_8888, true); utils.bitmaptomat(mybitmap32, imagemat);

you have create mask,fill circle in according coordinates of target , utilize copyto extract target circular area in mask.then can crop normal bounding rectangle of circle in mask mat.you can see sample code , more details here.there snippet code can convert java , utilize it:

// center , radius results of houghcircle // mask cv_8uc1 image 0 cv::mat mask = cv::mat::zeros( img.rows, img.cols, cv_8uc1 ); circle( mask, center, radius, scalar(255,255,255), -1, 8, 0 ); //-1 means filled img.copyto( dst, mask ); // re-create values of img dst if mask > 0.

android image opencv

No comments:

Post a Comment