Lets Learn together... Happy Reading

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

Select your favorite topic

Image extensions in MATLAB

Graphics Interchange Format
To extract frames from GIF file.
The image is usually an animated GIF file.
The multiframes are read using the syntax: imread(filename, ‘frames’, ‘all’)
To read ‘n’ number of frames from a GIF file: imread(filename, ‘frames’, 1:n)

Example:
Here, the GIF image is an animated file and contains 8 frames.
The frames that are read will be stored in a 4-D format.



 [A,map]=imread('cute.gif','frames','all');
mov=immovie(A,map);
implay(mov);



To animate the muliframes: use  ‘immovie’ to make a movie from the muliframe image.
Play the movie using ‘implay’.

To view a particular frame:

imshow(A(:,:,4),map);  Here the 4th frame is viewed.

To create avi file from the movie:

movie2avi(mov, 'cute_girl.avi', 'compression', 'None','fps',3);
Here frames per second(fps) is 3. 





Tagged Image File Format

In MATLAB, when we try to read some .tiff images. The images will be read in the form of grayscale. This happens when the ‘photometric’ attribute is set as ‘grayscale’ and the ‘samples per pixel’ is 1.

Now, let’s check the metadata of the image:

obj=Tiff('trees.tif','r');
image_type=obj.getTag('Photometric');
spp=obj.getTag('SamplesPerPixel');
display(image_type);
display(spp);

The photometric value will be 3, which represents the image is grayscale.
The samples per pixel will be 1.

In order to obtain the RGB image in a tiff format, read an image along with its colormap.  Then convert the image to rgb using the map. The final image will be a RGB image.


[A,map]=imread('trees.tif');
B=ind2rgb(A,map);
imshow(B);


Metadata:

It is the information about the data in the file. The information can be about the file type, date created, image height and width, and image compression type and so on.

Colormap:
A colormap is a m by 3 matrix. Each row defines one RGB color intensities.

like button Like "IMAGE PROCESSING" page

0 comments:

Enjoyed Reading? Share Your Views

Previous Post Next Post Home
Related Posts Plugin for WordPress, Blogger...
Google ping Hypersmash.com