|
import numpy as np |
|
import subprocess |
|
import cv2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PIC_DIR = 'uc_spk_Landscape2Soundscape_Masterpieces_pics/' |
|
|
|
DESCRIPTIONS = [ |
|
|
|
[ |
|
'01_Schick_AII840_001.jpg', |
|
'01_Schick_AII840_001.txt', |
|
'statue in shire, hill river, vogels.', |
|
'G. Schick, Bildnis der Heinrike Dannecker, 1802', |
|
'en_UK/apope_low', |
|
], |
|
|
|
[ |
|
'02_Constable_AI555_001.jpg', |
|
'02_Constable_AI555_001.txt', |
|
'Meadows country farm village in sight', |
|
'J. Constable, Dorf An Dem Flusse Stour, 1804', |
|
'en_US/m-ailabs_low#elliot_miller', |
|
], |
|
|
|
[ |
|
'03_Schinkel_WS200-002.jpg', |
|
'03_Schinkel_WS200-002.txt', |
|
'Arriving at the valley on galloping horses', |
|
'K. Schinkel Gotische Kirche Auf Einem Felsen 1815', |
|
'en_US/hifi-tts_low#6097', |
|
], |
|
|
|
[ |
|
'04_Friedrich_FV317_001.jpg', |
|
'04_Friedrich_FV317_001.txt', |
|
'Land steppes', |
|
'C. D. Friedrich, Der Watzmann, 1824', |
|
'en_US/m-ailabs_low#mary_ann', |
|
], |
|
|
|
[ |
|
'05_Blechen_FV40_001.jpg', |
|
'05_Blechen_FV40_001.txt', |
|
'fjords', |
|
'C. Blechen, Unwetter In Der Romischen Campagna, 1829', |
|
'en_US/m-ailabs_low#mary_ann', |
|
], |
|
|
|
[ |
|
'06_Menzel_AI900_001.jpg', |
|
'06_Menzel_AI900_001.txt', |
|
'Olive scenery roman Colloseum', |
|
'A. Menzel, Bauplatz mit Weiden, 1846', |
|
'en_US/cmu-arctic_low#aup', |
|
], |
|
|
|
[ |
|
'07_Courbet_AI967_001.jpg', |
|
'07_Courbet_AI967_001.txt', |
|
'Storm at the strand of waves Tsunami', |
|
'G. Courbet, Die Welle, 1870', |
|
'en_US/m-ailabs_low#mary_ann', |
|
], |
|
|
|
[ |
|
'08_Monet_AI1013_001.jpg', |
|
'08_Monet_AI1013_001.txt', |
|
'Mai flowers blossom picnic', |
|
'C. Monet, Sommertag, 1874', |
|
'en_US/cmu-arctic_low#axb', |
|
], |
|
|
|
[ |
|
'09_Blechen_AII823_001.jpg', |
|
'09_Blechen_AII823_001.txt', |
|
'Cascade in Africa', |
|
'C. Blechen, Wasserfalle Bei Tivoli, 1832', |
|
'en_US/m-ailabs_low#mary_ann', |
|
], |
|
|
|
[ |
|
'10_Boecklin_967648_NG2-80_001_rsz.jpg', |
|
'10_Boecklin_967648_NG2-80_001.txt', |
|
'Hades ades at it sisland', |
|
'A. Bocklin, Toteninsel, 1883', |
|
'en_US/cmu-arctic_low#jmk', |
|
], |
|
|
|
[ |
|
'11_Liebermann_NG4-94_001.jpg', |
|
'11_Liebermann_NG4-94_001.txt', |
|
'Tavern at the waterfront', |
|
'M. Tiebermann, Gartenlokal An Der Havel Nikolskoe, 1916', |
|
'en_US/cmu-arctic_low#ljm', |
|
], |
|
|
|
[ |
|
'12_Slevogt_AII1022_001.jpg', |
|
'12_Slevogt_AII1022_001.txt', |
|
'sailing yachts pool fluss', |
|
'M. Slevogt, Segelboote Auf Der Alster Am Abend, 1905', |
|
'en_US/m-ailabs_low#mary_ann', |
|
], |
|
] |
|
|
|
|
|
SILENT_VIDEO = '_silent_video.mp4' |
|
|
|
|
|
|
|
|
|
|
|
for img, text, scene, title, voice in DESCRIPTIONS[2:4]: |
|
|
|
|
|
|
|
|
|
|
|
im = cv2.imread(PIC_DIR + img) |
|
h, w, _ = im.shape |
|
im = im[(h%2):, (w%2):, :] |
|
print(im.shape, "GLOBAL IM\n\n\n\n") |
|
fram = np.zeros((94, im.shape[1], 3), dtype=np.uint8) |
|
h, w, _ = fram.shape |
|
font = cv2.FONT_HERSHEY_SIMPLEX |
|
bottomLeftCornerOfText = (4, 74) |
|
fontScale = 2 |
|
fontColor = (255, 255, 255) |
|
thickness = 4 |
|
lineType = 2 |
|
cv2.putText(fram, title, |
|
bottomLeftCornerOfText, |
|
font, |
|
fontScale, |
|
fontColor, |
|
thickness, |
|
lineType) |
|
offset_h = 24 |
|
im[offset_h:h+offset_h, :w, :] = (.4 * im[offset_h:h+offset_h, :w, :] + .6 * fram).astype(np.uint8) |
|
|
|
cv2.imwrite('_tmp_banner.png', im) |
|
print('save 2nd',PIC_DIR + 'thumb____' + img) |
|
cv2.imwrite(PIC_DIR + 'thumb____' + img, cv2.resize(im, (im.shape[1]//4, im.shape[0]//4))) |
|
OUT_FILE = img.split('/')[-1].replace('.','__') + '.mp4' |
|
print(f'{OUT_FILE=}\n') |
|
subprocess.run( |
|
[ |
|
"python", |
|
"tts.py", |
|
"--text", PIC_DIR + text, |
|
'--image', '_tmp_banner.png', |
|
'--scene', scene, |
|
'--voice', voice, |
|
'--out_file', OUT_FILE, |
|
]) |