Digital Image Processing Using Scilab Pdf [LATEST]

// Low-pass filter in frequency domain [m, n] = size(gray_img); cx = m/2; cy = n/2; radius = 30; H = zeros(m, n); for i = 1:m for j = 1:n if sqrt((i-cx)^2 + (j-cy)^2) <= radius H(i, j) = 1; end end end

// 5. Edge detection sobel_x = [-1 0 1; -2 0 2; -1 0 1]; Gx = imfilter(double(img), sobel_x); Gy = imfilter(double(img), sobel_x'); edges = sqrt(Gx.^2 + Gy.^2);

// 6. Threshold processed = edges > 50; imshow(processed); end digital image processing using scilab pdf

// Install SIVP from ATOMS (Scilab’s package manager) atomsInstall("SIVP") // Restart Scilab after installation // Load the toolbox exec("SCI/modules/sivp/macros/sivp_loader.sce", -1) Alternatively, use core functions ( imread , imshow , imwrite ) available in recent Scilab versions. 3.1 Read, Display, and Write Images // Read an image img = imread('camera.jpg'); // Display image imshow(img);

// Compute histogram hist = imhist(gray_img); plot(hist); // Apply histogram equalization eq_img = histeq(gray_img); imshow(eq_img); min_val = min(gray_img); max_val = max(gray_img); stretched = (gray_img - min_val) / (max_val - min_val) * 255; 4.3 Gamma Correction gamma = 0.5; // darkens midtones corrected = 255 * (double(gray_img)/255)^gamma; 5. Filtering and Noise Reduction 5.1 Adding Noise noisy_img = imnoise(gray_img, 'gaussian', 0, 0.01); noisy_img = imnoise(gray_img, 'salt & pepper', 0.05); 5.2 Mean Filter (Low-pass) // 3x3 averaging kernel h = (1/9) * ones(3,3); filtered = imfilter(gray_img, h); 5.3 Median Filter (Non-linear) Better for salt-and-pepper noise: // Low-pass filter in frequency domain [m, n]

// 3. Denoise with median filter img = medfilt2(img, [3 3]);

Creative Commons Attribution 4.0 International (CC BY 4.0) Last updated: 2025 Read img = imread(path); // 2

// Apply filter F_filtered = F_shifted .* H; F_restored = ifftshift(F_filtered); filtered_img = abs(ifft2(F_restored)); imshow(uint8(filtered_img)); // Full image processing pipeline function processed = process_image(path) // 1. Read img = imread(path); // 2. Convert to grayscale if size(img, 3) == 3 img = rgb2gray(img); end