Hi,I'm trying to use opencv with vuforia SDK.I have a native methode which play frame so i retreive the pixels of the image into a byte [] buffer and call a java methode to proceed the processing :
public void processCameraImage(byte[] buffer, int width, int height) {
System.out.println("setRGB565CameraImage....intent received...");
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
Mat inputFrame= new Mat();
inputFrame.put(0, 0, buffer);
if(inputFrame.channels()==1)
{ /* Grayscale */ Log.i("grayscale", "grayscale");
Imgproc.cvtColor(inputFrame, mGray, Imgproc.COLOR_GRAY2BGR565); // i have a problem here//
}
else if (inputFrame.channels()==4)
{ /* ARGB or RGBA image */ Log.i("ARGB or RGBA", "ARGB or RGBA"); }
else
{ /* RGB, BGR, HSV, or any other 3-channel representation */Log.i("RGB, BGR, HSV", "RGB, BGR, HSV"); }
//ect
}
i have this in logcat:
03-24 11:23:45.322: I/System.out(9915): setRGB565CameraImage....intent received...
03-24 11:23:45.362: D/dalvikvm(9915): GC_CONCURRENT freed <1K, 22% free 8108K/10311K, paused 1ms+3ms
03-24 11:23:45.372: I/grayscale(9915): grayscale
03-24 11:23:45.372: W/dalvikvm(9915): JNI WARNING: JNI method called with exception pending
03-24 11:23:45.372: W/dalvikvm(9915): in Lcom/qualcomm/ar/pl/CameraPreview;.newFrameAvailable: (IIII[B)V (CallIntMethodV)
03-24 11:23:45.372: W/dalvikvm(9915): Pending exception is:
03-24 11:23:45.372: I/dalvikvm(9915): java.lang.NullPointerException:
03-24 11:23:45.372: I/dalvikvm(9915): at org.opencv.imgproc.Imgproc.cvtColor(Imgproc.java:4354)
03-24 11:23:45.372: I/dalvikvm(9915): at com.qualcomm.QCARSamples.ImageTargets.ImageTargets.processCameraImage(ImageTargets.java:524)
03-24 11:23:45.372: I/dalvikvm(9915): at com.qualcomm.ar.pl.CameraPreview.newFrameAvailable(Native Method)
Please i need help as soon as possible i'm stucked h