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

GpuMat get put #757

Closed
Senna-chan opened this issue Jul 11, 2019 · 7 comments
Closed

GpuMat get put #757

Senna-chan opened this issue Jul 11, 2019 · 7 comments
Labels

Comments

@Senna-chan
Copy link

Hello,

I am trying to use this library because of the gpu support with Java but I am stuck on some code.
In the opencv library there are .get(row,col) and .put(row, col, data) functions. How can I get and put data in a GpuMat or do I need to convert it to a normal Mat?
Here are some code examples of what I am trying to do.

  • Getting a value from a depthmap that is captured using VideoCapture with realsense.
    Function used public double[] get(int row, int col)
int distance;
distance = (int) depthMat.get(y,x)[0];
  • Putting data in a Mat for offsetting a mat
    Function used public int put(int row, int col, double... data)
public static Mat translateImg(Mat img, int offsetx, int offsety){
    Mat trans_mat = new Mat(2, 3, CvType.CV_64FC1 );
    int row = 0, col = 0;
    trans_mat.put(row ,col, 1,0,offsetx, 0,1,offsety);
    warpAffine(img,img,trans_mat,img.size());
    return img;
}
@saudet
Copy link
Member

saudet commented Jul 11, 2019 via email

@saudet
Copy link
Member

saudet commented Jul 12, 2019

If you have any additional questions, feel free to ask! Thanks

@saudet
Copy link
Member

saudet commented Jul 23, 2019

@Senna-chan
Copy link
Author

Thank you for telling me. I didn't know converting from both formats is that easy. I used convertTo but the method you suggest is easier and cleaner as well.

I do have some problems trying to run my program due to the fact that it says it is not compiled with cuda. How can I compile it with cuda with the stable branch or is it easier to use the snapshot build? Do I need to ask that in a new issue?

@saudet
Copy link
Member

saudet commented Jul 23, 2019

You'll need to add a few more artifacts to get the CUDA-enabled binaries:
https://github.com/bytedeco/javacpp-presets/tree/1.5.1/opencv#the-pomxml-build-file

@Senna-chan
Copy link
Author

I added the artifacts but it seems that there are no arm64 artifacts for cuda and opencv-gpu. The goal is to run this on a Jetson TX2.

@saudet
Copy link
Member

saudet commented Jul 23, 2019

Not yet, no, but it's possible to build from source. See issue #735.

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