Googleは、Googleが作成したバーコードAPIに基づいてアプリケーションを作成し、いくつか調整を加えようとしています。私は学生で、まだ学んでいるので、次に何をすべきかについての手がかりはありません。正しい方向に向けることができます。Google Barcode API、画像保存
は現在、私は
private boolean onTap(float rawX, float rawY) {
mCameraSource.takePicture(null,null);
// Find tap point in preview frame coordinates.
int[] location = new int[2];
mGraphicOverlay.getLocationOnScreen(location);
float x = (rawX - location[0])/mGraphicOverlay.getWidthScaleFactor();
float y = (rawY - location[1])/mGraphicOverlay.getHeightScaleFactor();
// Find the barcode whose center is closest to the tapped point.
Barcode best = null;
float bestDistance = Float.MAX_VALUE;
for (BarcodeGraphic graphic : mGraphicOverlay.getGraphics()) {
Barcode barcode = graphic.getBarcode();
if (barcode.getBoundingBox().contains((int) x, (int) y)) {
// Exact hit, no need to keep looking.
best = barcode;
break;
}
float dx = x - barcode.getBoundingBox().centerX();
float dy = y - barcode.getBoundingBox().centerY();
float distance = (dx * dx) + (dy * dy); // actually squared distance
if (distance < bestDistance) {
best = barcode;
bestDistance = distance;
}
}
を持っていますが、バーコードを取り出す以外に、私は実装することによってだけでなく、私が試した全体画像を保存したい:mCameraSource.takePicture(NULL、NULL);
私は何をしますか?
Takepicture方法:
public void takePicture(ShutterCallback shutter, PictureCallback jpeg) {
synchronized (mCameraLock) {
if (mCamera != null) {
PictureStartCallback startCallback = new PictureStartCallback();
startCallback.mDelegate = shutter;
PictureDoneCallback doneCallback = new PictureDoneCallback();
doneCallback.mDelegate = jpeg;
mCamera.takePicture(startCallback, null, null, doneCallback);
}
}
}
最初に:なぜ画像を保存しますか? 2番目: 'takePicture()'へのコールバックを提供してどこに保存するかを定義する必要があると思います。 – Eselfar
私は実際に画像を保存したくありませんが、テスト目的でした。私はBase64でエンコードされた画像を取るAPIを作った。だから私が実際にやりたいのは、Base64で画像をエンコードし、それを私のAPIに送ることです。私はアンドロイドの新人だから、コールバックを提供することが何を意味するのか正確には分からない。 –