Corrupt when using Google Play Services Face Detection in Picasso Transformation. (Fatal Signal) -
i'm writing face crop transformation of picasso.
make face in image shown when picasso cropping image.
implement picasso transformation , using face detection in function public bitmap transform(bitmap source)
.
import com.squareup.picasso.transformation; .... public class facecrop implements transformation { ... @override public bitmap transform(bitmap source) { facedetector mfacedetector = new facedetector.builder(mcontext).settrackingenabled(false).build(); if (!mfacedetector.isoperational()) { return source; } frame frame = new frame.builder().setbitmap(source).build(); sparsearray<face> faces = mfacedetector.detect(frame); // crash here ... rectf rect = null; (int = 0; < faces.size(); i++) { face face = faces.valueat(i); float x = face.getposition().x; float y = face.getposition().y; rectf facerect = new rectf(x, y, x + face.getwidth(), y + face.getheight()); if (rect == null) { rect = facerect; continue; } rect.union(facerect); } mfacedetector.release(); ... bitmap bitmap = bitmap.createbitmap(mwidth, mheight, source.getconfig()); canvas canvas = new canvas(bitmap); canvas.drawbitmap(source, null, targetrect, null); source.recycle(); return bitmap; } }
for images, works perfectly. nothing wrong.
specific images, works fine, crashes @ sparsearray<face> faces = mfacedetector.detect(frame);
. (it's not crash 1 image.)
tried use try
, catch
block catch error, still crash anyway. can't skip it.
, error messages different every time, similar.
"fatal signal x (sigabrt)...".
here 4 examples :
1.
invalid address or address of corrupt block 0xba362ba0 passed dlfree
fatal signal 11 (sigsegv), code 1, fault addr 0xdeadbaad in tid 10651 (picasso-/extern)
2.
fatal signal 11 (sigsegv), code 2, fault addr 0x93948000 in tid 16443 (picasso-/extern)
3.
fatal signal 11 (sigsegv), code 1, fault addr 0x605f5e6a in tid 17951 (gcdaemon)
4.
heap corruption detected tmalloc_large
fatal signal 6 (sigsegv), code -6 in tid 19020 (picasso-/extern)
sure parameter frame
of function detect
not null.
checked images cause crash, can't see wrong them.
looks normal, , not large files (smaller 1m).
faces, not.
, can decoded picasso picasso's center crop.
can give me suggestion?
thank much!!
there known issue small images, , fixed in future release. fortunately, there patch available on github now:
https://github.com/googlesamples/android-vision/issues/26
if still getting issue patch, please print out of image sizes , post here debug.
Comments
Post a Comment