macaconããã£ã¼ãã©ã¼ãã³ã°ã§ç½é»åç»ãã«ã©ã¼åãã¦æ¥½ããOpenCVã©ããã¼
Â
以åYoutubeã«ã¢ãããã¦ããèªå彩è²ã®åç»ã«ãå¤å½äººããã人ããåç»ä½æã®ãã¥ã¼ããªã¢ã«ãä½ã£ã¦æ¬²ããã¨ã³ã¡ã³ããä»ãã¾ãããããã§ãã©ããã¼ãä½æãã¦å ¬éãã¾ãããå ¥ååç»ã«å¯¾ã彩è²ãã¼ã¿ãæ¡å¤§ãã¦åãããå®çªã®å¦çããã¦ãã¾ãã®ã§ãå åç»ã®è§£åæã¯ä¿æããã¾ãã
Â
èªå彩è²
èªåã®ç¥ãéãããã£ã¼ãã©ã¼ãã³ã°ã«ããèªå彩è²ã§å®è¡å¯è½ãªå¦ç¿æ¸ã¿ã¢ãã«ãå
¬éããã®ã¯ãDahlæ°ãæåã ã¨æãã¾ãã
Automatic Colorization
ããã¦ãã®ã¢ãã«ãå
ã«åç»ãä½æããã®ãsaminæ°ã§ãæ°ã¯ffmegã使ç¨ãã¦åç»ãä½æããæ¹æ³ãå
¬éãã¦ãã¾ãã
forward.py · GitHub
Dahlæ°ã®ã¢ãã«ã使ç¨ããåç»ã¯ãå¤ãã¯ãã®saminæ°ã®æ¹æ³ã使ç¨ãã¦ä½æããã¦ããããã§ããã
ç§ããç½é»ç»åãç¨æãã¦ã¢ãã«ã«èªã¿è¾¼ã¾ããä½æ¥ãéå±ã«ãªã£ã¦ãã¾ã£ãããåææOpenCVã使ã£ã¦å¦çãã¦ãã¾ãããOpenCVã使ã£ã¦åç»ãèªã¿è¾¼ã¿ãDahlã¢ãã«ã§å½©è²ãåç»åºåã¾ã§ãä¸æ°ã«å¦çãã¾ãã®ã§ãä¸ã®ffmpegã使ç¨ããæ¹æ³ã«æ¯ã¹å¤§å¹ ã«æéãæ¸ãé«éã«å¦çãããã¨ãã§ãã¾ãããªããããã§ã®åç»ä½æã§ããåã«ãã¬ã¼ã ãã¨å½©è²ãã¦åç»åºåãã¦ããã ãã§ããé£ããå¦çã§ã¯ããã¾ããã
æºå
å®è¡ç¢ºèªç°å¢
é³å£°ãå¾è¿°ã®ãããã§å¦çããå ´å
OpenCVã®ã¤ã³ã¹ãã¼ã«ãããé¢åã§ããããã®ä¾¡å¤ã¯ããã¾ããä»åã®ã©ããã¼ã®ç»åå¤æé¨åãOpenCVã§å¦çãããã®ã¨scikit-imageã§å¦çãããã®ã¨ã§é度ãæ¯è¼ããã¨ãããOpenCVã®æ¹ãï¼åã»ã©é«éã§ãããï¼ãã¹ãåç»ã§OpenCVç471.30secãscikit-imageç2143.16secï¼
Â
ã»ããã¢ãã
Dahlæ°Automatic Colorization ããã¦ã³ãã¼ããã¦ãã ããã
http://tinyclouds.org/colorize/
Â
次ã«ä»¥ä¸ã®Gitãããmacacon.pyãmacacon.shããã¦ã³ãã¼ããã¦ãä¸ã¨åããã©ã«ãã«ä¿åãã¦ä¸ããã
Â
macacon.pyã®ã¹ã¯ãªããã以ä¸ã«ç¤ºãã¾ãã
Â
使ãæ¹
ã»åºæ¬çãªä½¿ãæ¹ ï¼ä¾ï¼ç½é»åç»ãã¡ã¤ã«åinput_movie.mp4  åºåãã¡ã¤ã«åoutput_movie.mp4ï¼
python macacon.py input_movie.mp4 output_movie.mp4
ã»ãªãã·ã§ã³ -mã§ããªãã·ã§ã³ã§ã¢ãã¿ç»é¢ã表示ãã¾ãã彩è²ä½æ¥ä¸ã®æ§åãè¦ããå ´åã«ä½¿ç¨ã
python macacon.py input_movie.mp4 output_movie.mp4 -m
              Â
Â
ã»ãªãã·ã§ã³ã-c åç ã§ã彩度ã®å¼·èª¿ãã§ãã¾ãããã ãä¸èªç¶ãªã®ã§ãã¾ããè¦ããã¾ãããã¾ãå ã è²ãè¯ãã¤ãã¦ããªãã¨ããã¯å¼·èª¿ãã¦ãå¹æã¯ããã¾ããã
python macacon.py input_movie.mp4 output_movie.mp4 -c 2.8
ããããyoutu.be
é³å£°ã®å¦ç
macacon.pyã¯åç»ã®å½©è²å¦çã ãã§ãé³å£°å¦çã¯ãã¾ããããã®ããé³å£°ã¯åç»ç·¨éã½ãããªã©ã§å¦çãã¦ãã ãããèªåã¯ã»ã¨ãã©AviUtlã§å¦çãã¦ãã¾ãã
ã¾ãåç»ç·¨éã½ãã以å¤ã®å¦çæ¹æ³ã¨ãã¦ãffmpegãç¨ãã¦ç½é»åç»ã®é³å£°ã彩è²ããåç»ã«ä»å ããæ¹æ³ã示ãã¦ããã¾ãã
ffmpeg -i input_movie.mp4 -acodec copy -map 0:1 soundtrack.m4a
ffmpeg -i output_movie.mp4 -i soundtrack.m4a -vcodec copy -acodec copy output_movie_color.mp4
Â
Â
åç»ã®å½©è²ã¨é³å£°ã®å¦çãã¾ã¨ãã¦è¡ãããã
ä¸ï¼ã¤ã®å¦çããããåãããã®ã§ããÂ
ã»åºæ¬çãªä½¿ãæ¹ï¼ä¾ï¼ç½é»åç»ã®ãã¡ã¤ã«åinput_movie.mp4  åºåãã¡ã¤ã«åoutput_movie.mp4ï¼
sh ./macacon.sh input_movie.mp4 output_movie.mp4
ã»ãªãã·ã§ã³ -mã§ããªãã·ã§ã³ã§ã¢ãã¿ç»é¢ã表示ãã¾ãã彩è²ä½æ¥ä¸ã®æ§åãè¦ããå ´åã«ä½¿ç¨ã
sh ./macacon.sh -m input_movie.mp4 output_movie.mp4
ã»-c åç ã§ã彩度ã®å¼·èª¿ãã§ãã¾ãããã ãä¸èªç¶ãªã®ã§ãã¾ããè¦ããã¾ãããã¾ãå ã è²ãè¯ãã¤ãã¦ããªãã¨ããã«ã¯å¼·èª¿ãã¦ãå¹æããã¾ããã
sh ./macacon.sh -c 2.8 input_movie.mp4 output_movie.mp4
Â
å¦çæé
ãã¹ãç°å¢
- Intel Core i7-4790K
- GeForce GTX TITAN
以ä¸ã¯ãåç»ï¼ç§ããã彩è²ã«å¿ è¦ãªæéï¼ç§ï¼ã§ããï¼è§£å度720ï½540ã®åç»ã§ãã¹ãï¼
Â
GPUã§ããã°å
åç»ã®3.5åç¨åº¦ã®æéã§å½©è²ãã¾ãã®ã§ãï¼æéã®æ ç»ã彩è²ããã®ã«ï¼æéãããè¦ã¦ããã°ããã§ããå¯ãåã«ã»ãããã¦ããã°ç¿æã«ã¯åºæ¥ã¦ãã¾ãã
CPUã®å ´åã¯ã13.5åã®æéããããã®ã§2æéã®æ ç»ã彩è²ããã«ã¯27æéã»ã©å¿
è¦ã¨ãããã¨ã«ãªãã¾ããæ¥æã«è¦ããã®ãªãéææ¥ã®å¯ãåã«ä»è¾¼ãã§ããå¿
è¦ãããã¾ããã
ãªãã-mãªãã·ã§ã³ã¯ããã»ã©è² è·ããããã¾ããã®ã§ããã½ã³ã³ãå¥ä»¶ã§æä½ããªãã彩è²ããéã¯å©ç¨ãããã¨ããè¦ããã¾ããè¦ã¦ããã ãã§ã楽ããã®ã§ã
Â
ãµã³ãã«
以ä¸ã¯macaconã©ããã¼ã使ã£ã¦å½©è²ããä¾ã§ãã
Â
ã»ãã¼ãã®ä¼æ¥
ãããwww.youtube.com
ã»è¥¿é¨æ¦ç·ç°å¸¸ãªã
ãããwww.youtube.com
ï¼ï¼40ãããããã俳åªã®æ¼æããããã§ãããç·ã®ãããçãããã¯ãã¦ãã¾ããã
Â
è足ã§ãããå ã¢ãã«ã®å¦ç¿ãã¼ã¿ã«ãªããããªãã®ã彩è²ãããã¨ãã¦ããã¾ãã±ã£ã¨ããªãçµæã«ãªãã¨æãã¾ãããããã¯å¤ãªçµæããã¨ãã°ç½é«ªã®æ¥æ¬äººã®é ãé髪ã®ãµãã«ã¼é¸æã¿ããã«ãªã£ãããã¾ããããã¯å¦ç¿ãã¼ã¿ã«æ¥æ¬äººããªãã£ãããã§ããããæºè¶³ããçµæãå¾ããã®ã§ããã°ãæ¬æ¥å½©è²ããã対象ã«å¯¾ãããååãªéã®é©åãªãã¼ã¿ã»ããã§å¦ç¿ãã¦ããå¿ è¦ãããã¾ããæ¥æ¬ã®æ ç»ãªããæ¥æ¬äººã®ãã¼ã¿ã§å¦ç¿ããã®ãçæ³ã§ãããªãä»åã®ã¢ãã«ã§ã¯æä¾ããã¦ãã¾ããã
ã¾ãDahlæ°ã®ã¢ãã«ã¯å¤æ§æ§ï¼å¹³ååï¼åé¡ãããã¾ããä¾ãã°ã¹ãã¼ãã«ã¼ãªã©èµ¤ã§ãéã§ãããå¾ãï¼å¤æ§ãªè²ãæã¤ï¼å¯¾è±¡ãã¼ã¿ãå¦ç¿ããå ´åããã®å¯¾è±¡ã®è²ã¨ãã¦ãè²ç©ºéä¸ã®èµ¤ã¨éã®å¹³åã®å¤ã¨ãã¦å¦ç¿ãã¦ãã¾ãã¾ãããã®å¹³ååã®å¹æã«ããã彩è²ã®äºæ¸¬ãç°è²ããã£ãä½ã彩度ã¨ãªã£ã¦ãã¾ãã¨ã®ãã¨ã§ããï¼å¼ç¨Zhang, Richard, Phillip Isola, and Alexei A. Efros. "Colorful Image Colorization."arXiv preprint arXiv:1603.08511 (2016).ï¼
Â
使ç¨æ¡ä»¶
ã»éåç¨
ã»ããã«ã©ã¼åããåç»ãã¢ãããããã¨ãããªããç£ç£ãªã©è£½ä½è
ã®æå¿ï¼éºå¿ï¼ã®ç¢ºèªã¨å°éãé¡ãã¾ãã
ããã¯è£½ä½è ãã«ã©ã¼åãæãã§ããªãã£ãå ´åãå¤ãããã§ãããããã¯ãææ°ã®æè¡ã使ã£ã¦å½©è²ããã¨ããã®ãªã話ã¯éã£ãã®ããããã¾ãããã製ä½è ãæ 人ã¨ãªã£ãä»ã§ã¯æ°¸é ã«ããããªããã¨ã§ãããããå人ã§æ¥½ããåã«ã¯åé¡ãªãã¨æãã¾ãããã£ã¨ããã«ã©ã¼åããã°ç½é»æ ç»ãè¦ãåã£æããã«ã¯ãªãã¾ãããä¸æè°ãªãã¨ã«ä¸æéãããç¶ãã¦è¦ã¦ããã¨å½©è²ã®ãã¿ã¼ã³ã«ãæ £ããã®ããç½é»ã§ãæ§ããªããªã¨æãã¦ãã¾ãããããã¯åä½ã¨è¨ããããã®ã¯ç¾ä»£ã®ä¸¦ã®æ ç»ããã¯ããã«ããããããããä½åèªä½ã«ã®ããè¾¼ã¿ç¸å¯¾çã«è²ã®ãã¨ããã¾ãæ°ã«ãªãããªãããããããã¾ãããããã§ããã²ããã«ã«ã©ã¼åããåç»ããä¼ã¿ã®æ¥ã«ããã¼ã«ã§ã飲ã¿ãªãããã£ããè¦ãã®ã¯å¹¸ãâ¦ã§ããã
Â