Monday, 31 October 2016

Program for Sobel Operator edge detection using Matlab





Program for Sobel Operator edge detection using Matlab



 SOBEL EDGE DETECTION

             Standard Sobel operators, for a 3×3 neighborhood, each simple central gradient estimate is vector sum of a pair of orthogonal vectors. Each orthogonal vector is a directional derivative estimate multiplied by a unit vector specifying the derivative’s direction. The vector sum of these simple gradient estimates amounts to a vector sum of the 8 directional derivative vectors. 


%Program
clear all;
clc;
aa=imread('D:\Edge.jpg');
a=rgb2gray(aa);
[row,col]=size(a);
w1=[-1 -2 -1;0 0 0;1 2 1];
w2=[-1 0 1;-2 0 2;-1 0 1];
 for x=2:1:row-1;
    for y=2:1:col-1;
        a1(x,y)=w1(1)*a(x-1,y-1)+w1(2)*a(x-1,y)+w1(3)*a(x-1,y+1)+w1(4)*a(x,y-1)+w1(5)*a(x,y)+w1(6)*a(x,y+1)+w1(7)*a(x,y+1)+w1(3)*a(x+1,y-1)+w1(8)*a(x+1,y)+w1(9)*a(x+1,y+1);

Wednesday, 5 October 2016

Program for removing salt and pepper noise using median filter



Program for removing salt and pepper noise using median filter


Program:


clc;
a=imread('D:\Flower.jpg');   
b=rgb2gray(a);
ab = imnoise(b,'salt & pepper',0.02);   %adding noise
d=double(ab);
e=d;
[row,col]=size(d);
     for x=2:1:row-1
        for y=2:1:col-1
            a1=[a(x-1,y-1) a(x-1,y) a(x-1,y+1)...
                a(x,y-1) a(x,y) a(x,y+1)...
                a(x+1,y-1) a(x+1,y) a(x+1,y+1)];
            a2=sort(a1);
            med= a2(5);
            f(x,y)=med;
     end

Sunday, 2 October 2016

Matlab Video Program and output

sample  ---- Download video


Program Code --- Download code

Output:

Output image

Program for steganography and retrieval of secret message using Matlab

Program for steganography and retrieval of secret message using Matlab

      The art and science of hiding information by embedding messages within other, seemingly harmless messages. Steganography works by replacing bits of useless or unused data in regular computer files (such as graphics, sound, text, HTML) with bits of different, invisible information. This hidden information can be plain text, cipher text, or even images.

PROGRAM: 
%Program for Steganography

clc;
img1=imread('D:\sample.jpg');
img1=rgb2gray(img1);
img1=double(img1);

Friday, 30 September 2016

Program to design L section matching network to match a series RC load



 Program to design L section matching network to match a series RC load

The lumped element model of electronic circuits makes the simplifying assumption that the attributes of the circuit, resistance, capacitance, inductance, and gain, are concentrated into idealized electrical components; resistors, capacitors, and inductors, etc. joined by a network of perfectly conducting wires.


%program to design L section matching network to match a series RC load

clc;
Z1=200-%i*100; // load impedance
R1=200;X1=-100;f=500*100^6;Z0 =100;
B1=(X1+ sqrt (R1/Z0) * sqrt (R1^2+X1^2-(R1*Z0) )) /(R1^2+X1^2);

Thursday, 29 September 2016

Two dimensional Fourier transform using Matlab


2-D Fourier transform using 1-D Fourier transform:

The Fourier Transform ( in this case, the 2D Fourier Transform ) is the series expansion of an image function ( over the 2D space domain ) in terms of "cosine" image (orthonormal) basis functions.
The definitons of the transform (to expansion coefficients) and the inverse transform are given below:
 F(u,v) = SUM{ f(x,y)*exp(-j*2*pi*(u*x+v*y)/N) }
    and
 f(x,y) = SUM{ F(u,v)*exp(+j*2*pi*(u*x+v*y)/N) }

    where u = 0,1,2,...,N-1 and v = 0,1,2,...,N-1
   x = 0,1,2,...,N-1 and y = 0,1,2,...,N-1
   j = SQRT( -1 )
   and SUM means double summation  over proper
   x,y or u,v ranges

Program: 

aa=imread('D:\Flower.jpg');          % USE SQAURE IMAGE
aa=rgb2gray(aa)
a1=abs(fft2(aa));                          %Using the inbuilt FFT function for comparison

Program for Discrete Cosine Transform using Matlab

Program for Discrete Cosine Transform using Matlab


The DCT, and in particular the DCT-II, is often used in signal and image processing, especially for lossy compression, because it has a strong "energy compaction" property in typical applications, most of the signal information tends to be concentrated in a few low-frequency components of the DCT.
The discrete cosine transform (DCT) represents an image as a sum of sinusoids of varying magnitudes and frequencies. The dct2 function computes the two-dimensional discrete cosine transform (DCT) of an image. The DCT has the property that, for a typical image, most of the visually significant information about the image is concentrated in just a few coefficients of the DCT. For this reason, the DCT is often used in image compression applications. For example, the DCT is at the heart of the international standard lossy image compression algorithm known as JPEG.

Program:


clc;
x=imread('D:\Flower.jpg');                     %Image Path
a=rgb2gray(x);
figure(1);
imshow(a);
[M N]=size(a);
const=sqrt(2/N);