2

I am performing a descriptor function on an image. In the documentation, the function requires me to input image I -

I is a gray-scale square image with odd side length of class SINGLE.

I already knew how to convert an image matrix to single using single(I), but I am not able to understand what is the meaning of a square image with odd side length, is it asking me to input a square image or is it related to matrix??

Kevin Workman
  • 41,537
  • 9
  • 68
  • 107
ARKhan
  • 297
  • 1
  • 9
  • 1
    Pretty sure it means a square matrix (i.e. number of columns equals number of rows) with an odd number of rows (and therefore columns). You can make your image square either by cropping it or by using interpolation (see `interp2`) – Dan May 24 '16 at 06:45
  • @Dan I am confused, do you mean, that the image should be cropped to square or the matrix to be converted to square? I am sorry if I sound stupid, because, even if I read an image that is square, obviously the matrix won't come square (r = c) – ARKhan May 24 '16 at 06:53
  • 1
    The image and the matrix are the same thing so I have no idea what you mean? – Dan May 24 '16 at 06:54
  • Are you using MATLAB-openCV ? or just MATLABs iamge processing toolbox? – Ander Biguri May 24 '16 at 09:35
  • @AnderBiguri MATLAB-OpenCV – ARKhan May 24 '16 at 12:15
  • @dARK-f3n1Xx and also vlfeat? Please, shows as a [mcve] – Ander Biguri May 24 '16 at 13:08

1 Answers1

0

With the code below you can resize an image to a square image with and odd side length (in this case 333) and make it single:

import cv2
import numpy as np

img = cv2.imread('image.jpg')
size=333
result = cv2.resize(img,(size, size), interpolation = cv2.INTER_CUBIC)
single=np.single(result)
tfv
  • 6,016
  • 4
  • 36
  • 67