bertsir/IDCardRecognition

请问图片截取如何调试的

NewBrandSTONE opened this issue · 2 comments

大佬您好,在看了您的本地识别源码,我有一些疑问

CameraActivity

final Bitmap bitmap1 = Bitmap.createBitmap(bitmap, width / 2 - dip2px(150), height / 2 - dip2px(92), dip2px(300), dip2px(185));
            int x, y, w, h;
            x = (int) (bitmap1.getWidth() * 0.340);
            y = (int) (bitmap1.getHeight() * 0.800);
            w = (int) (bitmap1.getWidth() * 0.6 + 0.5f);
            h = (int) (bitmap1.getHeight() * 0.12 + 0.5f);
            Bitmap bit_hm = Bitmap.createBitmap(bitmap1, x, y, w, h);

这里应该是将整个SurfaceView进行了身份证区域裁剪,然后又再身份证照片上进行了裁剪生成了bit_hm,我猜想这个bit_hm应该是身份证号的图片,我就想问一下这些bitmap1.getHeight() * 0.12 + 0.5f这些是如何调试出来的,

谢谢!

这里也是引用的别人的参数,其实就是号码区域相对于整个身份证的位置以及相对于整个身份证大小的宽高

哈哈哈,简书上看到你的回复了,谢谢