webjb / myrobot Goto Github PK
View Code? Open in Web Editor NEWfor ball detection
for ball detection
onResume is called twice which stops the camera preview. I removed the code from there and added the onResume code to onStart and onPause code to onStop. This solved the problem of this being called twice and stopping the camera feed.
But due to some reason, after a while, the number of frames drops significantly. It process at ~30-40 frames in the beginning and after a while, all of a sudden, decreases the fps to 1.
CPU usage is at 1% and there is no apparent memory leak either.
Import the project using Android Studio 2.2.2. When building, there is an error:
Error:A problem occurred configuring project ':app'.
Exception thrown while executing model rule: BaseComponentModelPlugin.Rules#createVariantData > afterEach()
Cannot evaluate module openCVLibrary310 : Configuration with name 'default' not found.
Please help fix it. Thanks.
BTW, could you help solve the related problem in stackoverflow. Thanks.
I see above error when I use the similar implementation in my application.
One more question, I see NativeWindow have formats supported as
{ WINDOW_FORMAT_RGBA_8888 = 1, WINDOW_FORMAT_RGBX_8888 = 2, WINDOW_FORMAT_RGB_565 = 4 } .
Do you see if YUV_420_888 format is supported ?
What I am trying to do here is for POC , I take shared buffer from JNI and then do following
//
/ Render Image Function Call for first surface
/*/
JNIEXPORT jint JNICALL
Java_com_siriuscam_Utility_JNIManager_renderImage1(JNIEnv * env, jobject jb,jobject surface,
jobject yBuffer, jobject uBuffer, jobject vBuffer, jint yBufSize, jint uBufSize, jint vBufSize)
{
LOGI("renderImage1() call");
//ANativeWindow *window = NULL;
jbyte jYBuffer = (jbyte)env->GetDirectBufferAddress(yBuffer);
unsigned char *srcLumaPtr = reinterpret_cast<unsigned char *>(env->GetDirectBufferAddress(yBuffer));
unsigned char *srcChromaUPtr = reinterpret_cast<unsigned char *>(env->GetDirectBufferAddress(uBuffer));
unsigned char *srcChromaVPtr = reinterpret_cast<unsigned char *>(env->GetDirectBufferAddress(vBuffer));
jbyte *jUBuffer = (jbyte*)env->GetDirectBufferAddress(uBuffer);
jbyte *jVBuffer = (jbyte*)env->GetDirectBufferAddress(vBuffer);
LOGI("Received image buffer");
//LOGI("Window1 size : %d x %d", mWidth1, mHeight1);
ANativeWindow *window = ANativeWindow_fromSurface(env, surface);
LOGI("ANativeWindow_fromSurface() done");
ANativeWindow_acquire(window);
//if(!isInit1){
//ANativeWindow_setBuffersGeometry(window1, mPreviewWidth, mPreviewHeight,WINDOW_FORMAT_RGBA_8888);
ANativeWindow_setBuffersGeometry(window, mPreviewWidth, mPreviewHeight,0);
LOGI("ANativeWindow_setBuffersGeometry() done");
isInit1 = 1;
//}
int lockResult = -1;
LOGI("ANativeWindow_lock");
lockResult = ANativeWindow_lock(window, &buffer1, NULL);
LOGI("buffer1.format 0x%x \n",buffer1.format);
LOGI("buffer1.stride %d \n",buffer1.stride);
LOGI("window format 0x%x \n",ANativeWindow_getFormat(window));
if (lockResult >= 0) {
LOGI("Writing data buffer1 on native window1");
// color conversion from YUV420 to RGBA.
ColorConversion_YUV420P_RGBA( (unsigned char*)srcLumaPtr, (unsigned char*)srcChromaUPtr, (unsigned char*)srcChromaVPtr, mPreviewWidth ,mPreviewHeight,(unsigned int*)OutputData_RGBA_1);
// copy data into window buffer
unsigned char *sbuf = &OutputData_RGBA_1[0];
unsigned char *dbuf = (unsigned char *)buffer1.bits;
for(int i=0;i< 720 ;i++) {
dbuf = dbuf + (i * buffer1.stride * 4);
LOGI("i %d \n",i);
memcpy(dbuf, OutputData_RGBA_1, 1280 * 4);
sbuf += 1280 * 4;
}
LOGI("ANativeWindow_unlockAndPost");
ANativeWindow_unlockAndPost(window);
} else {
LOGE("ANativeWindow_lock failed error %d", lockResult);
}
LOGI("Releasing window1");
ANativeWindow_release(window);
return 0;
}
請問我在Android Studio 2.1.2 import source code 出現
Error: Configuration with name 'default' not found.
可能是缺少什麼設定?
Keeps returning values and onViewCreated is called constantly.
I removed the orientation sensor and the extra code and managed to run the whole thing but onResume is called twice which stops the camera feed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.