# Featurizing images of different dimensions

I'm building a non linear svm for images to solve a classification problem with domain {0, 1} and I'm currently doing featurization. What I want to do is create 3 features for each pixel representing the rgb value. However, my input images have different dimensions meaning that they are of different widths and heights. So doing just this would result in images having a different number of featurizations.

For example: If i have one image of (10, 2) dimension {(width, height)} then it has 10 * 2 pixels, each with a rgb value. So there would be 10 * 2 * 3 features for this image. If i have a (11, 2) image, then it has 11 * 2 * 3 features.

I am ordering the pixels by first moving horizontally and then verticall. So if I have a (2, 2) dimension image then F1, F2, F3 would be the first three features of pixel (0, 0) wheras F10, F11, F12 would be the features of pixel (1, 1)

One way I thought about solving this is by just extending each image to the maxwidth and maxheight over all images, filling values with -1's for rgb pixels where the image has been extended. For example if i have and image of dimension (2, 2) and the max width and height is (3, 3), then the new image would be of dimension (3, 3) and the with new pixels (2, 2), (0, 2) (1, 2) (2, 0) (2, 1). All of these new pixels would have -1 for all rgb values.

However, will this affect my classifiers ability to recognize patterns? I'm planning on using a svm with radial kernal to start. Is there a better way to fix this?

• Can you explain what you mean by different dimensions? Do you mean that they're not all the same width & height? What kind of classifier are you trying to build -- what is the output of the classifier? Can you give a few examples? One standard approach is to crop and/or rescale all the images to a standard size. If you show us some example images and edit the question to expand on the questions I listed, that might help us answer your question. The question will likely depend upon just how much the sizes of the images differ.
– D.W.
Commented Aug 5, 2015 at 1:03
• @D.W. is right. Based on your edit, it seems that you will want to scale the images to have the same number of pixels. Cropping would also work, but then you will lose information. Commented Aug 6, 2015 at 17:54