Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imencode issue #324

Closed
paolobolettieri opened this issue Feb 1, 2016 · 7 comments
Closed

imencode issue #324

paolobolettieri opened this issue Feb 1, 2016 · 7 comments
Labels

Comments

@paolobolettieri
Copy link
Contributor

I'm triyng to encode a Mat as JPEG into a byte array, but it doesn't work, the byte array doesn't change its own values.

Below an example code:

String imagePath = "path of my jpeg image";
Mat img = imread(imagePath);
byte[] byteArray = new byte[1];
imencode(".jpg", img, byteArray);

byteArray value remains [0].
Is this a JavaCV issue, or is there anything wrong in my code?

@saudet
Copy link
Member

saudet commented Feb 2, 2016 via email

@paolobolettieri
Copy link
Contributor Author

It works! Thank you.

@saudet saudet added the question label Feb 2, 2016
@saudet
Copy link
Member

saudet commented Feb 2, 2016

Good! It should also work if you provide a large enough byte[].

@saudet saudet closed this as completed Feb 2, 2016
@paolobolettieri
Copy link
Contributor Author

I also tried with a big array of one million elements
byte[] byteArray = new byte[1000000];
but it doesn't work.

@saudet
Copy link
Member

saudet commented Feb 3, 2016

That's probably fixed if you try the latest code: bytedeco/javacpp-presets#109

@robertoandrade
Copy link

Building a BytePointer out of an existing byte[] doesn't seem to work either. Is there a javacpp-presets release that includes fixes for this and using a ByteBuffer also?

@saudet
Copy link
Member

saudet commented Feb 4, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants