Je suis reposter cette question parce que je ne suis pas sûr si je l'ai demandé correctement avant. :) Je travaille sur une application qui comprend la détection de visage . la caméra démarre bien. dans le rappel de la frame d'aperçu, j'instancie un objet faceview (cette classe gère la détection). cette classe ne peut détecter les faces que dans un bitmap, mais l'image du callback est un YuvImage. J'ai compressé l'image en jpeg puis appelé une méthode pour convertir ce jpeg en bitmap, de sorte que la détection fonctionne. Le problème que j'ai est que eclipse dit qu'il y a une exception classnotfound concernant le YuvImage que j'utilise. J'ai téléchargé l'api8 dont yuvimage fait partie. il n'y a pas d'erreurs dans le code source et il compile ok. Y at-il une raison pour laquelle ecilipse ne peut pas charger la classe yuvimage? voici un extrait, merci.NoClassDefFoundError: android.graphics.YuvImage (compile mais ne fonctionne pas)
'code'
BitmapFactory.Options bfo = new BitmapFactory.Options();
bfo.inPreferredConfig = Bitmap.Config.RGB_565;
Rect rectangle = new Rect(0, 0, width, height);
ByteArrayOutputStream bos = new ByteArrayOutputStream(imageData.length);
try{
img = new YuvImage(imageData,ImageFormat.NV21,width,height,null);
}catch(Exception e){
e.printStackTrace();
}
img.compressToJpeg(rectangle, 100, bos);
byte[] array = bos.toByteArray();
sourceImage = BitmapFactory.decodeByteArray(array, 0, array.length);
de trace d'exception:
02-10 11:53:07.298: ERROR/dalvikvm(2364): Could not find class 'android.graphics.YuvImage', referenced from method com.tecmark.FaceView.<init>
02-10 11:53:07.468: ERROR/AndroidRuntime(2364): Uncaught handler: thread main exiting due to uncaught exception
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): java.lang.NoClassDefFoundError: android.graphics.YuvImage
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at com.tecmark.FaceView.<init>(FaceView.java:60)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at com.tecmark.cameraView$1.onPreviewFrame(cameraView.java:111)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:395)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at android.os.Handler.dispatchMessage(Handler.java:99)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at android.os.Looper.loop(Looper.java:123)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at android.app.ActivityThread.main(ActivityThread.java:4363)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at java.lang.reflect.Method.invokeNative(Native Method)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at java.lang.reflect.Method.invoke(Method.java:521)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-10 11:53:07.473: ERROR/AndroidRuntime(2364): at dalvik.system.NativeStart.main(Native Method)
@kgiannakakis merci, je suis nouveau sur le forum et ne savez pas comment les choses encore :) formater – turtleboy
J'ai fixé les informations après. Il s'agit d'une erreur d'exécution NoClassDefFoundError * * et non d'une exception ClassNotFoundException * *. –