Professional Documents
Culture Documents
ABSTRACT
Here we present a simple colorization method that requires neither precise image
segmentation, nor accurate region tracking. Our method is based on a simple premise:
neighboring pixels in space-time that have similar intensities should have similar colors.
We formalize this premise using a quadratic cost function and obtain an optimization
problem that can be solved efficiently using standard techniques. In our approach an artist
only needs to annotate the image with a few color scribbles, and the indicated colors are
automatically propagated in both space and time to produce a fully colorized image or
sequence. We demonstrate that high quality colorizations of stills and movie clips may be
obtained from a relatively modest amount of user input.
1
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Chapter 1:
Introduction
2
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
INTRODUCTION
An image may be continuous with respect to the x- and y-coordinates, and also in
amplitude. Converting such an image to digital form requires that the coordinates, as
well as the amplitude, be digitized. Digitizing the coordinate values is called
sampling; digitizing the amplitude values is called quantization. Thus, when x, y, and
the amplitude values of f are all finite, discrete quantities, we call the image a digital
image. Colorization of classic motion pictures has generated much controversy which
partially accounts for the fact that not many of these movies have been colorized to
date. However, there are still massive amounts of black and white television shows
that could be colorized: the artistic controversy is often irrelevant here, while the
_nancial incentives are substantial.
3
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Chapter 2:
Principle/Theory/Concept
4
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
2. 1 Images in MATLAB
The basic data structure in MATLAB is the array, an ordered set of real or complex
elements. This object is naturally suited to the representation of images, real-valued
ordered sets of color or intensity data.
MATLAB stores most images as two-dimensional arrays (i.e., matrices), in which each
element of the matrix corresponds to a single pixel in the displayed image. (Pixel is
derived from picture element and usually denotes a single dot on a computer display.)
For example, an image composed of 200 rows and 300 columns of different colored dots
would be stored in MATLAB as a 200-by-300 matrix. Some images, such as truecolor
images, require a three-dimensional array, where the first plane in the third dimension
represents the red pixel intensities, the second plane represents the green pixel intensities,
and the third plane represents the blue pixel intensities. This convention makes working
with images in MATLAB similar to working with any other type of matrix data, and
makes the full power of MATLAB available for image processing applications.
Binary Logical array containing only 0s and 1s, interpreted as black and white,
(Also known as respectively.
a bilevel image)
5
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
The toolbox includes many functions that you can use to convert an image from one type
to another, listed in the following table. For example, if you want to filter a color image
that is stored as an indexed image, you must first convert it to truecolor format. When
you apply the filter to the truecolor image, MATLAB filters the intensity values in the
image, as is appropriate. If you attempt to filter the indexed image, MATLAB simply
applies the filter to the indices in the indexed image matrix, and the results might not be
meaningful.
Function Description
gray2ind
Convert a grayscale image to an indexed image.
grayslice
Convert a grayscale image to an indexed image by using multilevel thresholding.
im2bw
Convert a grayscale image, indexed image, or truecolor image, to a binary image, based on a luminance
threshold.
ind2gray
Convert an indexed image to a grayscale image.
ind2rgb
Convert an indexed image to a truecolor image.
6
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Function Description
mat2gray
Convert a data matrix to a grayscale image, by scaling the data.
rgb2gray
Convert a truecolor image to a grayscale image.
Note: To work with images that use other color spaces, such as HSV, first convert the image to RGB, process
the image, and then convert it back to the original color space. For more information about color space
conversion routines, see Color.
rgb2ind
Convert a truecolor image to an indexed image.
There the various pull-down menus and utility buttons. They are used for processes such
as scaling, saving, and exporting the contents of the display window. In particular, the
Edit menu has functions for editing and formatting the contents before they are printed or
saved to disk.
If another image, g, is displayed using imshow, MATLAB replaces the image in the
figure window with the new image. To keep the first image and output a second image,
use function figure, as follows:
8
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
displays both images. Note that more than one command can be written on a line,
provided that different commands are delimited by commas or semicolons. As mentioned
earlier, a semicolon is used whenever it is desired to suppress screen outputs from a
command line.
To import an image from any supported graphics image file format, in any of the
supported bit depths, use the imread function. This example reads a truecolor image into
the MATLAB workspace as the variable RGB.
RGB = imread('football.jpg');
If the image file format uses 8-bit pixels, imread stores the data in the workspace as
a uint8 array. For file formats that support 16-bit data, such as PNG and
TIFF, imread creates a uint16 array.
imread uses two variables to store an indexed image in the workspace: one for the image
and another for its associated colormap. imread always reads the colormap into a matrix
of class double, even though the image array itself may be of class uint8 or uint16.
[X,map] = imread('trees.tif');
In these examples, imread infers the file format to use from the contents of the file. You
can also specify the file format as an argument to imread.imread supports many common
graphics file formats, such as Microsoft® Windows® Bitmap (BMP), Graphics
Interchange Format (GIF), Joint Photographic Experts Group (JPEG), Portable Network
Graphics (PNG), and Tagged Image File Format (TIFF) formats. For the latest
9
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
for frame=1:27
[mri(:,:,:,frame),map] = imread('mri.tif',frame);
end
To export image data from the MATLAB workspace to a graphics file in one of the
supported graphics file formats, use the imwrite function. When usingimwrite, you
specify the MATLAB variable name and the name of the file. If you include an extension
in the filename, imwrite attempts to infer the desired file format from it. For example, the
file extension .jpg infers the Joint Photographic Experts Group (JPEG) format. You can
also specify the format explicitly as an argument to imwrite.
This example loads the indexed image X from a MAT-file, clown.mat, along with the
associated colormap map, and then exports the image as a bitmap (BMP) file.
10
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
imwrite(X,map,'clown.bmp')
Chapter 3:
Image Processing Toolbox
11
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Image display.
12
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Image arithmetic.
Geometric transformations.
Image registration.
Image analysis.
Image enhancement.
Linear filtering.
Image deblurring.
Image transforms.
Region‐based processing.
Colormap manipulation.
Array operations.
Toolbox preferences.
Demos.
22
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Slide shows.
Extended‐examples.
24
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Chapter 4:
Module Code
clc;
clear all;
close all;
25
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
update = 0;
img_rgb = imread('658.jpg');
img_shaded = img_rgb;
img_data = img_rgb*0.9;
tp = xx*yy;
r = img_data(:,:,1);
g = img_data(:,:,2);
b = img_data(:,:,3);
rh = hist(r(:),0:255)/tp;
gh = hist(g(:),0:255)/tp;
bh = hist(b(:),0:255)/tp;
mean_rh = (rh*[0:255]')/255;
mean_gh = (gh*[0:255]')/255;
mean_bh = (bh*[0:255]')/255;
sd_rh = std(rh);
sd_gh = std(gh);
sd_bh = std(bh);
md_rh = median(rh);
26
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
md_gh = median(gh);
md_bh = median(bh);
gray_img = rgb2gray(img_data);
texture_img = rangefilt(gray_img);
texture_energy = sum(texture_img(:).^2)/tp;
texture_entropy = entropy(texture_img);
cmap_img = contrast(texture_img);
cont_img = sum(cmap_img(:))/(x1*y1);
edge_hv = edge(gray_img,'sobel');
edge_X = edge(gray_img,'roberts');
hv_edge_dens = sum(edge_hv(:))/tp;
X_edge_dens = sum(edge_X(:))/tp;
x1 = 0;
y1 = 0;
sum_1 = 0;
for i=1:xx
for j=1:yy
if edge_hv(i,j) == 1
27
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
x1 = x1 + j;
y1 = y1 + i;
sum_1 = sum_1 + 1;
end
end
end
cent_x = (x1/sum_1)/tp;
cent_y = (y1/sum_1)/tp;
28
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Chapter 5:
Work Schedule
29
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Kuldeep Jain Searching project Searching project Searching project Searching project
Pankaj Baghel Searching project Searching project Searching project Searching project
30
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
31
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
34
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
Chapter 6:
References and Bibliography
35
Department of Electronics & Telecommunicaion Engineering
Converting Black & white Image into colour
BOOKS:
WEBSITES:
1. src-http://searchcio-
midmarket.techtarget.com/sDefinition/0,,sid183_gci212327,00.html
2. http://en.wikipedia.org/wiki/Discrete_wavelet_transform.
3. http://encyclopedia.jrank.org/articles/pages/6760/Image-Compression-and-
Coding.html
4. http://www.fileformat.info/mirror/egff/ch09_06.html
5. http://www.vectorsite.net/ttdcmp 2.html.
36
Department of Electronics & Telecommunicaion Engineering