making a folded picture
1 view (last 30 days)
Show older comments
the basic idea is to create a folded photo with a resolution of 1080 by 1920 ratio . it works by having a rotated object and the program would cut a rectangle from the middle of frames(1080-by-3 ) and it combines all the cropped photos in sequence to achieve a folding effect.
my basic code was like this:
%this code bring a frame of photo, crops from the centre, and combine the
%previous photo with the new one.
load('s.mat','s')
s; %a reference(1080-by-3) photo for the loop
target=[1080 3]; %the croped size
a=VideoReader('VID_20210828_184108.mp4'); %analyzes the video
for img= 1:640 % the number of frames needed for the photo
I=read(a,img); %read the frame
r=centerCropWindow2d(size(I),target); %creates a rectangle with the target size
j=imcrop(I,r); %crop the image to the target size
s=imfuse(s,j,'montage'); %combines the new cropped photo with the old ones
end
imshow(s)
when i run the code, the image turns to be way too big. i then discovered that (imfuse) fills up the image if the two fused images dont have the same dimensions. is there a function that combines photos as they are without filling up? thank you already
0 Comments
Accepted Answer
DGM
on 30 Aug 2021
Edited: DGM
on 30 Aug 2021
If you want to edge-concatenate two images of the same height, you don't need to waste your time with imfuse.
s = [s j];
If the image heights differ, you'll have to fix that by resizing/padding/cropping before the loop.
Keep in mind that if you want edge-continuity like a folded image, you'd have to flip every other sub-image.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!