diff --git a/pics/2024-06-28-Affine_Transformation/2d_permutation.mp4 b/pics/2024-06-28-Affine_Transformation/2d_permutation.mp4 index bcf10db4b18..f8333c348f2 100644 Binary files a/pics/2024-06-28-Affine_Transformation/2d_permutation.mp4 and b/pics/2024-06-28-Affine_Transformation/2d_permutation.mp4 differ diff --git a/pics/2024-06-28-Affine_Transformation/2d_rotation.mp4 b/pics/2024-06-28-Affine_Transformation/2d_rotation.mp4 index 2a52cdf8033..ad725ddada0 100644 Binary files a/pics/2024-06-28-Affine_Transformation/2d_rotation.mp4 and b/pics/2024-06-28-Affine_Transformation/2d_rotation.mp4 differ diff --git a/pics/2024-06-28-Affine_Transformation/2d_shear.mp4 b/pics/2024-06-28-Affine_Transformation/2d_shear.mp4 index 4dedf8a7c29..45af093d240 100644 Binary files a/pics/2024-06-28-Affine_Transformation/2d_shear.mp4 and b/pics/2024-06-28-Affine_Transformation/2d_shear.mp4 differ diff --git a/pics/2024-06-28-Affine_Transformation/3d_reflection.mp4 b/pics/2024-06-28-Affine_Transformation/3d_reflection.mp4 index 905ac04b040..607c6295d01 100644 Binary files a/pics/2024-06-28-Affine_Transformation/3d_reflection.mp4 and b/pics/2024-06-28-Affine_Transformation/3d_reflection.mp4 differ diff --git a/pics/2024-06-28-Affine_Transformation/3d_rotation.mp4 b/pics/2024-06-28-Affine_Transformation/3d_rotation.mp4 index fef7c6fe15b..68496b30158 100644 Binary files a/pics/2024-06-28-Affine_Transformation/3d_rotation.mp4 and b/pics/2024-06-28-Affine_Transformation/3d_rotation.mp4 differ diff --git a/pics/2024-06-28-Affine_Transformation/3d_shear.mp4 b/pics/2024-06-28-Affine_Transformation/3d_shear.mp4 index 0fe3712e6d6..c0c3208a05e 100644 Binary files a/pics/2024-06-28-Affine_Transformation/3d_shear.mp4 and b/pics/2024-06-28-Affine_Transformation/3d_shear.mp4 differ diff --git a/pics/2024-06-28-Affine_Transformation/pics.m b/pics/2024-06-28-Affine_Transformation/pics.m index fe46b9df1bf..7e4b80bb00e 100644 --- a/pics/2024-06-28-Affine_Transformation/pics.m +++ b/pics/2024-06-28-Affine_Transformation/pics.m @@ -13,13 +13,21 @@ h = zeros(1, numel(X)); v = VideoWriter('vector2dot.mp4', 'MPEG-4'); -v.FrameRate = 30; % 프레임 속도 설정 (초당 프레임 수) +v.FrameRate = 60; % 프레임 속도 설정 (초당 프레임 수) +v.Quality = 100; open(v); for idx = 1:numel(X) h(idx) = arrow([0, 0], [X(idx), Y(idx)], 'color', cmap(idx,:), 'linewidth', 1, 'EdgeColor', 'k'); drawnow; frame = getframe(gcf); + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame); end @@ -29,11 +37,26 @@ drawnow; frame = getframe(gcf); + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame); end for i = 1:30 % dummy frame at the end frame = getframe(gcf); + + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame); end close(v); @@ -44,9 +67,9 @@ scatter(X, Y, 100, cmap, "filled","MarkerEdgeColor", "k", "linewidth", 1.5); %% 2D Transformation -% what_transform = "permutation"; +what_transform = "permutation"; % what_transform = "rotation"; -what_transform = "shear"; +% what_transform = "shear"; switch what_transform case "rotation" @@ -61,7 +84,7 @@ v = VideoWriter("2d_"+what_transform+".mp4", "MPEG-4"); open(v); plotXYPlane() -set(gcf,'position', [-669.0000 422.3333 530.6667 356.6667]); +set(gcf,'position', [669.0000 422.3333 530.6667 356.6667]); hold on; img = imread('cameraman.tif'); img = flipud(img); @@ -88,6 +111,14 @@ view(2) drawnow; frame = getframe(gcf); + + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame); if i_step < n_steps delete(h); @@ -97,6 +128,14 @@ for i = 1:30 frame = getframe(gcf); + + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame) end @@ -105,8 +144,8 @@ %% 3D Transformation % what_transform = "rotation"; -what_transform = "shear"; -% what_transform = "reflection"; +% what_transform = "shear"; +what_transform = "reflection"; switch what_transform case "rotation" @@ -236,6 +275,13 @@ drawnow; frame = getframe(gcf); + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame); if i_step < n_steps @@ -245,6 +291,13 @@ for i = 1:30 frame = getframe(gcf); + if mod(size(frame.cdata, 1), 2) ~= 0 + frame.cdata(end+1, :, :) = uint8(ones(1, size(frame.cdata, 2), 3) * 255); + end + + if mod(size(frame.cdata, 2), 2) ~= 0 + frame.cdata(:, end+1, :) = uint8(ones(size(frame.cdata, 1), 1, 3) * 255); + end writeVideo(v, frame) end diff --git a/pics/2024-06-28-Affine_Transformation/vector2dot.mp4 b/pics/2024-06-28-Affine_Transformation/vector2dot.mp4 index 44cfbd70aec..bc38999c6c7 100644 Binary files a/pics/2024-06-28-Affine_Transformation/vector2dot.mp4 and b/pics/2024-06-28-Affine_Transformation/vector2dot.mp4 differ