Last active
August 29, 2015 14:23
-
-
Save stetro/cf1af453f22268d9d1ed to your computer and use it in GitHub Desktop.
Practical Exercise 1 Audio and Video Coding (AVC)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 2. Vertical Grey-Scale | |
gradient = linspace(0.0, 199, 256); | |
matrix = repmat(gradient, [200 1]); | |
I8 = uint8(matrix); | |
I6 = uint8(matrix/8); | |
I4 = uint8(matrix/16); | |
I2 = uint8(matrix/32); | |
img = horzcat(mat2gray(I8), mat2gray(I6), mat2gray(I4), mat2gray(I2)); | |
f = figure(1); | |
h = imshow(img); | |
title('Task 2: Vertical Grey-Scale in 8,6,4 and 2 Bit coding') | |
saveas(f, '2-grayscale-coding', 'jpg'); | |
% 3. Vertical Color-Bars | |
% a) displaying colorspace | |
rgbmap = cat(3, [1 1 0 0 1 1 0 0], [1 1 1 1 0 0 0 0], [1 0 1 0 1 0 1 0]); | |
f = figure(2); | |
image(rgbmap); | |
title('Task 3: a) displaying colorspace') | |
saveas(f, '3a-colorspace', 'jpg'); | |
% b) converting to YCrCb and plotting colors | |
ycbcrmap = rgb2ycbcr(rgbmap); | |
f = figure(3); | |
plot(1:8, ycbcrmap(:,:,1), 'y', 1:8, ycbcrmap(:,:,2), 'b', 1:8, ycbcrmap(:,:,3), 'r'); | |
title('Task 3: b) converting to YCrCb and plotting colors'); | |
saveas(f, '3b-YCrCb-plot', 'jpg'); | |
% c) drop Cb information and plot rgb result | |
ycrmap = ycbcrmap; | |
ycrmap(:,:,2) = 0; | |
rgbmap2 = ycbcr2rgb(ycrmap); | |
f = figure(4); | |
image(rgbmap2); | |
title('Task 3: c) drop Cb information and plot rgb result'); | |
saveas(f, '3c-drop-cb-info', 'jpg'); | |
% d) drop Cr information and plot rgb result | |
ycbmap = ycbcrmap; | |
ycbmap(:,:,3) = 0; | |
rgbmap3 = ycbcr2rgb(ycbmap); | |
f = figure(5); | |
image(rgbmap3); | |
title('Task 3: d) drop Cr information and plot rgb result'); | |
saveas(f, '3d-drop-cr-info', 'jpg'); | |
% e) lower the Cr Cb intesity and plot rgb result | |
ycbcrmap05 = ycbcrmap; | |
ycbcrmap05(:,:,2) = ycbcrmap05(:,:,2) * 0.5; | |
ycbcrmap05(:,:,3) = ycbcrmap05(:,:,3) * 0.5; | |
rgbmap3 = ycbcr2rgb(ycbcrmap05); | |
f = figure(6); | |
image(rgbmap3); | |
title('Task 3: e) lower the Cr Cb intesity and plot rgb result'); | |
saveas(f, '3e-c-intensity', 'jpg'); | |
f = figure(7); | |
plot(1:8, ycbcrmap05(:,:,1), 'y', 1:8, ycbcrmap05(:,:,2), 'b', 1:8, ycbcrmap05(:,:,3), 'r'); | |
title('Task 3: e) plotting the lower YCbCr '); | |
saveas(f, '3e-YCrCb-plot', 'jpg'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment