Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Switch-Cam Downloader
- clc;clear all;close all
- dirwas = pwd;
- Endday(1:12)=31;
- Endday(2)=28;
- Endday(4)=30;
- Endday(6)=30;
- Endday(9)=30;
- Endday(11)=30;
- ShowImages = 0;
- for Hour = 06%0:23;
- Time = sprintf('%02d',Hour);
- cd(dirwas);
- SaveDir = [ pwd filesep Time '00' ];
- disp([ 'Saving images to ' SaveDir ]);
- mkdir(SaveDir);
- cd(SaveDir);
- for Year = 2008:2010
- if Year == 2010
- Months = 1:8;
- else
- Months = 1:12;
- end
- for Month = Months
- for Day = 1:Endday(Month)
- ImageName = [ 'http://cam.switch.ch/pano/' num2str(Year) '/' num2str(sprintf('%02d',Month)) ...
- num2str(sprintf('%02d',Day)) '/zueri_' num2str(Year) num2str(sprintf('%02d',Month)) ...
- num2str(sprintf('%02d',Day)) Time '00.jpg'];
- TimeString = [ num2str(sprintf('%02d',Day)) '.' num2str(sprintf('%02d',Month)) '.' num2str(Year) '-' num2str(Time) ':00' ];
- disp(['Downloading ' TimeString ])
- try
- Image=imread(ImageName);
- Image=imresize(Image,[ NaN 1080]);
- if ShowImages == 1
- pause(0.01)
- imshow(Image)
- end
- catch ImgNotFound
- disp('NOT FOUND, PROCEEDING WITH NEXT')
- end
- WriteName = [num2str(Year) '-' num2str(sprintf('%02d',Month)) '-' num2str(sprintf('%02d',Day)) '-' num2str(Time) '00.jpg'];
- imwrite(Image,WriteName)
- %% watermark with date using ImageMagick
- %% http://is.gd/eOZ77
- WaterMarkCommand = [...
- ' convert -size 100x14 xc:none -gravity center '...
- '-stroke black -strokewidth 2 -annotate 0 ' ...
- TimeString ' ' ...
- '-background none -shadow 100x3+0+0 +repage '...
- '-stroke none -fill white -annotate 0 ' ...
- TimeString ' ' ...
- WriteName ' +swap -gravity south -geometry +0-3 '...
- '-composite ' WriteName ];
- [ status, result] = system(WaterMarkCommand);
- %% watermark with date using ImageMagick
- end
- end
- end
- end
- cd(dirwas);
Add Comment
Please, Sign In to add comment