CameraManager.java에 보면 getFramingRectInPreview()와 getFramingRect()라는 함수가 있습니다
이 두함수는 각각
getFramingRect()
-액티비티화면안에 QR을 인식할 사각영역을 설정
getFramingRectInPreview()
-카메라 프리뷰에서 인식할 사각영역을 설정
그렇기 때문에 getFramingRect()에서 화면에 인식할 영역범위를 지정한 후
getFramingRectInPreview()에서 영역범위와의 사이즈를 맞춰주는것이다.
Zxing은 가로전용모드로 설계가 되어있었기 때문에 세로모드로 하면 인식률이 엄청나게 떨어지는 것을 볼 수 있다.
이는 실제로 화면은 세로 영역인데 , 카메라 프리뷰는 가로 영역을 나타내고있어서 생기는 현상이다
그래서 수동적으로 카메라 프리뷰의 가로 영역을 스와핑해주어야한다.
그러기 위해서,
public Rect getFramingRectInPreview() {
if (framingRectInPreview == null) {
Rect rect = new Rect(getFramingRect());
Point cameraResolution = configManager.getCameraResolution();
Point screenResolution = configManager.getScreenResolution();
rect.left = rect.left * cameraResolution.y / screenResolution.x;
rect.right = rect.right * cameraResolution.y / screenResolution.x;
rect.top = rect.top * cameraResolution.x / screenResolution.y;
rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y;
framingRectInPreview = rect;
}
return framingRectInPreview;
}
cameraResolution 부분의 x축과 y축을 변경해주면 된다.
'Mobile_Programing > Android' 카테고리의 다른 글
Unsigned Byte 사용법 (2) | 2011.04.01 |
---|---|
안드로이드에서 VideoView를 사용해보자 (0) | 2011.03.29 |
안드로이드에서 3G를 사용할때 Ip주소를 확인하자 (0) | 2011.03.26 |
안드로이드에서 TTS 서비스를 해보자 (1) | 2011.03.20 |
JDK 설정 (0) | 2011.02.12 |