Skip to content

Data2Img

Adrian Quintana edited this page Dec 11, 2017 · 1 revision

convert_data2img

(syntaxis changed as of version 1.2)

Purpose

This program generates a set of images by using a set of feature vectors. In other words, it converts a set of pixels values in a data file format into a set of images.

This program is very useful for classification tasks. After using the classification algorithms over a set of images, the resulting codevector, cluster centers, etc can be converted back into images using this program.

The input file (-i) has the following format:


816 1000
-5.828e-01 -2.285e-01 -1.263e+00 -2.117e+00 -2.042e+00 -1.489e+00 -9.646e-01 -1 ...
-3.061e-02 -7.568e-01 -5.042e-01 +7.268e-03 +6.901e-01 +1.526e+00 +1.596e+00 +1 ...
-6.447e-01 -1.355e-01 -7.169e-01 -1.291e+00 -7.432e-01 -1.381e-01 +7.842e-01 +2 ...
-2.325e-01 -8.786e-02 -1.858e-02 -1.251e-01 -1.997e-01 +3.015e-02 -3.462e-02 -1 ...
-1.721e-01 -1.819e-01 -8.843e-01 -1.192e+00 -4.491e-01 +4.033e-01 +3.063e-01 -3 ...
...
-3.061e-02 -7.568e-01 -5.042e-01 +7.268e-03 +6.901e-01 +1.526e+00 +1.596e+00 +1 ...


The first line indicates the dimension of the vectors (in this case 816) and the number of vectors (in this case 1000). The rest of the lines are the feature vectors. Each line is a vector and each column is a vectors' component (pixels values inside the mask).

The mask image (-mask) is used for creating the images. This mask should be exactly the same mask that produced the set of feature vectors using the img2data program. If no mask is used (-nomask), then the rows (-rows) and columns (-columns) of the generated images should be provided.

Usage


$ convert_data2img ...


Parameters

  • `` Input data file name.
  • `` The selection file name to be generated (default:[inputname.sel])
  • `` The input mask file name. Default:mask.spi
  • `` First letters of the generated images' names (default:[iname])
  • `` Extension of the output images (default:spi)
  • `` Indicates the no mask is going to be used. Default: mask is used
  • `` Number of rows if the mask is not going to be used
  • `` Number of columns if the mask is not going to be used

Examples and notes

Example 1


$ convert_data2img -i data.dat -mask mask.spi


In this example, a file nameddata.dat with a set of feature vectors will be used to generate a set of images. The set of images will be nameddata1.spi,data2.spi, etc and will be inserted in a selection file nameddata.sel. The mask filemask.spi will be used to generate this set of images.

Example 2


$ convert_data2img -i data.txt -o s0u.sel -nomask -rows 50 -columns 50


In this example, a file nameddata.txt with a set of feature vectors will be used to generate a set of images. The set of images will be nameddata1.spi,data2.spi, etc... and will be inserted in a selection file nameds0u.sel. In this case no mask will be used, and thus the created images will have a dimension of 50x50.

--Main.AlfredoSolano - 24 Jan 2007

Clone this wiki locally