Guest User

Untitled

a guest
Nov 23rd, 2012
381
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Java part
  2. ByteArrayOutputStream src_stream = new ByteArrayOutputStream();
  3. mBitmap.compress(Bitmap.CompressFormat.PNG, 100, src_stream);
  4. byte[] src_array = src_stream.toByteArray();
  5. int[] src_mRGBA=new int[240*320];
  6. WatershedSegmentation(240,320,src_array,,src_mRGBA); // JNI call
  7.  
  8.  
  9. //JNI part
  10. JNIEXPORT jintArray JNICALL Java_com_measure_sizemesurment2_MyView_WatershedSegmentation(
  11. JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray s_yuv,jintArray s_bgra) {
  12.  
  13. jbyte* _s_yuv = env->GetByteArrayElements(s_yuv, 0);
  14. jint* _s_bgra = env->GetIntArrayElements(s_bgra, 0);
  15.  
  16. Mat sorcemyuv(height + height / 2, width, CV_8UC1, (unsigned char *) _s_yuv);
  17. Mat source(height, width, CV_8UC4, (unsigned char *) _s_bgra);
  18.  
  19. cvtColor(sorcemyuv, source, CV_YUV420sp2BGR, 4);
  20. imwrite( "/sdcard/sorce.jpg", source );
  21. }
RAW Paste Data