Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me write a C# program to double or quadruple the size of an image using the SINC FUNCTION from the slides below .
Please help me write a C# program to double or quadruple the size of an image using the SINC FUNCTION from the slides below.
INTERPOLATION USING THE SINC FUNCTION An image with resolution NM pixels can be thought of as a group of M signals each one having period of (1/N). Thus to interpolate along a scan line we can use the Sinc function: N-1 sin(T(x-n)) f(x) = (x-n) n=0 sin(nt(x-n)) f(x) = EN=f(n) (x-n) Thus N-1 sin(T(K-n)) f(K) = TT (K-n) f(n) rn) n) 1. 2. n=0 N-1 f(x+2) = {f(n) sin(n(*+-n) f (K +) = f(0) K+1/2 n=0 TE ... (2k-3) sin" (2+1) sin (2k-1) sin" ( 2-3) f(1) + f(2) (2k+1) (2k-1) 2 311 25T sin sin sin f(k)+2+ f(k + 1) + f(k+2) 37+ f(k + 3) 57 + f(k + N-1 sin(TE f(n) (r(K +-n) f(x +) - 2 sin TE P=0 2 3. 4. The normalized coefficients are (-2/7na), (2/ 5a), (-2/3a), (2/ta), (2a).(-2/3na), (2/51a), (-2/7sta) where, In order to reduce the number of operations, if we need to double the resolution of the line, we can use 4 coefficients to the left and 4 to the right of the mid point to be interpolated. In order to do that the coefficients (- 2/71), (2/5), (-2/37), (2/7), (2/1), (-2/31), (2/5), (-2/77) must be normalized. a=4/(1-1/3 + 1/5 - 1/7) 5. 6. a = (4/) * (76/105) Thus, the normalized coefficients are, (-105 / 14 *76), (105 / 10 *76), (-105 / 6 *76), (105 / 2 *76), (105 / 2 *76), (-105 / 6*76), (105 / 10 *76), (-105 / 14 *76) So the coefficients are, -0.0986842, 0.138158,-0.230263, 0.690789, 0.690789,-0.230263, 7. 0.138158,-0.0986842 The coefficients are: -0.0986842, 0.138158,-0.230263, 0.690789, 0.690789,-0.230263, 0.138158,-0.0986842 And = -0.09868421k-3)+0.138158f{k-2)-0.230263f(k-1)+0.6907891(k)+0.690789f{k+1) 8.-0.230263f(k+2)+0.138158(k+3)-0.0986842f(k+4) For interpolating in the y-direction the same filter can be used for the vertical direction. For arbitrary x either the Sinc formula can be used directly or if we interested in fast execution a look up function can be used Interpolation is also called Supersampling. Subsampling by 2 can be attained by obtaining every other sample, or p. by interpolation using the existing samples. Floating point operations are computationally expensive, an integer approximation to the above formula is: f(K+/2=1/100 (-10f(k-3)+14f(k-2)-23f(k-1) +69f(k)+69f(k+1)-23f(k+2)+14f(k+3)- 10f(k+4)+50] 10. INTERPOLATION USING THE SINC FUNCTION An image with resolution NM pixels can be thought of as a group of M signals each one having period of (1/N). Thus to interpolate along a scan line we can use the Sinc function: N-1 sin(T(x-n)) f(x) = (x-n) n=0 sin(nt(x-n)) f(x) = EN=f(n) (x-n) Thus N-1 sin(T(K-n)) f(K) = TT (K-n) f(n) rn) n) 1. 2. n=0 N-1 f(x+2) = {f(n) sin(n(*+-n) f (K +) = f(0) K+1/2 n=0 TE ... (2k-3) sin" (2+1) sin (2k-1) sin" ( 2-3) f(1) + f(2) (2k+1) (2k-1) 2 311 25T sin sin sin f(k)+2+ f(k + 1) + f(k+2) 37+ f(k + 3) 57 + f(k + N-1 sin(TE f(n) (r(K +-n) f(x +) - 2 sin TE P=0 2 3. 4. The normalized coefficients are (-2/7na), (2/ 5a), (-2/3a), (2/ta), (2a).(-2/3na), (2/51a), (-2/7sta) where, In order to reduce the number of operations, if we need to double the resolution of the line, we can use 4 coefficients to the left and 4 to the right of the mid point to be interpolated. In order to do that the coefficients (- 2/71), (2/5), (-2/37), (2/7), (2/1), (-2/31), (2/5), (-2/77) must be normalized. a=4/(1-1/3 + 1/5 - 1/7) 5. 6. a = (4/) * (76/105) Thus, the normalized coefficients are, (-105 / 14 *76), (105 / 10 *76), (-105 / 6 *76), (105 / 2 *76), (105 / 2 *76), (-105 / 6*76), (105 / 10 *76), (-105 / 14 *76) So the coefficients are, -0.0986842, 0.138158,-0.230263, 0.690789, 0.690789,-0.230263, 7. 0.138158,-0.0986842 The coefficients are: -0.0986842, 0.138158,-0.230263, 0.690789, 0.690789,-0.230263, 0.138158,-0.0986842 And = -0.09868421k-3)+0.138158f{k-2)-0.230263f(k-1)+0.6907891(k)+0.690789f{k+1) 8.-0.230263f(k+2)+0.138158(k+3)-0.0986842f(k+4) For interpolating in the y-direction the same filter can be used for the vertical direction. For arbitrary x either the Sinc formula can be used directly or if we interested in fast execution a look up function can be used Interpolation is also called Supersampling. Subsampling by 2 can be attained by obtaining every other sample, or p. by interpolation using the existing samples. Floating point operations are computationally expensive, an integer approximation to the above formula is: f(K+/2=1/100 (-10f(k-3)+14f(k-2)-23f(k-1) +69f(k)+69f(k+1)-23f(k+2)+14f(k+3)- 10f(k+4)+50] 10
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started