[C++] Fast texture sharing OpenGL ES <-> OpenCV

Mikelle02

Lurker
Member
Joined
Threads
1
Posts
5
So, I am working on an Android app. Basically, I have two textureId, one as input and one as output, with the width and the height. All I need to do is to is to access to the input GL texture with OpenCV, let's say to do an object detection task, and then pass the content to output GL texture. So, what is the fastest way to do that?

I managed to solve the problem by creating a Mat variable and filling the data with an unsigned char * with glReadPixels but, as you know, that method is too slow.

Is there any way to perform the same task? You can think outside of the common route.
Like maybe by the use of OpenCL with cl::ImageGL if it's possible or whatever it should be supported on Android.

For those who may need/want the source or just simply know better what I am talking about, here is the source:

void testProgram(JNIEnv* env, jnit texIn, jint texOut, jint w, jint h){

static cv::Mat mat;
mat.create(h, w, CV_8UC4);
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, mat.data);
//glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texOut);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, mat.data);​

}
 
@Mikelle02 TBH, You will not get your answer here or any other cracking communities!
I used OpenCV by a wrapper (EmguCV) for C# to do pattern matching BUT, Never did that for C++!
You better to search in Stackoverflow.
 
  • Thread Starter Thread Starter
  • #3
@Mikelle02 TBH, You will not get your answer here or any other cracking communities!
I used OpenCV by a wrapper (EmguCV) for C# to do pattern matching BUT, Never did that for C++!
You better to search in Stackoverflow.

I thought I could talk about anything related to coding/programming in this thread. That was my mistake and sorry about that.
To conclude I can say that I don't like much StackOverflow and I don't know any programming forum. Could you suggest me other alternatives?

Thanks for your patience.
 
I thought I could talk about anything related to coding/programming in this thread. That was my mistake and sorry about that.
To conclude I can say that I don't like much StackOverflow and I don't know any programming forum. Could you suggest me other alternatives?

Thanks for your patience.
Not your mistake, it's the section made for programming/codes as it's name says, BUT there are no users here that they know such things
Stackoverflow is the best of them, i mean THE BEST!