JNIEXPORT jboolean JNICALL Java_com_stead_alistair_soundcoder_OpenCV_setSourceImage(JNIEnv* env, jobject thiz, jintArray photo_data, jint width,jint height) { if (pImage != NULL) { cvReleaseImage(&pImage); pImage = NULL; } pImage = getIplImageFromIntArray(env, photo_data, width, height); if (pImage == NULL) { return 0; } LOGI("Load Image Done."); return 1; }
/** * setSourceImage * 画像のセット * JNIEnv * : すべての JNI 関数のポインタを格納する構造体を指すポインタ * jintArray photo_data : ピクセルデータ * jint width : 幅 * jint height : 高さ */ JNIEXPORT void JNICALL Java_com_vsn_edit_cv_ImageResize_setSourceImage( JNIEnv* env, jobject thiz, jintArray photo_data, jint width, jint height) { // すでに画像がセットされていたら開放する if (pImage != NULL) { cvReleaseImage(&pImage); // 画像とメモリ領域の開放 pImage = NULL; } pImage = getIplImageFromIntArray(env, photo_data, width, height); // Java側にある本体のピクセルデータを取得し、IPL画像を作成する if (pImage == NULL) { return; } LOGI("Load Image Done."); }
JNIEXPORT jboolean JNICALL Java_com_eyantra_android_tennisball_OpenCV_setSourceImage( JNIEnv* env, jobject thiz, jintArray photo_data, jint width, jint height) { if (pImage != NULL) { cvReleaseImage(&pImage); pImage = NULL; } pImage = getIplImageFromIntArray(env, photo_data, width, height); if (pImage == NULL) { return 0; } LOGI("Load Image Done."); return 1; }
// Set the source image and return true if successful or false otherwise. JNIEXPORT jboolean JNICALL Java_org_siprop_opencv_OpenCV_setSourceImage(JNIEnv* env, jobject thiz, jintArray photo_data, jint width, jint height) { // Release the image if it hasn't already been released. if (m_sourceImage) { cvReleaseImage(&m_sourceImage); m_sourceImage = 0; } m_facesFound = 0; m_sourceImage = getIplImageFromIntArray(env, photo_data, width, height); if (m_sourceImage == 0) { LOGE("Error source image could not be created."); return false; } return true; }