ã¯ããã«ï¼å®è¥¿å çãHDRç»åãä½ãããã§ãï¼
ãHDRï¼HDRãããããã ï¼ï¼ï¼å®è¥¿å çã«ä¸äºãæ¶ãªããã«ãã¹ã±ã¸ã®æããèªãã·ã¼ã³ã«æ¶ãã人ãã¡ããã¿ãªãã£ããã«ãªã£ã¦ãã¾ãã¾ããããããªãã£ãããçªç¶HDRãã©ãããããã¦ãã¾ããªããªã£ã¦ãã¾ã£ã¦ãçµå±ã½ãããèªä½ããã®ã§å ¬éãããã¨ãã話ã§ããããã§ããã¹ã©ã ãã³ã¯ã¯ä¸åé¢ä¿ããã¾ããã
対象年齢
ãå¹¼å ãã大ä¸å¤«âãã£ããã®è¶£å³ããããåããã®å¤ä¼ã¿ã®å®¿é¡ã¾ã§å¹ åºã使ãã¾ããâãã ããåºç¤çãªããã°ã©ãã³ã°ã¨é«æ ¡æ°å¦ç¨åº¦ã®ç¥èãå¿ è¦ãããã¾ãããåãããªã人ã¯ãææªæå¾ã«åºã¦ããããã°ã©ã ã½ã¼ã¹ãã³ããããã°OKï¼å¤§äººã¯çµæãå ¨ã¦ãªã®ãï¼
å çï¼HDRç»åã£ã¦ä½ã§ããï¼
ããã質åã§ããï¼HDRã¨ããã®ã¯ãã¤ãã¤ãããã¯ã¬ã³ã¸ï¼High Dynamic Rangeï¼ã®ç¥ã§ãã®åã®éãããã¤ãããã¯ã¬ã³ã¸ã®åºãã¨ããæå³ãæ®éPCä¸ã®åçã¨ãç»åã¨ãã®JPEGãã¼ã¿ã¯RGBã®0ã256ã¾ã§ã®8bitÃ3ã§è¡¨ç¾ããã¾ããããã¯ä¸è¬çãªã¢ãã¿ã®è¡¨ç¤ºæ§è½ã®éçããæ¥ã¦ãã訳ã§ãããã®ã¢ãã¿éçã®ç¯å²ãè¶ ããï¼ããã«è¦ããï¼ç»åããªãã¨ããä½ã£ã¦ããããï¼ã¨ãã試ã¿ã§ä½ãããã®ãHDRç»åã§ããHDRç»åãåºæ¥ä¸ããã¾ã§ã®ããã»ã¹ãç°¡åã«å³ã«ããã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
ãæµãã¨ãã¦ã¯ãé²åºãå¤ãã3æã®ç»åï¼æããã®ç»åãæ®éã®ç»åãæãã®ç»åï¼ããHDRåæãã¨å¼ã°ããææ³ãç¨ãããã¨ã§8bitÃ3ãè¶ è¶ããHDRImageã¨ãã°ãããã®ãä½ã£ã¦ããã¾ãï¼â»ä¸ã®å³ã®HDRImageã®ãããæ°ééã£ã¦ãã®ã§ç´ãã¾ããï¼ãããã§ãåæããç»åã®æ°ã«ãã£ã¦ãããã§ã大ãããã¤ãããã¯ã¬ã³ã¸ã®ç»åãä½ã£ã¦ãããã¨ãã§ããã®ã§ããããã®ã¾ã¾ã§ã¯ã¢ãã¿ã®æ§è½ãè¶ ãã¦ããã®ã§è¡¨ç¤ºã§ãã¾ããããã®ããã¢ãã¿ã§è¡¨ç¾ã§ãã8bitÃ3ã¾ã§æ å ±éãè½ã¨ãã¦ããå¦çãå¿ è¦ã¨ãªãã¾ãããã®ææ³ãããã¼ã³ãããã³ã°ãã¨å¼ã°ãã調ã¹ããæ§ã ãªææ³ãææ¡ããã¦ãã¦ããã®ææ³ãç 究ã®å¯¾è±¡ãç¹è¨±ã«ãªã£ããããçµæ§å¥¥æ·±ãåéã¿ããã§ãã
ãã¾ã¨ããã¨ãHDRç»åã¯ãHDRåæãã¨ããã¼ã³ãããã³ã°ãã¨ãã2ã¤ã®ããã»ã¹ã«ãã£ã¦ãé«ããã¤ãããã¯ã¬ã³ã¸ã表ç¾ããç»åã®ãã¨ã§ããçµæ§ãã®2ã¤ãä¸ç·ã«èªåã§å¦çããã½ãããå¤ãã®ã§ããã®2ã¤ã®åºå¥ãã¤ãã¦ãªãã£ãããééã£ã¦ç解ãã¦ãã人ããããããªã®ã§æ³¨æãã¦ä¸ããããããã¹ãã«åºã¾ããï¼
ãHDRåæãã¨ããã¼ã³ãããã³ã°ãã®ä»çµã¿
ãHDRåæã§ãããæåã¯åç´ã«è¶³ãç®ããã°OKã ãï¼ã¨æã£ã¦ããã®ã§ãããããã ã¨ããã¾ããã¾ããããªãã£ãã§ããæ¥æ¬ã®æç®ãç¡ãã¦ãæµ·å¤ã®è«æã¨ãæµãèªã¿ããã¨ãããã©ããé²åºã«å¿ãã¦è£æ£ããä¸ã§å ç®ãã¦ããå¿
è¦ãããã¿ããã§ããã¨ããããä»åã¯é²åºã«å¿ãã¦é©å½ã«ã¬ã³ãè£æ£ãã¦ãããã¨ã«ãã¾ãããå¤åããã®è£æ£ãè²ã
ãã¦ãã¦ãããã¨æãã®ã§ãããã¾ã ããã¾ã§æ·±å
¥ãã§ãã¦ãã¾ãããããã¬ã³ãè£æ£åãããªã人ã¯é©å½ã«ã°ã¼ã°ã«ããã«èãã¦ä¸ããâãã ã®è£æ£ã§ãããªé£ãããã¨ã¯ãªãã§ãã
ããã®å¾ãã¼ã³ãããã³ã°ã§ãã大ãããããã¨ã°ãã¼ãã«ã¨ãã¼ã«ã«ã«åãããã¿ããã§ãç»åå
¨ä½ã®è¼åº¦ã®å¹³åå¤æ±ãã¦ããã®å¤ãå
ã«æ
å ±éè½ã¨ãã¦ããã®ãã°ãã¼ãã«ãå¤åiPhoneã¯ãã£ã¡ã®ææ³ã¤ãã£ã¦ãã¾ãããã¼ã«ã«ã¯ããã¯ã»ã«æ¯ã«ããç¨åº¦ã®ç¯å²ã®å¨å²ã®è¼åº¦ã®å¹³åå¤ãæ±ãã¦ããã®å¤ãå
ã«æ
å ±éè½ã¨ãã¨ããã®ãå
¨ãã¯ã»ã«ã«å¯¾ãã¦é½åº¦è¡ãæ¹å¼ã§ãPhotomatixã¨ãã®ã½ããã§ä½ãããããã«ãHDRç»åã¨å¼ã°ããçµµç»èª¿ã«è¦ããHDRç»åã¯ãã¼ã«ã«ã§ä½ããã¦ãã¾ãï¼å¤åï¼ãå®ã¯ã¡ãã£ã¨èªä¿¡ãªãã®ã§ãééã£ã¦ãã誰ãææãã¦ä¸ããã
ããã¼ã³ãããã³ã°ã«é¢ãã¦ç°¡åã«å³ã«ã¾ã¨ããã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
ããããããããï¼ï¼
ãè¼åº¦ã®å¹³åå¤ã®æ±ãæ¹ã¯ãä¸çªã¡ã¸ã£ããã対æ°å¹³åè¼åº¦ãç¨ãã¾ãããããã¯ãä¸çªæåã©ããã®è«æã®æ°å¼ã©ããã§ã¯ã©ããã¦ããã¾ããããªãã£ãã®ã§ã¯ã¾ãã¾ãããã¨ããããè«æãééã£ã¦ããã¨çµè«ä»ããå¼ãçµã¿ç´ãã¾ããã
ææç©
ããããã®ææ³ãããã°ã©ã ã«å®è£ ãã¦å®éã«ä½ã£ã¦ã¿ãHDRåçã§ããã¾ãã¯å ç»åã¨ãªããé²åºãå¤ãã3ã¤ã®åçã
ãé²åºã¢ã³ãã¼ã®åç
ãé²åºãªã¼ãã¼ã®åç
ãããã¦ãããããHDRåæãã¦ãã¼ã³ãããã³ã°ããHDRåçãããã ï¼
ãçµæ§ããã£ã½ãã®ã§ã¯ãªãã§ããããï¼Olympusã®ãã¸ä¸ã«ã¯ãã©ãããã¯ãã¼ã³ã¨ããHDR風ã®ãã£ã«ã¿ããã£ã¦ããããçã£ã¦ãã©ã¡ã¼ã¿ãã¥ã¼ãã³ã°ãã¦ã¿ã¾ããã
ãã¡ãªã¿ã«ãããããã©ãããã¯ãã¼ã³ããããåãç»åã
ãããããã©ãããã¯ãã¼ã³ã®æ¹ãå ¨ç¶ããã§ãããã¾ããè²ã ãã©ã¡ã¼ã¿å¼ã£ããã¢ã«ã´ãªãºã å¤ãã¦ç»åã好ãã«å¼ããã®ãèªä½ã½ããã®å¼·ã¿ã¨ãããã¨ã§ï¼
ãããã
ãæ°ãåãããã¢ã«ã´ãªãºã ããã©ã¡ã¼ã¿æ¹è¯ãã¦ãè²ããªåçã§è©¦ãã¦ã¿ããããªã¨ãç®æã追ãè¶ãPhotomatixï¼ãã©ãããã¯ãã¼ã³ï¼ã¿ãªãããç´ æµãªHDRç»åãã§ãããæãã¦ä¸ãããâ
ã½ã¼ã¹ã³ã¼ãã¨ä½¿ãæ¹
ãã½ã¼ã¹ã³ã¼ãå
¬éãã¾ãããã¤ãã®éãProcessingã¨ããããã°ã©ã è¨èªä½¿ã£ã¦ãã¾ããæã£åãæ©ãç¡æHDRç»åä½æã½ãã欲ãã人ã¯ãProcessingã¤ã³ã¹ãã¼ã«ãã¦ãããã³ãããã¦RUNãã¦ä¸ãããè«æçã®å
容ãã使ã£ã¦ãªãã®ã§ãç¹è¨±ã¨ãã¯ç¹ã«å¤§ä¸å¤«ãªã¯ãã
ãå®è¡ããã¨ããã¡ã¤ã«ãã¤ã¢ãã°ãéãã®ã§ãæãã®åçãæ®éã®åçãæããã®åçã®é ã«èªã¿è¾¼ã¾ãã¦ä¸ããããã°ããå¾
ã¤ã¨HDRç»åãåºæ¥ä¸ããã®ã§ããpããã¿ã³ãæ¼ãã¨ä¿åã§ãã¾ããã¹ãã¼ã¹ãã¼ã§çµäºã§ãã
ããã©ã¡ã¼ã¿ã¯ scopeããã¼ã³ãããã³ã°ã®ã¨ããè¼åº¦æ±ããã®ã«ä½¿ãå¨å²ã®ãã¯ã»ã«ã®ç¯å²ã§ããscopeã大ããããã¨ææ°é¢æ°çã«å¦çæéã大ãããªãã®ã§ããã®å ´åã¯ãscope_speedã¨average_speedã®2ã¤ã大ããããã¨é«éåã§ãã¾ããscope_speedã¯1ããscopeã®åå以ä¸ã®å¤ã§ãaverage_speedã¯0ããç»åã®æ¨ªãµã¤ãºã¾ã§ã®å¤§ããã§æå®ãã¦ä¸ãããaã¯ãã¼ã³ãããã³ã°ã«ä½¿ç¨ãããã©ã¡ã¼ã¿ã§å¤§ããããã»ã©æãããªãã¾ããçè«çã«ã¯0.18ãæ¨æºãããã§ãã
ãgamma_u, gamma_n, gamma_oã¯ããããHDRåæããã¨ãã®ãæãã®åçãæ®éã®åçãæããã®åçã«å¯¾ããã¬ã³ãè£æ£å¤ã§ãã好ãã«å¼ã£ã¦ä¸ãããcolor_gainã¯è²ã®ã²ã¤ã³ã§ããã好ã¿ã§è¨å®ãã ãããã¨ãããã1ã«ãã¦ããã®ãããããããã¾ããã
PImage img0; PImage img1; PImage img2; float lum; float lum_sum; int sum_numb; final int scope = 50; // 1 to picture width final int scope_speed = 5; // 1 to scope final int average_speed = 2; // 0 to picture width final float a = 0.27; final float gamma_u = 0.5; final float gamma_n = 1; final float gamma_o = 0.5; final float color_gain = 3.2; final float delta = 0.01; float[] lut_u = new float[256]; float[] lut_n = new float[256]; float[] lut_o = new float[256]; void setup() { size(100, 100); println("select under exposed photo."); String imgPath = selectInput(); img0 = loadImage(imgPath); println("select proper exposed photo."); imgPath = selectInput(); img1 = loadImage(imgPath); println("select over exposed photo."); imgPath = selectInput(); img2 = loadImage(imgPath); size(img0.width, img0.height); for (int i = 0; i < 256; i++){ lut_u[i] = 255*pow(((float)i/255),(1/gamma_u)); } for (int i = 0; i < 256; i++){ lut_n[i] = 255*pow(((float)i/255),(1/gamma_n)); } for (int i = 0; i < 256; i++){ lut_o[i] = 255*pow(((float)i/255),(1/gamma_o)); } } void draw(){ image(img0, 0, 0); // Making HDRImage----- float[] hdr_img_r = new float[img0.height*img0.width]; float[] hdr_img_g = new float[img0.height*img0.width]; float[] hdr_img_b = new float[img0.height*img0.width]; img0.loadPixels(); img1.loadPixels(); img2.loadPixels(); for(int i = 0; i < img0.width*img0.height; i++){ color tmp_color0 = img0.pixels[i]; color tmp_color1 = img1.pixels[i]; color tmp_color2 = img2.pixels[i]; hdr_img_r[i] = lut_u[(int)red(tmp_color0)] + lut_n[(int)red(tmp_color1)] + lut_o[(int)red(tmp_color2)]; hdr_img_g[i] = lut_u[(int)green(tmp_color0)] + lut_n[(int)green(tmp_color1)] + lut_o[(int)green(tmp_color2)]; hdr_img_b[i] = lut_u[(int)blue(tmp_color0)] + lut_n[(int)blue(tmp_color1)] + lut_o[(int)blue(tmp_color2)]; hdr_img_r[i] = hdr_img_r[i]/3*color_gain; hdr_img_g[i] = hdr_img_g[i]/3*color_gain; hdr_img_b[i] = hdr_img_b[i]/3*color_gain; } //----Making HDRImage //ToneMapping---- color[] tmp_img = new color[img0.height*img0.width]; int tmp = average_speed; float lum_sum_w = 0; for(int y = 0; y < img0.height; y++){ tmp = average_speed; for(int x = 0; x < img0.width; x++){ int pos = x + y*img0.width; lum_sum = 0; sum_numb = 0; tmp++; if(tmp > average_speed){ tmp = 0; for(int y_2 = y-scope; y_2 < y+scope; y_2 += scope_speed){ for(int x_2 = x-scope; x_2 < x+scope; x_2 += scope_speed){ if(y_2 >= 0 && y_2 < img0.height && x_2 >=0 && x_2 < img0.width){ if(sqrt((x_2-x)*(x_2-x)+(y_2-y)*(y_2-y)) <= scope){ sum_numb++; int pos_2 = x_2 + y_2*img0.width; lum_sum += log((0.3*hdr_img_r[pos_2] + 0.59*hdr_img_g[pos_2] + 0.11*hdr_img_b[pos_2])/256+delta); } } } } lum_sum_w = exp(lum_sum/(float)sum_numb); } float lum = 0.3*hdr_img_r[pos] + 0.59*hdr_img_g[pos] + 0.11*hdr_img_b[pos]; float u = -0.17*hdr_img_r[pos] - 0.33*hdr_img_g[pos] + 0.5*hdr_img_b[pos]; float v = 0.5*hdr_img_r[pos] -0.42*hdr_img_g[pos] - 0.08*hdr_img_b[pos]; float lum_w = lum/lum_sum_w*a; float r = lum_w + 1.4*v; float g = lum_w -0.34*u -0.71*v; float b = lum_w + 1.77*u; tmp_img[pos] = color(r,g,b); } } for(int y = 0; y < img0.height; y++){ for(int x = 0; x < img0.width; x++){ int pos = x + y*img0.width; set(x, y, tmp_img[pos]); } } } void keyPressed() { // save image if(key == 'p' || key == 'P') { save("screenshot.jpg"); println("screen saved."); } // exit if(key == ' ') { exit(); } }
åè
ãHDR合成に関する論文ã
ãæãèªã¿ããã ãã§ããHDRåæã¯è¶³ãç®ããã ãã§ã¯é§ç®ã¨æ°ã¥ããã¦ããã¾ããã
ãトーンマッピングの論文ã
ãä¸çªä¸ã®ãªã³ã¯ã§è«æãèªãã¾ããè±èª
ã日本語の論文ã
ãä¸è¨ã®è«æããã¼ã¹ã«å°ã工夫ããææ³ãè«æã«ãã¦ããã£ã½ãã§ãã
é¢é£è¨äº
ãProcessingを使ってHDRフォト作成ソフト自作にチャレンジ 〜トーンマッピングの奥深い世界〜ã
ãデジタル一眼で四日市工場夜景撮影 〜レッツエロティック〜ã