Wednesday, June 23, 2010

Image Types and Fomats

An image, according to the dictionary, is a reproduction or imitation of a person or a thing. Other definition is that it is the optical counterpart of an object produced by an optical device. For our purposes, we will use the second definition.

There are four basic types of digitized images, binary, grayscale, indexed, and true color image.


Grayscale images. This image type has colors between 0 and 1 (black and white). Usually, this image type is stored as 8 bits, with 256 levels of gray from black to white. (See reference.)

Binary images. This image type has only two pixel values, 0 and 1. (Most binary representations has 0 as the black, and 1 as white, but some uses the reverse). Binary images are often used in many applications because it is simple to process. They are useful in analysis when only the silhouette of an object is needed to get all the information one wants about the object.
In conversion of images to binary, thresholding is typically done. For example, if the threshold value is set to 0.7, pixel values which are lower than that will have a value of 0, and higher pixel values will be set to 1. The choice of the threshold value can be based on the histogram of each pixel values of a grayscale image. (See reference.)

Indexed Images. In an indexed image, the actual image color for each pixel is the index into the palette or the color map. For example, a pixel's data corresponds to number 82, then the corresponding color is the 82nd in the color map. The color map comes in the file stored with the image. (See reference.)

True Color Images. A true color image has a very large number of colors, shades and hues. It has 256 shades of red, green, and blue for each pixel. Unlike in an indexed image, a true color image does not need a color map or palette. (See reference.)



Because of the emergence of advanced imaging techniques and devices, advanced image types emerged as well. Here are some examples:

Hyperspectral images. Hyperspectral imaging is a powerful and versatile means for sampling of broad intervals of the spectrum. Data acquisition are within the intervals of approximately 10nm, compared to 0.1 µm for broad bands. In this kind of imaging, each spatial element has a continuous spectrum that is used for analysis. Usually, hyperspectral imaging is used in satellite imaging.

High Dynamic Range Images. High dynamic range imaging is a linear kind of imaging. This means that each pixel value in the image is directly proportional to the amount of light intensity detected by the camera. This type of image stores pixel values that span the whole tonal range of real world scenes. As such, it is encoded in floating-point values that is stored with 32 bits per color channel. This encoding allows the largest range of values.

3D Images. The method of producing 3D images is similar to the way we see. Our left and right eye see slightly different images. Our brain fuses the two images, which allows us to see in three dimensions. In 3D imaging, two lenses placed that are placed side by side, are used to capture images. Then, filters or polarized light was used to ensure that only one image will be seen by each eye. Our brain fuses the two images together, creating an illusion of 3D.

Temporal Images or Videos. Videos are moving pictures. Typically, the number of still pictures per second ranges from 6 to 8. (See reference.)


I searched for images in the web and used imfinfo function in Scilab to display the image properties. Below are the examples of the different image types:










Figure 1. Example of a hyperspectral image.



Figure 2. Example of a high dynamic range image.




Figure 3. Example of a 3D image.





Figure 4. Example of an indexed image.



Figure 5. Example of a true color image.


Figure 6. Example of a binary image type.



Figure 7. Example of a gray scale image.


Image Formats

In image processing, the choice of image format to save your image is of vital importance.
Some image formats compresses the image and some valuable data were lost. This is called the
lossy image compression. In lossless image compression, no data were lost in compression and
each pixel information was conserved. Or, some recurring pixel pattern were replaced by a short
abbreviation.
There are several file types used today, namely the .tiff, .png, .jpeg/.jpg, .bmp, and . gif.

TIFF
Also known as Tagged Image File Format. This format is a type of lossless image compression.
Thus, a big file size is expected. Because of this, this file type is not used in web images, and
most web browsers do not display tiffs. However, tiff is useful in several editing and saving of
an image, because no data is lost in the process. (See reference.)

GIF
GIF stands for Graphics Interchange Format. It can display a maximum of 256 colors, which
makes it not good for photographic images. Its advantage is that it can be animated, and it is
often used in advertisements in the web. Another advantage is that it is a lossless format, similar
to tiff. It also requires a little amount of memory space. GIF can also be interlaced, meaning
different layers of an image can be loaded successively. In internet browsers, it gives an
impression of fast download.

PNG
Also known as Portable Network Graphics, this file type was invented in response to the payment
required to a software that supports a .gif file. This file type is also lossless, and it is superior to
.gif in using it in the web because it has 16 million colors, not just 256. (See reference.)
JPEG
Short for Joint Photographic Experts Group. It is designed specifically for photographs.
This format is capable of displaying millions of colors at once, which allows for the display
of complex hues that occurs in photographs. This file type could be lossy or lossless, depending on
the settings. An image can be saved to jpg without compression, which would mean a large file
size.For practicality, an image compression of 60% is used to optimize the size, without
compromising the quality of the image. (See reference.)

BMP
BMP, or the bitmap file type, is created by the Microsoft and IBM. Thus, it is bound to the
IBM compatible PC. All values stored in this format are in Intel format. This file type can be
lossy or lossless, depending on the settings. (See reference)
Now, we turn to the outputs of the procedures for Activity 3.
A true color image was converted into gray scale and binary image using gray_imread and im2bw functions in Scilab, respectively. The matrix size for both image conversion is 512x512.


Figure 8. Gray scale image conversion of a true color image.





Figure 9. Binary image conversion of a true color image.



Then, a grayscale image of the scanned old graph from Activity 1 was obtained. From this grayscale, a histogram of the pixel values was obtained using histplot function in Scilab.



Figure 10. Gray scale conversion of the scanned graph from
Activity 1.




Figure 11 (a)

Figure 11 (b)

Figure 11. Histogram plot of the pixel distribution of the scanned graph.
(a) histogram (b) zoom in


Here, we notice that there are small number of pixels up to 0.85. From this, the threshold value is set to 0.6. Notice that the image has good resolution for 0.5, 0.6, and 0.7 threshold value (right of 2nd column, and 3rd column). Lower threshold value shows blurring of the image, while higher threshold value shows artifacts in the graph. Dark areas caused by low quality scan of the image were highlighted.


Figure 12 (a) Threshold = 0.2


Figure 12 (b) Threshold = 0.3


Figure 12 (c) Threshold = 0.4


Figure 12 (d) Threshold = 0.5


Figure 12 (e) Threshold = 0.6


Figure 12 (f) Threshold = 0.7


Figure 12 (g) Threshold = 0.8


Figure 12 (h) Threshold = 0.9

Figure 12. Binary image conversion with increasing
threshold value.



Slow motion popping of a popcorn.
Video taken from here.


I would like to thank Cindyleen Kate Grieta, and Ma'am Jing for explaining
the meaning of the threshold value and histogram.

I would give myself a score of 8/10. All the outputs required for this activity were met,
except for the format of this blog report which is not in order.
(The images for advanced images were shown first, and the graphs with different
threshold values are not properly labeled)


References:
Merriam-Webster's 11th Collegiate Dictionary

No comments:

Post a Comment