You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to implement something like this piece of code written in C++ to
Java?
IplImage* img=cvCreateImage(cvSize(640,480),IPL_DEPTH_8U,3);
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 0]=111;
where i,j are image coordinates. Code found at:
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html
Since this makes use of pointers, I was wondering if it is possible to do it in
Java. It may be a simple fix (I'm missing something) or it may not be possible
to do.
What I'm trying to do is access the colour channels of a particular pixel. I
have got it working with the cvGet2D method but the program got quite slow when
looping this method. Maybe using this new method will be faster (that is the
case in C++).
Thanks in advance
Original issue reported on code.google.com by josephps...@gmail.com on 27 Aug 2010 at 9:03
The text was updated successfully, but these errors were encountered:
As mentionned in the README.txt file, you can get a ByteBuffer by calling
getByteBuffer():
ByteBuffer bb = img.getByteBuffer();
And then you use the ByteBuffer like any other standard Java NIO ByteBuffer..
Your operation above would look something like:
bb.put(i*img.widthStep + j*img.nChannels + 0, (byte)111);
Original comment by samuel.a...@gmail.com on 28 Aug 2010 at 2:56
Original issue reported on code.google.com by
josephps...@gmail.com
on 27 Aug 2010 at 9:03The text was updated successfully, but these errors were encountered: