MATLAB CODE- Logical operations on the images


clc
close all

% Read Image A that is an image of an ellipse
% Convert Image A to a binary image
myimageA=imread('ellipse.jpg');
mybinaryimageA = im2bw(myimageA);


% Read Test image B
% Convert Image B to a binary image

myimageB=imread('test1.jpg');
myimageadjustB =imresize(myimageB,[256,256]);
mybinaryimageB = im2bw(myimageadjustB);


% Display the Original Image A

subplot(4,2,1)
imshow(mybinaryimageA),title('Binary Image - Image A ');

% Display the Original Image B

subplot(4,2,2)
imshow(mybinaryimageB),title('Binary Image - Image B');

% Take a complement of Image A and Display it

subplot(4,2,3)
resultor= ~mybinaryimageA ;
imshow(mat2gray(resultor)), title('Complement of Image A');

% Take a Ex-OR of Image A and Image B and Display it

subplot(4,2,4)
resultxor= xor(mybinaryimageA,mybinaryimageB);
imshow(mat2gray(resultxor)), title('Image A XOR Image B');

% Take OR of Image A and Image B and Display it
subplot(4,2,5)
resultor= mybinaryimageA | mybinaryimageB;
imshow(mat2gray(resultor)), title('Image A OR Image B ');

% Take AND of Image A and Image B and Display it
subplot(4,2,6)
resultand= mybinaryimageA & mybinaryimageB;
imshow(mat2gray(resultand)), title('Image A AND Image B ');

% Read a coour image and convert it to 8 bit grey level image

subplot(4,2,7)
mycolourimg = imread('zoo1.jpg');
mygrayimg = rgb2gray(mycolourimg);
subimage(mygrayimg),title('Original Grey Image');
axis off; axis equal;


% Extract seventh plane and display it
subplot(4,2,8)
planeimg = double(mygrayimg);
k = 128;
mysevengreyimg = mod(floor(planeimg/k),2);
imshow(mysevengreyimg),title('Seventh Plane');

MATLAB CODE- Logical operations on the images MATLAB CODE- Logical operations on the images Reviewed by Suresh Bojja on 10/20/2015 06:58:00 PM Rating: 5

Subjects & Labs

AC (6) ADS (2) ATMEL (6) AWP (5) C- Language (3) CAO (5) CDAC (1) Cloud Computing (1) CMC (6) CN (10) CONSERVATION & MANAGEMENT Complete Notes (1) Control Sys (2) CVSM (2) Data Analytics (1) DC (5) Digital System Design (3) DIP (17) DLD (10) DLD Lab Manual (1) DS (4) DSD&DICA (9) DSP (6) EDC (45) Electonic Components (2) Embedded (7) EMWTL (6) ENERGY AUDIT (1) Engg. Mechanics (2) Engg.Chemistry (11) Faculty Files (6) Faculty Labs (1) Fuzzy (3) II MID (1) Job Exam Papers (4) LICA (1) Linux OS (1) Materials (1) MATLAB (27) MCU IDE 8051 (1) MEMS (4) MPMC (57) MPMC LAB Manual (3) MTECH (6) MWE (2) OC (1) PDC (9) Projects (8) RADAR (1) Research (9) RVSP (3) SC (1) Softwares (1) SS (1) STLD (18) TCSS (1) TSSN (1) TV Engg (1) VHDL (4) VLSI (8) VLSI Lab manual (1) WCN (1) Wireless Commu. (1) WSN (2)

Contact Form :

Name

Email *

Message *

Theme images by enjoynz. Powered by Blogger.