hi;
i need to know that how to convert an image to a vector for neural networks.
please help

Search the forum first. I'm pretty sure whether its for a neural network or anything else is immaterial. What you want to know is how to convert an image to a vector, period. Am I right?

Search the forum first. I'm pretty sure whether its for a neural network or anything else is immaterial. What you want to know is how to convert an image to a vector, period. Am I right?

yes you are right i want to know is how to convert an image to a vector

First of all, you need to have the image data stored in some sort of serially accessible data structure. Lets suppose that you have the image data in an array of floats.

Next, you need to scale your data to a specific range. Often, this range is the interval [0,1.0). However, some activation/squashing function combinations do better with different input ranges. It may be more appropriate to choose the (-1.0, 1.0 ) interval. Your choice of scaling method could also be significant. Often, you will want to normalize the pixel values to a specific range. The easiest approach is to scale each value by 1.0 / MaxPixelValue ( usually 1.0 / 255 ). However, it is usually better to do a min/max nomralization.

Once you have your normalized image data in a serially accessible data structure, all you need to do is step through it and assign each pixel value to an input node (or, with some ANNs, pass the array to the train/classify function).

One thing you should be sure to note: Neural nets are extremely sensitive to affine transformations of image data. So, rotations, displacements, and scalings will confuse your ANN. To combat this problem, you either need a method to correct affine transformations before classification, or you need a method to convert raw pixel data into another form that is invariant to these affine transformations.

Thanks alot for your help.
do you have some code for this in matlab? i m new in this field. sooo please if you colud provide me some code for understanding as well i will b grateful.
regards

Thanks alot for your help.
do you have some code for this in matlab? i m new in this field. sooo please if you colud provide me some code for understanding as well i will b grateful.
regards

Sorry, I use c++ with OpenCV for this sort of thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.