Pages

Wednesday, 14 January 2015

How to separate image into non overlapping (MxM) image and apply DWT using blockproc ?

InImg = imresize(imread('peppers.png'),[120,120]);
figure,imshow(InImg)
% Apply DWT Process
fun = @(block_struct) dwt2(InImg,'haar');
I2 = blockproc(InImg,[8 8],fun);
figure,imshow(I2)

Wednesday, 2 April 2014

How to get video to frmae or image ?


mov = VideoReader('xylophone.mpg');   %# use mmreader on older versions
for i=1:mov.NumberOfFrames
    img = read(mov,i);
    imshow(img)
saveas(gcf,['Frame',num2str(i),'.jpg'])
    drawnow
end

Wednesday, 19 February 2014

How to plot 2 Y axis in one window ?

Here the plots had 2 different Y axis parameters and one common  X axis parameter. That time we ll do this process ...

figure
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');

set(get(AX(1),'Ylabel'),'String','Slow Decay')
set(get(AX(2),'Ylabel'),'String','Fast Decay')

xlabel('Time (\musec)')
title('Multiple Decay Rates')

set(H1,'LineStyle','--')
set(H2,'LineStyle',':')

So this is a simple matlab code

The final 2D plot like this


Enjoy

For more info
 http://www.mathworks.in/help/matlab/ref/plotyy.html

Monday, 30 September 2013

How to Get Real time Images Using Smart Phones (Android)

Step:1 Install  IP Webcam app in u r smart phone

Step:2 Go to IP cam Start server Open camera

Step:3 Get the IP From u r mobile and place it in code

Step:4 Write below code in Editor

url = 'http://0.0.0.0:8080/shot.jpg';
ss  = imread(url);
fh = image(ss);
while(1)
    ss  = imread(url);
    set(fh,'CData',ss);
    drawnow;
end
 U ll get a real time Images from u r mobile

----------------------------------------------------------------------------------------------------------
Enjoy