Professional Documents
Culture Documents
046746
*Data Types *Image Representation *Image/Video I/O *Matrix access *Image Manipulation *MEX - MATLAB Executable
*Data Visualization *General Tips *Tricks
*Simple casting: double(), uint8(). *Useful when displaying images with a dynamic
range not corresponding to its actual type.
*Conversion:
im2double(),im2uint8(),lab2double(),lab2uint8()
I = imread('world.jpg'); I2 = I-1.4; diffI = I-I2; fprintf('Max difference between images: %d\n',max(diffI(:))); figure(1); subplot(1,2,1); imshow(I); title('I'); subplot(1,2,2); imshow(I2); title('I2');
I = double(imread('world.jpg')); I2 = I-1.4; diffI = I-I2; fprintf('Max difference between images: %2.1f\n',max(diffI(:))); figure(1); subplot(1,2,1); imshow(I); title('I'); subplot(1,2,2); imshow(I2); title('I2');
2D Matrix
* Intensity: Each pixel value in the dynamic range [minP,
maxP].
2D Matrix
* Indexed: Each pixel value in the range [minP, maxP].
* Can represent segmentation. * Useful commands: regionprops(),label2rgb()
3D Matrix
* True Color: Three 2D matrices stacked. Each
represents a color component. (e.g. RGB)
* Can represent an RGB color image,LAB image, etc. * Useful commands: imshow(),rgb2gray(),rgb2ind().
Useful Commands
* imread() read image * imwrite() write image * im2fram() convert image to movie frame * movie2avi() write avi file * aviread() read avi file * mmreader()/VideoReader() read video (better) * movie() show movie
Useful Commands:
* sub2ind() convert subscript (e.g. (r,c,clr)) to index (n). * Ind2sub() convert index (n) to subscipt (e.g. (r,c,clr)). * meshgrid() generate X,Y grids.
Useful Commands:
* imcrop() Useful for interactive cropping. * imrotate() Rotate image. * imfilter() Use kernal to convolve/correlation. * nlfilter() Sliding neighborhood operation. * blkproc() Perform function on (semi-)destinct blocks. * fspecial() Create common image filter kernals. * imresize() Resize image using defined interpolation. * kron() Kronecker tensor product * padarray() Pad image. * colfilt() Colum-stack filtering (faster) * imfreehand()- Select region with mouse
Useful Commands:
* scatter() Useful to plot points on image. * Imagesc() Useful for 2D data. * print() Save figure as image on disk (careful with lossy
compressions)
Stenography
Original
(Wikipedia)
Result
Stenography (Wikipedia)
The art of hiding a message within another larger message
50
100
150
200
250
300
50
100
150
200
250
300
50
100
150
200
250
300
50
100
150
200
250
300
50
100
150
200
250
300
50
100
150
200
250
300
Feature AND
Feature AND
Feature AND