Monday, July 30, 2007

MTA1 Experiment 1 Question 2a & 2b Solution

MTA1 Experiment 1 Question 2a & 2b Source Code

This few days I received some request.
Most of students couldn't solve the Exp1. 2a and 2b.
So, I will post up the source code for Experiment 1 Question 2a & 2b

Question 2a :
Convert the image ‘peppers.png’ into grayscale, and perform edge detection on the resulting gray image.


Source Code :

I = imread('peppers.png'); %read in an image

A = rgb2gray(I); %convert RGB to Gray format


CN = edge(A, 'canny'); %perform canny edge detection


figure, imshow(I);

figure, imshow(A);

figure, imshow(CN);



Note : This 2a used only canny is because you found that canny is the best edge detection operator for your image by result from Question 1.



Question 2b:
Perform edge detection on each of the three color bands of the image, followed by some fusion rule. Perform edge detection on each of the color bands of the ‘peppers.png’ image and combine the three edge images in order to get the final edge image.

What is the three color bands of the image ?
You are using true color image in this question, so the 3 bands would be RGB.


How to Separate the 3 color bands ?

Example :

R = (I(:,:,1));
G = (I(:,:,2));
B = (I(:,:,3));


Note : I is the read in image.
The 1 2 and 3 indicates the layer of the image.


How to perform edge detection on every layer (band) ?

As you saved each layer into R, G and B variable.
You just need to do edge detection on every R,G and B.

Example :

CN1 = edge(R, 'canny');
CN2 = edge(G, 'canny');
CN3 = edge(B, 'canny');



How to combine the 3 edge detected image into the final image ?

This part, you can use alot of operators.
such as : 'or' , 'and' , 'xor' , 'nand' and etc.


How to use the combination operator ?

Example for 'and' operator :

C = and(CN1,CN2);
D = and(C,CN3);



Example for 'or' operator :

C = or(CN1,CN2);
D = or(C,CN3);


Note : the operator can only have 2 arguments at a time.
So combining the CN1 and CN2 and store into C first, then combine C with CN3 and you will get the final solution and save it into variable D.


-End of Experiment1 2a 2b-

Hope this source code can help you out to continue the experiment
you can always drop me a comment or msg to complain or ask.
I wont be free for chatting through msn and ym because I got an exam on tuesday'night,
if you found any problem executing the code,
you can post in the comment part and i will try to solve for you later.


Copyrighted (c) 2007 , Law Ding Yong

Saturday, July 28, 2007

Korean Language Society


在这里我要恭喜
Hata aka yongjun akaka feelgood akakaka 永润
创办新学会成功!
Korean Language Society (KLS)
请大家多多支持~



Thursday, July 26, 2007

ECP3086 MTA1 Coding Tutorials

ECP3086 Multimedia Technology Application
MTA1 Lab Report Code Writing Tutorials


Note :
Okay, at first.

I will assume everyone done the Experiment 1 -Q1 & Q2 , Experiment 2 -Q1.

I will give hints on Exp.1 -Q3 and Exp.2 -Q2 & Q3


Experiment 1 Question 3 :

Part a :

How to write a function ?

Example :

function []=FileName(argument1,argument2,argument3...)

Write this at the top of your codes,
The FileName above is the filename.m you saved as your work.
The argument1,argument2,argument3.. in the bracket is the files, values, images and ect. that you wanted to read in when you execute the function. You can have only 1 argument or more, use the comma ',' to separate the argument(s).
The [] above means void. You can define any variable to replace [].


How to use the function ?

Type the filename('imagename.xxx') to execute the function in your Matlab main window.
note : the xxx is the image format. eg. bmp, jpg, tif..


Part b:

How to check the image format ?

Code that can be use :

isrgb --- return true if image is RGB true color format
isgray --- return true if image is Gray format
isind --- return true if image is Indexed format


How to perform all 3 format checking on the image ?

The C language if-else statement can be use in this part.

Example :

if isgray(image)
perform the particular edge detect process;

elseif
isrgb(image)

perform the particular edge detect process;

elseif
isind(image)

perform the particular edge detect process;
else

fprintf('\n Format Error ! \n')

end


Note : image is the variable that stored the read in image.


Part c :

Same as Q1 and Q2


Part d :

How to display 2 image in the same figure ?


Example :

subplot(1,2,1), imshow(image1);
subplot(1,2,2), imshow(image2);



-End of Experiment 1-


Experiment 2 Question 2 :

Part a :

How to perform the DCT and quantization on all the channels ?

At first, you the rgb2ycbcr function to convert the RGB image into YCbCr image.
Store the YCbCr image in any well defined variable. eg. image2
Define a variable to store the Luminance,Y layer.
Define a variable to store the Crominance,Cb layer.
Define a variable to store the Crominance,Cr layer.

Example :

image2 = rgb2ycbcr(image);

Y = image2(:,:,1);

Cb = image2(:,:,2);

Cr = image2(:,:,3);


After that, perform blkproc on every layer and you will get a new value for every layer.
Store every new layer you get with the same variable. eg. compressed.

Example :

compressed(:,:,1)
compressed
(:,:,2)
compressed
(:,:,3)

At last, you will need to convert 'compressed' back to RGB format by using ycbcr2rgb.
Note : The system will auto combine all the layer in the same variable.


Part b :

What is 4:2:0 chroma sub-sampling ?

It is mean by compressing the image by using the YCbCr layer.
Keep the resolution of the Luminance, Y layer.
Resize the resolution of the Crominance, Cb & Cr layer into 50% of the original size.
After resize, perform blkproc on every layer and store the new value of every value using the same variable. (same as part a)
Remember to resize the new crominance layers back to the original size before storing into the variable.
After all, convert the YCbCr format back to RGB format.


Example :

Y = A2(:,:,1);
CB = imresize(A2(:,:,2),0.5);
CR = imresize(A2(:,:,3),0.5);

E(:,:,1) = D(:,:,1);
E(:,:,2) = imresize(D,2);
E(:,:,3) = imresize(D,2);



Experiment 2 Question 3 :

The hardest part in this Question is to calculate the SNR.
In this part, I wont repeat how to write function, if-else statement and subplot function.
Please refer the previous examples.


What is SNR ?

In mathematical way, the SNR is defined as

10 Log ( Average value of Square of original signal / Mean Square Error )



What is
Average value of Square of original signal ?

Lets say your signal is an image.
The image is stored in variable I.
Average value of Square of original image = mean of the image power of 2.

Example :

ASI = mean(I.^2);


Note :
ASI is the
Average value of Square of original image.
I is the variable stored the image.


What is Mean Square Error (MSE) ?

MSE is mean of square of differences between original image and compressed image

Example :

diff = I - I2;
MSE = mean(diff.^2);



Note :
I is the original image.
I2 is the compressed image.
diff is the difference between I and I2.


Last,
You can use Log10 as log of base 10 in Matlab.
You may ask why power of 2 need to be written as '.^2' ?
The dot '.' in front of ^2 is a must.
Because Matlab doesn't recognize '^2'.
The standard function of power of 2 for Matlab is '.^2'


-End of MTA1 coding tutorial-

sorry for any grammar errors


(c) Copyrighted 2007, Law Ding Yong

Saturday, July 21, 2007

200 Pounds Beauty DVDrip & OST BT download



刚刚看了这套戏.
很好很好.

主角是一个拥有200Pounds体重的女生(Kim Ah Jung 释演)
有着天生的优美声线.
只是可惜没有性感的身材.
但是还好她遇到了一个重用她的经理.
所以她的工作是替一个叫Ammy的女歌手在幕后演唱...

而她为什么会变成美女.
大家自己去看看!
很棒的一套戏.

以下是这戏的trailer:


以下是BT下载: 200 Pounds Beauty BT

如果喜欢她的歌, 可以在这里BT下载: 200 Pounds Beauty OST BT

如果没有Seed了, 可以在我的Geocities那里下载.
但是很对不起Geocities只有15MB容量.
所以我只储存了里面的两首主要歌曲.
而且Geocities又有条件,每小时不能有超过5MB的Data Transfer.
所以如果下载失败请稍后再试.
谢谢!
Kim Ah Jung - Maria
Kim Ah Jung - Byul

给我钱

最近却钱
四个字

所以我去打了些散工
在highway toll派Kleenex tissue样本
还不错
工钱高.
但是还瞒危险的.
尤其是要过speed lane的时候.
那些车总是驾得很快.
但是还好
安然无恙的完成工作.
也安然无恙的领了薪金.

开开心心面对她妈的狗多的assignments,projects,midterms..
痛苦.
没有时间打tennis.
我要打tennis啊!!!!!

但是如果你给我钱我就不打.
钱比较好..

Sunday, July 08, 2007

Ragnarok O.S.A * 仙境传说回忆录

很久前就想做的
今天
终于做了

按这里 :- Ragnarok O.S.A * 仙境传说回忆录

喜欢你们会喜欢

Friday, July 06, 2007

新的Header

很就没有create新的blog header了.
用了新的方法做了这个新的.
之前的都是些outdated的科技.
毕竟7年前也没有多好的grafic design application.

虽然是同样的照片.
经过edit和调整.
焕然一新.
以上是以GIF format.
以下是WMV format.
请欣赏.



Sorry that loading may takes some time..

temp. no song

NAME="MediaPlayer">