【发布时间】:2013-12-27 19:07:45
【问题描述】:
我正在开发一个应用程序来检测图像中的 blob 或对象。我想从主图像中提取 blob 图像,并在 blob 周围使用边界框。我怎样才能?或者我怎样才能得到斑点的宽度或高度。我的代码:
btn_process.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
FastBitmap fb, Greench, Redch;
imageView1.setImageURI(null);
imageView1.setImageURI(selectedImageUri);
Bitmap asli = ((BitmapDrawable) imageView1.getDrawable()).getBitmap();
fb=new FastBitmap(asli);
ExtractRGBChannel grayGreen=new ExtractRGBChannel(ExtractRGBChannel.Channel.G);
ExtractRGBChannel grayRed=new ExtractRGBChannel(ExtractRGBChannel.Channel.R);
Greench=grayGreen.Extract(fb);
Redch=grayRed.Extract(fb);
Subtract sub=new Subtract();
sub.setOverlayImage(Greench);
sub.applyInPlace(Redch);
OtsuThreshold otst=new OtsuThreshold();
otst.applyInPlace(Redch);
BlobDetection blobDetect=new BlobDetection();
ArrayList<Blob> blobs=blobDetect.ProcessImage(Redch);
ExtractBlob eBlobs = new ExtractBlob(blobs);
Redch = eBlobs.Extract(blobDetect.getIdBiggestBlob(), Redch);
// by this i am reach the biggest blob but with height and width of main image. but i need crop blob image in blob size.
imageView1.setImageURI(null);
imageView1.setImageBitmap(Redch.toBitmap());
}
});
【问题讨论】:
标签: android image-processing frameworks