diff options
Diffstat (limited to '2993/CH2')
-rw-r--r-- | 2993/CH2/EX2.1/Ex2_1.sce | 18 | ||||
-rw-r--r-- | 2993/CH2/EX2.2/Ex2_2.sce | 9 | ||||
-rw-r--r-- | 2993/CH2/EX2.3/Ex2_3.sce | 12 | ||||
-rw-r--r-- | 2993/CH2/EX2.5/Ex2_5.sce | 21 | ||||
-rw-r--r-- | 2993/CH2/EX2.6/Ex2_6.sce | 22 | ||||
-rw-r--r-- | 2993/CH2/EX2.7/Ex2_7.sce | 27 |
6 files changed, 109 insertions, 0 deletions
diff --git a/2993/CH2/EX2.1/Ex2_1.sce b/2993/CH2/EX2.1/Ex2_1.sce new file mode 100644 index 000000000..e0b598f71 --- /dev/null +++ b/2993/CH2/EX2.1/Ex2_1.sce @@ -0,0 +1,18 @@ + +clc; +close; + +//M(Magnification Factor) = Size of the image / Size of the Object + +M = (8.8 / 150); + +//Rounding off to 4 decimal places +M = (round(M*10000))/10000; + +//F(Focal Length) = (Distance of the object from the Imagin Sensor * Magnification Facotr)/(Magnification Factor + 1) + +F = (700 * M)/(M + 1); + +format('v',6); +disp(F,'The required focal length of the lens (in mm) = ') + diff --git a/2993/CH2/EX2.2/Ex2_2.sce b/2993/CH2/EX2.2/Ex2_2.sce new file mode 100644 index 000000000..18849a30f --- /dev/null +++ b/2993/CH2/EX2.2/Ex2_2.sce @@ -0,0 +1,9 @@ + +clc; +clear; + +//The size of retinal image x : + +x = ((17 * 10)/50); + +disp(x,'The size of the retinal image (in mm) is '); diff --git a/2993/CH2/EX2.3/Ex2_3.sce b/2993/CH2/EX2.3/Ex2_3.sce new file mode 100644 index 000000000..e9b485d87 --- /dev/null +++ b/2993/CH2/EX2.3/Ex2_3.sce @@ -0,0 +1,12 @@ + +clc; +close; + +Num_of_pixels_in_width = 2400; // Given width of the image in pixels +Num_of_pixels_in_height = 2400;//Given height of the image in pixels +Resolution = 300 // Scanning resoltuion in DPI + +//The Physical size of the Image +disp(string(Num_of_pixels_in_width/Resolution)+" inches x "+ string(Num_of_pixels_in_width/Resolution)+" inches","The physical size is = ") + + diff --git a/2993/CH2/EX2.5/Ex2_5.sce b/2993/CH2/EX2.5/Ex2_5.sce new file mode 100644 index 000000000..f73aa8195 --- /dev/null +++ b/2993/CH2/EX2.5/Ex2_5.sce @@ -0,0 +1,21 @@ + +clc; +close; + +//Given image matrix is F +F = [1 2; 5 4] + +//Given threshold value = 3 + +//Thresholded Image after applying Threshold + +for i = 1:4 + if (F(i) >= 3) then//If the pixel value is >= Threshold value,the output is 1 + F(i) = 1; + else + F(i) = 0; //If the pixel value is not >= Threshold value, the output is 0 + end +end + +disp(F,'F = ','The Threshold Image is ') + diff --git a/2993/CH2/EX2.6/Ex2_6.sce b/2993/CH2/EX2.6/Ex2_6.sce new file mode 100644 index 000000000..9eac35228 --- /dev/null +++ b/2993/CH2/EX2.6/Ex2_6.sce @@ -0,0 +1,22 @@ + +clc; +close; + +//Given image matrix is F +F = [1 2; 5 4] + +//Threshold value(Thresh) = 3 +Thresh = [2 2; 2 1]; + +//Thresholded Image after applying Threshold + +for i = 1:4 + if (F(i)>=Thresh(i)) then //If the pixel value is >= Threshold , the output is 1 + F(i) = 1; + else + F(i) = 0; //If the pixel value is not >= Threshold , the output is 0 + end +end + +disp(F,'F = ','The Output ')//The output after thresholding + diff --git a/2993/CH2/EX2.7/Ex2_7.sce b/2993/CH2/EX2.7/Ex2_7.sce new file mode 100644 index 000000000..8e74f924e --- /dev/null +++ b/2993/CH2/EX2.7/Ex2_7.sce @@ -0,0 +1,27 @@ + +clc; +close; + +F = [1 2;3 4]; + +M = F; + +[n,n] = size(M); // Since its a square matrix m and n are same + +//U is a matrix of the order n whose all elements are 1 +U = []; +for i = 1:n + for j = 1:n + U(i,j) = 1; + end +end + +F = [(4*M) ((4*M)+(2*U)) ; ((4*M)+(3*U)) ((4*M)+(U))]; + +disp(F,"F` = ",'The constructed higher order(4x4) matrix is ') + +//Note: The constructed matrix in the book is shown as F subscript (4,4) which can't be done in scilab console hence instead of that F` is used + + + + |