opencv / opencv/opencv-python

Orb Cuda computeAsync not using updated keypoints

Đang mở
#950 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@asmorkalov đang làm issue này rồi.

Từ ngày 21/5/2024.

Ngôn ngữ chính
Python
Star
5.4k
Fork
1k
Merge trung bình
22 giờ 17 phút
Pull request đã merge (30 ngày)
3

Mô tả

I am using the ORB cuda CV2 detector. I need to filter the keypoint returned from detect and then compute the descriptors using the updated keypoints.

Unfortunately it seems that the computeAsync uses the keypoints received from the detect.
The number of keypoints returned from detectAsync is 3000 (max number defined in orb cuda create). The filtered keypoints is 1700 but the number of descriptors is 3000.

I know that I can use detectAndComputeAsync and filter after but is much time consuming.

I am using opencV 4.8.0 with python 3.8 on windows 64bit PC.
thanks,
Iliya

Code example
##################################

            #detect keypoints
            cuMat1 = cv2.cuda_GpuMat()
            cuMat1.upload(image)
            keypoints_detected_GPU = detector.detectAsync(cuMat1, mask=None)
            keypoints_detected = detector.convert(keypoints_detected_GPU)
            
            #filter keypoints
            keypoints = FilterFunction(keypoints_detected )
            
            #upload filtered keypoints
            keypoints_np = np.array([
                [kp.pt[0] for kp in keypoints],  # x-coordinate
                [kp.pt[1] for kp in keypoints],  # y-coordinate
                [kp.response for kp in keypoints],  # response
                [kp.angle for kp in keypoints],  # angle
                [kp.octave for kp in keypoints],  # octave
                [kp.size for kp in keypoints],  # size
            ], dtype=np.float32)
            
            keypointsGpu = cv2.cuda_GpuMat()
            keypointsGpu.upload(keypoints_np)

            #Compute descriptor
            keypointsGpuCompute, descriptorsGpuCompute = detector.computeAsync(cuMat1, keypointsGpu)
            keypoints_np1 = keypointsGpuCompute.download()
            
            keypoints_list = []
            num_keypoints = keypoints_np1.shape[1]
            
            for i in range(num_keypoints):
                x = keypoints_np1[0, i]
                y = keypoints_np1[1, i]
                response = keypoints_np1[2, i]
                angle = keypoints_np1[3, i]
                octave = keypoints_np1[4, i]
                size = keypoints_np1[5, i]
            
                # Create cv2.KeyPoint object and append to the list
                kp = cv2.KeyPoint(x, y, size, angle, response, int(octave), -1)
                keypoints_list.append(kp)
            keypoints = keypoints_list

            #download descriptors
            descriptors = descriptorsGpuCompute.download()

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.