Skip to main content

Bit plane slicing in image processing using MATLAB


bit plane slicing in image processing using MATLAB

MATLAB Script:

% clearing the output terminal / command window in MATLAB
clc
clear all
% 'imread'command is used to read an image file
% it reads the pixel values of an image matrix
i= imread('.../index.tif');
% 'rgb2grey' command convert the pixel intensity into grey scale value
Image= rgb2gray(i);
% pixel values are stored as 'double' variable as value can exceed from 127
% we can store values ranges from -128 to 127 as 'int' variable
I = double(Image);            

% you know that image pixels usually have 256 distinct intensity levels
% and usually 8 bits / pixel hold the intensity information of grey image
% while 24 bits / pixel hold the intensity informaton of RGB image
% extracting bit one by one from c1(first bit) to c8(last bit) respectively
r1 = mod(I, 2);            % Bit1
r2 = mod(floor(I/2), 2);   % Bit2
r3 = mod(floor(I/4), 2);   % Bit3
r4 = mod(floor(I/8), 2);   % Bit4
r5 = mod(floor(I/16), 2);  % Bit5
r6 = mod(floor(I/32), 2);  % Bit6
r7 = mod(floor(I/64), 2);  % Bit7
r8 = mod(floor(I/128), 2); % Bit8

% plotting the MATLAB figure window into 2 rows and 8 columns
% plotting original image in first subplot
subplot(2, 4, 1);
imshow(Image);
title('Original Image');
 
% plotting binary image having extracted bit from 1st to 8th
% in subplot from 2nd to 9th
subplot(2, 4, 2);
imshow(r1);
title('Bit Plane 1');
subplot(2, 4, 3);
imshow(r2);
title('Bit Plane 2');
subplot(2, 4, 4);
imshow(r3);
title('Bit Plane 3');
subplot(2, 4, 5);
imshow(r4);
title('Bit Plane 4');
subplot(2, 4, 6);
imshow(r5);
title('Bit Plane 5');
subplot(2, 4, 7);
imshow(r6);
title('Bit Plane 6');
subplot(2, 4, 8);
imshow(r7);
title('Bit Plane 7');
subplot(2, 4, 9);
imshow(r8);
title('Bit Plane 8');



People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   Start Simulator for binary ASK Modulation Message Bits (e.g. 1,0,1,0) Carrier Frequency (Hz) Sampling Frequency (Hz) Run Simulation Simulator for binary FSK Modulation Input Bits (e.g. 1,0,1,0) Freq for '1' (Hz) Freq for '0' (Hz) Sampling Rate (Hz) Visualize FSK Signal Simulator for BPSK Modulation ...

Constellation Diagrams of ASK, PSK, and FSK

📘 Overview of Energy per Bit (Eb / N0) 🧮 Online Simulator for constellation diagrams of ASK, FSK, and PSK 🧮 Theory behind Constellation Diagrams of ASK, FSK, and PSK 🧮 MATLAB Codes for Constellation Diagrams of ASK, FSK, and PSK 📚 Further Reading 📂 Other Topics on Constellation Diagrams of ASK, PSK, and FSK ... 🧮 Simulator for constellation diagrams of m-ary PSK 🧮 Simulator for constellation diagrams of m-ary QAM BASK (Binary ASK) Modulation: Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1.    BFSK (Binary FSK) Modulation: Transmits one of two signals: +√Eb​ ( On the y-axis, the phase shift of 90 degrees with respect to the x-axis, which is also termed phase offset ) or √Eb (on x-axis), where Eb​ is the energy per bit. These signals represent binary 0 and 1.  BPSK (Binary PSK) Modulation: Transmits one of two signals...

Power Spectral Density Calculation Using FFT in MATLAB

📘 Overview 🧮 Steps to calculate the PSD of a signal 🧮 MATLAB Codes 📚 Further Reading Power spectral density (PSD) tells us how the power of a signal is distributed across different frequency components, whereas Fourier Magnitude gives you the amplitude (or strength) of each frequency component in the signal. Steps to calculate the PSD of a signal Firstly, calculate the first Fourier transform (FFT) of a signal Then, calculate the Fourier magnitude of the signal The power spectrum is the square of the Fourier magnitude To calculate power spectrum density (PSD), divide the power spectrum by the total number of samples and the frequency resolution. {Frequency resolution = (sampling frequency / total number of samples)} Sampling frequency (fs): The rate at which the continuous-time signal is sampled (in Hz). ...

FFT Magnitude and Phase Spectrum using MATLAB

📘 Overview & Theory 🧮 MATLAB Code 1 🧮 MATLAB Code 2 📚 Further Reading   MATLAB Code  % Developed by SalimWireless.Com clc; clear; close all; % Configuration parameters fs = 10000; % Sampling rate (Hz) t = 0:1/fs:1-1/fs; % Time vector creation % Signal definition x = sin(2 * pi * 100 * t) + cos(2 * pi * 1000 * t); % Calculate the Fourier Transform y = fft(x); z = fftshift(y); % Create frequency vector ly = length(y); f = (-ly/2:ly/2-1) / ly * fs; % Calculate phase while avoiding numerical precision issues tol = 1e-6; % Tolerance threshold for zeroing small values z(abs(z) < tol) = 0; phase = angle(z); % Plot the original Signal figure; subplot(3, 1, 1); plot(t, x, 'b'); xlabel('Time (s)'); ylabel('|y|'); title('Original Messge Signal'); grid on; % Plot the magnitude of the Fourier Transform subplot(3, 1, 2); stem(f, abs(z), 'b'); xlabel('Frequency (Hz)'); ylabel('|y|'); title('Magnitude o...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...

📘 Overview of BER and SNR 🧮 Online Simulator for BER calculation of m-ary QAM and m-ary PSK 🧮 MATLAB Code for BER calculation of M-ary QAM, M-ary PSK, QPSK, BPSK, ... 📚 Further Reading 📂 View Other Topics on M-ary QAM, M-ary PSK, QPSK ... 🧮 Online Simulator for Constellation Diagram of m-ary QAM 🧮 Online Simulator for Constellation Diagram of m-ary PSK 🧮 MATLAB Code for BER calculation of ASK, FSK, and PSK 🧮 MATLAB Code for BER calculation of Alamouti Scheme 🧮 Different approaches to calculate BER vs SNR What is Bit Error Rate (BER)? The abbreviation BER stands for Bit Error Rate, which indicates how many corrupted bits are received (after the demodulation process) compared to the total number of bits sent in a communication process. BER = (number of bits received in error) / (total number of tran...

Comparisons among ASK, PSK, and FSK | And the definitions of each

📘 Comparisons among ASK, FSK, and PSK 🧮 Online Simulator for calculating Bandwidth of ASK, FSK, and PSK 🧮 MATLAB Code for BER vs. SNR Analysis of ASK, FSK, and PSK 📚 Further Reading 📂 View Other Topics on Comparisons among ASK, PSK, and FSK ... 🧮 Comparisons of Noise Sensitivity, Bandwidth, Complexity, etc. 🧮 MATLAB Code for Constellation Diagrams of ASK, FSK, and PSK 🧮 Online Simulator for ASK, FSK, and PSK Generation 🧮 Online Simulator for ASK, FSK, and PSK Constellation 🧮 Some Questions and Answers Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK    Comparisons among ASK, PSK, and FSK Comparison among ASK, FSK, and PSK Parameters ASK FSK PSK Variable Characteristics Amplitude Frequency ...

Coherence Bandwidth and Coherence Time

🧮 Coherence Bandwidth 🧮 Coherence Time 🧮 MATLAB Code s 📚 Further Reading For Doppler Delay or Multi-path Delay Coherence time T coh ∝ 1 / v max (For slow fading, coherence time T coh is greater than the signaling interval.) Coherence bandwidth W coh ∝ 1 / Ï„ max (For frequency-flat fading, coherence bandwidth W coh is greater than the signaling bandwidth.) Where: T coh = coherence time W coh = coherence bandwidth v max = maximum Doppler frequency (or maximum Doppler shift) Ï„ max = maximum excess delay (maximum time delay spread) Notes: The notation v max −1 and Ï„ max −1 indicate inverse proportionality. Doppler spread refers to the range of frequency shifts caused by relative motion, determining T coh . Delay spread (or multipath delay spread) determines W coh . Frequency-flat fading occurs when W coh is greater than the signaling bandwidth. Coherence Bandwidth Coherence bandwidth is...

MATLAB Code for Pulse Amplitude Modulation (PAM) and Demodulation

Pulse Amplitude Modulation (PAM) & Demodulation 📘 Overview & Theory of Pulse Amplitude Modulation (PAM) 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of Analog Signal and Digital Signal 🧮 Simulation Results for Comparison of PAM, PWM, PPM, DM, and PCM 📚 Further Reading 📂 Other Topics on Pulse Amplitude Modulation ... 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of an Analog Signal (2) 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of Digital Data 🧮 Other Pulse Modulation Techniques (PWM, PPM, DM, PCM) Pulse Amplitude Modulation (PAM) & Demodulation of an Analog Message Signal MATLAB Script clc; clear all; close all; fm = 10; % frequency of the message signal fc = 100; % frequency of the carrier signal fs = 100...