Ask Your Question

sotoglzz's profile - activity

2018-01-30 20:43:30 -0600 commented answer Zoom lens Calibration

Thanks for your reply.

2018-01-30 20:41:42 -0600 received badge  Supporter (source)
2018-01-30 16:08:29 -0600 received badge  Editor (source)
2018-01-30 16:08:29 -0600 edited question Zoom lens Calibration

Camera Calibration for zoom lens Maybe, this is a silly question, currently I have a len (AF-S DX NIKKOR 18-55mm f/3.5-5

2018-01-30 16:06:12 -0600 asked a question Zoom lens Calibration

Camera Calibration for zoom lens Maybe, this is a silly question, currently I have a len (AF-S DX NIKKOR 18-55mm f/3.5-5

2016-04-30 13:01:29 -0600 commented question Python. K-nearest neighbour TypeError: samples data type = 17 is not supported

Thanks for the comment berek, I've read something of BOW before, I'm currently learning about computer image classify, so I'm doing this just for understand machine learning. Thanks.

2016-04-29 17:00:49 -0600 asked a question Python. K-nearest neighbour TypeError: samples data type = 17 is not supported

I'm trying to classify some images using SIFT for detect and compute keypoints and descriptors, and then use KNN for classify them into python interpreter:

## Detect keypoints and compute descriptors for train images
for file in files:
    ima = cv2.imread(file)
    gray=cv2.cvtColor(ima,cv2.COLOR_BGR2GRAY)
    kpts, des = sift.detectAndCompute(gray, None) 
    kp_train.append(kpts)
    dsc_train.append(des)

## Train knn
dsc_train = np.array(dsc_train)
responses = np.arange(len(kp_train),dtype = np.float32)
knn = cv2.ml.KNearest_create()
knn.train(dsc_train, cv2.ml.ROW_SAMPLE, responses)

But I'm a little stuck with the next error:

>>> knn.train(dsc_train,cv2.ml.ROW_SAMPLE,responses)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: dsc_train data type = 17 is not supported

I really don't know how can fix this. Any help would be great. files is a list with 10 images, so the loop detects and computes keypoints and descriptor for each image. Thanks

2016-04-06 10:18:48 -0600 received badge  Scholar (source)
2016-04-06 10:01:08 -0600 commented answer Python. Compute keypoints and descriptor with multiple images

Hi Darek, this solved my problem, Thanks for your answer.

2016-04-06 01:09:06 -0600 asked a question Python. Compute keypoints and descriptor with multiple images

I'm trying to compute keypoints and descriptors for a given set of images with cv2.xfeatures2d.SIFT. I want to create an array with all keypoints from every images and another array for descriptors too:

kp = numpy.empty([]) 
dsc = numpy.empty([])
        for imagesFiles in range(0, len(imagesCoast)):
        sift = cv2.xfeatures2d.SIFT_create()
        kp[imagesFiles], dsc[imagesFiles] = sift.detectAndCompute(imagesCoast[imagesFiles], None)

When I run it, output says:

keypts[imagesFiles], descriptor[imagesFiles] = `sift.detectAndCompute(imagesCoast[imagesFiles], None)`IndexError: 0-d arrays can't be indexed

What I'm doing wrong? If I delete [imagesFiles] from kp and dsc it computes everything for each imagesFiles, but them only keeps keypoits and descriptor for last one? I would like to know also, what does mean IndexError: 0-d arrays

Thanks in advance José Soto