-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
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
Python GpuMat not subscriptable #22175
Comments
It looks like the same behaviour can be achieved by passing it to the constructor. import cv2
im = cv2.cuda.GpuMat(10, 10, cv2.CV_8UC1)
im_slice = cv2.cuda.GpuMat(im, (0, 2), (0, 2)) The original issue still exists though. Either the GpuMat should be modified to behave the same as the Mat class or the docs should be updated to indicate that the functionality is not available in python and the constructor can be used instead. |
Extended to this it looks like none of the public attributes are exposed to python. I would be interested in solving this but I don't know where to begin. |
OpenCV GpuMat stores data on GPU side. It's not available for CPU code directly. To do modifications on CPU side you need to call |
I understand what you are saying but I think you misunderstood me. I should have linked to the documentation. This is the method that is not available in Python It is a 2D slice that returns a new GpuMat viewing the original data (still on the GPU) The 1D alternatives and the constructor version do work. (rowRange and colRange) Edit: also as I said above none of the public attributes are exposed in python either. |
Hi, how can I pass a set of images to GpuMat? it's possible? or do you have to create a GpuMat for each image? example: from distutils.command.upload import upload GOOD_MATCH_PERCENT = 0.15 Read the images as normalnpMat1 = cv2.imread("C:\Users\Geddy\Desktop\0.png") Load the images onto the GPUcuMat1 = cv2.cuda_GpuMat() Convert the color on the GPUcuMat1 = cv2.cuda.cvtColor(cuMat1, cv2.COLOR_BGR2GRAY) Create the CUDA ORB detector and detect keypoints/descriptorskps1, descs1 = orb.detectAndComputeAsync(cuMat1, None) # Both are returned as GPU Mats the previous code works great !!! But it is with 2 images I want to do it with 50 images, how can I do it ? |
System information (version)
Detailed description
GpuMat
in the Python bindings is missing support for__getitem__
From my understanding the
GpuMat
class is supposed to behave mostly the same as theMat
class.__getitem__
works on theMat
class but not on theGpuMat
class.I am using OpenCV with Python. I think this is the correct place to report this.
I would try and debug this issue myself but I don't know where to find the python bindings or how they are generated.
Steps to reproduce
I would expect getitem to work on the GpuMat class.
TypeError: 'cv2.cuda.GpuMat' object is not subscriptable
The behaviour works correctly on the Mat class
It could just be that I am misunderstanding the documentation. There is very little Python documentation in this part of the code.
Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found any solution
The text was updated successfully, but these errors were encountered: