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

java.lang.NullPointerException: Pointer address of argument 3 is NULL on org.bytedeco.opencv.global.opencv_imgproc.rectangle #1599

Closed
4714407 opened this issue Feb 21, 2021 · 5 comments
Labels

Comments

@4714407
Copy link

4714407 commented Feb 21, 2021

The following code runs with an NullPointerException

rectangle(frame,
                                new Point(result.x, result.y),
                                new Point(result.x + result.width, result.y + result.height),
                                Scalar.MAGENTA, 2, LINE_8, 0);

java.lang.NullPointerException: Pointer address of argument 3 is NULL.
at org.bytedeco.opencv.global.opencv_imgproc.rectangle(Native Method) ~[opencv-4.4.0-1.5.4.jar:4.4.0-1.5.4]

argument 3 isScalar.MAGENTA,What did I write wrong?

@saudet saudet added the bug label Feb 21, 2021
saudet added a commit to bytedeco/javacpp-presets that referenced this issue Feb 21, 2021
@saudet
Copy link
Member

saudet commented Feb 21, 2021

That should be fixed with commit bytedeco/javacpp-presets@7f05222
Please give it a try with the snapshots: http://bytedeco.org/builds/
Thanks for reporting!

@4714407
Copy link
Author

4714407 commented Feb 22, 2021

This is what I write now:

rectangle(frame,
                                new Point(result.x, result.y),
                                new Point(result.x + result.width, result.y + result.height),
                                new Scalar(255, 0, 255, 0), 2, LINE_8, 0);

It seems that there is no problem. Should I change it to:

rectangle(frame,
                                new Point(result.x, result.y),
                                new Point(result.x + result.width, result.y + result.height),
                                new Scalar(255, 0, 255, 0).retainReference(), 2, LINE_8, 0);

@saudet
Copy link
Member

saudet commented Feb 22, 2021 via email

@4714407
Copy link
Author

4714407 commented Feb 22, 2021

Thank you very much.

@saudet
Copy link
Member

saudet commented Mar 10, 2021

The fix has been released with version 1.5.5! Enjoy

@saudet saudet closed this as completed Mar 10, 2021
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

2 participants