Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
a. b. c.
Figure (a) shows the intersection of real lines l and m in N2. As can be seen here the lines
are actually not intersecting in N2 although they will intersect in R2. Points of line l in N2
near the so called intersection are: (88, 86) and (89, 87). While points of line m in N2 near
the so called intersection are: (88, 87) and (89, 86).
Figure (b) shows the intersection of real lines l and n. Points of line l in N2 near the so
called intersection are: (124, 116) and (125, 117). While points of line n in N2 near the so
called intersection are: (124, 117) and (125, 116).
Figure (c) shows the intersection of line l and p. These two lines actually intersect in N2
as can be seen in the image. The point of intersection is (152, 140).
Each of the lines is a set in N2 and the intersection of two lines would mean that two lines
have one element in common. As seen in Figure (a) conventional intersection of set
(Please note that (0,0) is taken as the top left corner of the original image.)
Diophantine Equations:
Diophantine Equations is an indeterminate polynomial equation that only allows the
variables to be integers [1]. Lines in N2 can be represented by a Diophantine equation of
type
ax + by = c
where x and y are integer variables and c is the greatest common divisor of a and b and
both of them are also integers. This is a linear Diophantine equation.
As an example consider a pair of Diophantine Equations as::
7x + 18y = 208
x + y = 25
Solving the two equations for lines above, the point of intersection comes out to be
(22,3).Image showing both lines and their intersection is as
follows:
x+y=25
(22,3)
7x+18y=208
(0,0)
a b
Figure (a) shows two lines of respective equations, while Figure (b) is the zoomed
version of the intersected area. The point of intersection has a gray value of 64 and is
marked within the circle. The intersection point as discussed earlier is (22,3) .
Actually, proper solutions for second equation are points like (40, -4), (22,3), (4,10),
(-14, 17), (-32, 24), etc. What is shown in the image is a line joining all these points, by
creating a path between the points by 8- neighborhood (please refer definition 2.2 in [3]).
The path has points that have been obtained by approximating the values of (x,y)
obtained for each possible x here.
Now let us have an example of two linear Diophantine equations which do not have a
perfect intersection point:
7x + 18y = 208
2x + 3y = 1
The intersection point for these two lines does not turn out to be an integer. So these two
lines would not intersect in our discrete grid of N2 for the image. Instead the intersection
point will be approximated to some integer pair. The actual intersection occurs at point
(-40.4, 27.667)
2x+18y=208 approximations
(0,0)
2x+3y=1
a. b.
Figure (a) shows the two lines formed by Diophantine equations given above. As seen
before the point of intersection is not a member of N2 , but rather is (-40.4, 27.267). This
point has been approximated to (-40, 27) in figure (b) above. Other intersections that are
visible in the figure are also nothing but simple approximation of such values in R2 to
values in N2.
Problem 2
Aims of the Problem: To rotate a solid object by 45 degrees with respect to the center of
gravity of the object.
Solid object that we first would be considering is a rectangle. The original image to be
transformed (rather rotated) is given below. The center of gravity of the square is
coordinate (100, 100).
Rotation by angle θ
R = [ cos θ sin θ 0
-sin θ cos θ 0
0 0 1]
Hence X*R results in new coordinates w=xcos θ - ysin θ, z = xsin θ + ycos θ
Therefore the combined matrix for the required composite transformation would be
T*R*T-1 which will be given as:
F = [ cos θ sin θ 0
-sin θ cos θ 0
tx’ ty’ 1]
where tx’ = tx(cos θ -1) - tysin θ
ty’ = txsin θ + ty(cos θ -1)
After this the rotation of the images seems to be a bit sophisticated process! This was a
case of a solid object. But if we had a different object with variations in pixel values then
one would have to take care of the nearest neighborhoods also in order to produce
accurate results.
Problem 3:
Aims of the problem:
• To take an image of size NxN, and decimate it by a factor of 2.
• Interpolate the image of size N/2 x N/2 to the original size using various
interpolation techniques like bilinear, spline and bicubic.
• To increase the decimation factor by 4 and 8 and then to try to obtain the original
image.
• To comment on super resoluction
Result of decimation by factor 4 (size 256 x 256) Result of decimation by factor 8 (128x128)
We have used 3 interpolation methods in order to convert the image of size 512x512 to
its original size. (i.e. 1024x1024), we used 3 types of interpolation methods : nearest
neighbor method, bilinear method and bicubic.
While nearest neighbor simply replicates the value of the nearest neighbor of the pixel,
bilinear method uses the weighted average of the nearest 2x2 neighborhood of known
pixels around the unknown pixel and bicubic method uses a neighborhood of size 4x4. [5]
Listing for the same has been provided in the codes section.
Results obtained cane be summarized as follows:
Bicubic Interpolation
Zoomed part of each or these images is shown as follows:
Although none of the images are exactly same as the original image, there is a noticeable
difference between the interpolated images.
Nearest Neighbor method uses simple replication, hence the image appears to be rougher.
This is the reason why one sees the jagged edges at the boundary of the petals
Bilinear method is much smoother than the nearest neighbor method as it tried to use a
value that is near to its nearest neighbor and lies between the values of the unknown
pixel’s neighbors.
Bicubic linear interpolation is computationally expensive, but this tries to take up a large
neighborhood and hence results into a more detailed and a smoother image.
SUPER RESOLUTION
Low resolution in the image occurs due to lower spatial sampling frequency,
which produces distortion in the image due to high frequency components. This cases lost
in the information due to high frequency components such as edges and textures.
Degradation can also be caused by camera motion or out of focus. Thus image captured
with low resolution camera suffers from aliasing, blurring and presence of noise. Super-
resolution (SR) refers to the process of producing a high spatial resolution image from
several low resolution images, thereby increasing the maximum spatial frequency and
removing the degradations that arise during the image capturing process using a low
resolution camera. In fact, the super-resolution process extrapolates the high frequency
components and minimizes aliasing and blurring.
In order to obtain super-resolution we must look for non redundant information
among the various frames in an image sequence. The most obvious method for this seems
to be to capture multiple low resolution observations of the same scene through subpixel
shifts due to the camera motion. These subpixel shifts can occur due to the controlled
motion in imaging systems, e.g., a landsat satellite captures images of the same area on
the earth every eighteen days as it orbits around it.
Aims:
• To find the possible configurations in which two ellipses can act as elliptic gears.
• To create an animated sequence of rotation of elliptic gears
There are 2 possible configurations in which given two polynomials would act as elliptic
gears.
In the other configuration the distance between the centers of the two ellipses remains the
same.
References:
1. www.wikipedia.com/wiki/Diophantine_equation
2. Introduction to Diophantine Equations – Tom Davis
http://www.geometer.org/mathcircles/
3. Digital Topology, A.Rosenfield, American Mathematical Monthly 86: 621-630
4. Digital Image Processing Using Matlab® – Rafael C. Gonzales, Section 5.11
(Chapter 5).
5. http://www.cambridgeincolour.com/tutorials/image-interpolation.htm
6. http://mathworld.wolfram.com/Ellipse.html
7. Matlab Documentation
8. http://www.ies.co.jp/math/java/conics/elgear/elgear.html
Codes:
Listing 1 for Problem 1:
I(:,:) = 0;
for i=50:150
for j=50:150
I(i,j) = 255;
end
end
imshow(I); figure;
imshow(J); figure;
for i= 2:199
for j= 2:199
Y = [i j 1]*Tinv;
if 2<=uint8(Y(1)) && uint8(Y(1))<=199 && 2<=uint8(Y(2)) &&
uint8(Y(2))<=199
J(i,j) = I(uint8(Y(1)),uint8(Y(2)));
end
end
end
imwrite(J, 'result.bmp');
imshow(J);
Listing for Problem 3 (Decimation)
%Listing for Porblem 3, Lab challenge 2
%decimation by a factor of 2
J= zeros(size(I,1)/2, size(I,2)/2, 'uint8');
k=1;
for i=1:2:size(I,1)
l=1;
for j = 1:2:size(I,2)
J(k,l) = I(i,j);
l=l+1;
end
k=k+1;
end
imwrite(J,'rose_decimate2.bmp');
imshow(J); figure;
%decimation by a factor of 4
J= zeros(size(I,1)/4, size(I,2)/4, 'uint8');
k=1;
for i=1:4:size(I,1)
l=1;
for j = 1:4:size(I,2)
J(k,l) = I(i,j);
l=l+1;
end
k=k+1;
end
imwrite(J,'rose_decimate4.bmp');
imshow(J); figure;
%decimation by a factor of 8
J= zeros(size(I,1)/8, size(I,2)/8, 'uint8');
k=1;
for i=1:8:size(I,1)
l=1;
for j = 1:8:size(I,2)
J(k,l) = I(i,j);
l=l+1;
end
k=k+1;
end
imwrite(J,'rose_decimate8.bmp');
imshow(J);
tform=maketform('affine', T);
%Perform scaling using 'Nearest Neighbor' method
g= imtransform(I, tform, 'nearest');
imwrite(g,'nearest_interpolated.bmp');