Forums - Assertion failed @fcvFilterThresholdu8: src && dst && (signed)threshold >= 0

1 post / 0 new
Assertion failed @fcvFilterThresholdu8: src && dst && (signed)threshold >= 0
Jose Pina
Join Date: 15 Oct 14
Posts: 3
Posted: Sun, 2014-10-19 10:40

I am reading a RGB565 Image from Java and passing  as a bytearray to JNI function. then converting to FastCV Img using this function

but when I apply the threshold I get 

Assertion failed @fcvFilterThresholdu8: src && dst && (signed)threshold >= 0

Quote:

void convertToFastCV(JNIEnv *env,jbyteArray source, uint8_t *destination,jint width, jint height){
 
LOGD("Convert to FastCV Obj");
jbyte* jimgData = NULL;
jboolean isCopy = 0;
 
LOGD("Reading");
//RGB 565 Input Image
jimgData = env->GetByteArrayElements(source, &isCopy);
destination  = (uint8_t*)jimgData;
 
// Buffer to place image data if camera callback data is not aligned
uint8_t*  alignedImgBuf;
 
LOGD("Checking aligned");
// Check if camera image data is not aligned.
if( (int)jimgData & 0xF )
{
 
// Allocate buffer for aligned data if necessary.
if(alignedImgBuf == NULL )
{
alignedImgBuf = (uint8_t*)fcvMemAlloc( width*height*3/2, 16 );
}
 
LOGD("Aligning");
memcpy( alignedImgBuf, jimgData, width*height*3/2 );
destination = alignedImgBuf;
 
}
LOGD("Done");
 
 
}
 
 
JNIEXPORT jlong JNICALL Java_premi_anprarm_Test_findplate(JNIEnv *env, jobject obj,jbyteArray source,jbyteArray dest,jint width,jint height) {
 
 
LOGD("Java_premi_anprarm_Test_findplate");
long start_time = currentTimeInMilliseconds();
 
uint8_t* imageData;
convertToFastCV(env,source,imageData,width,height);
 
LOGD("Create processed buffer");
 
//Allocate Processed image
int frameSize = width*height*3/2;
uint8_t *thresholdImg = (uint8_t *)fcvMemAlloc(frameSize, 16);
 
if( thresholdImg == NULL )
{
LOGD("Allocate filteredImgBuf failed");
return 0;
}
else
{
memset(thresholdImg, 128, frameSize);
}
 
LOGD("Apply Threshold");
 
//Apply Threshold
fcvFilterThresholdu8( (uint8_t*)imageData, width, height, thresholdImg, 128 );
 
LOGD("Setting ByteArray Result");
 
env->SetByteArrayRegion(dest,0,width*height*3/2,(jbyte*)thresholdImg);
 
LOGD("Done");
 
long end_time = currentTimeInMilliseconds();
long time = end_time - start_time ;
return (jlong)time;
 

}

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.