资源简介
利用MATLAB对图像进行HDR处理方法。
代码片段和文件信息
% Taylor Johnson
% Sarah McGee
% Robert Ortman
% Tianhe Yang
% ELEC301
% Project - HDR Image Creation Algorithms
% 2006-12-10
%hdriCreating Creates an HDR image
%param algorithm: string algorithm to use
%param fileNPre: base file name prefix
%param fileNSuf: base file name suffix
%param startIndx: index to start at
%param N: number of input images
function [mRed mGreen mBlue] = hdriCreating(algorithm algorithmParam fileNPre fileNSuf startIndx N)
bitrate = algorithmParam(1);
%iterate over input images
for (i=startIndx:N)
%read the ith image: expects filenames like img001.jpg img002.jpg img003.jpg ...
strNum = strcat(floor(i/100) + ‘0‘ floor(i/10) + ‘0‘ mod(i10) + ‘0‘);
[imgData imgMap] = imread(strcat(fileNPre strNum fileNSuf));
[x y z] = size(imgData);
reds(::i-startIndx+1) = imgData(::1);
greens(::i-startIndx+1) = imgData(::2);
blues(::i-startIndx+1) = imgData(::3);
end
switch lower(algorithm)
case {‘createaverage‘}
[imgRed imgGreen imgBlue] = createAverage(reds greens blues bitrate);
case {‘createweighted‘}
[imgRed imgGreen imgBlue] = createWeighted(reds greens blues bitrate);
case {‘createupsample‘}
[imgRed imgGreen imgBlue] = createRandomUpsample(reds greens blues bitrate);
case {‘createpiece‘}
[imgRed imgGreen imgBlue] = createPiece(reds greens blues bitrate);
otherwise
[imgRed imgGreen imgBlue] = createAverage(reds greens blues bitrate);
end
%we‘ll return the composite matrix at this point
mRed = imgRed;
mGreen = imgGreen;
mBlue = imgBlue;
end
%createAverage
%Divides each images‘ color data by the total number of images and adds them
%together so each part of each image is given equal weight
function [mRed mGreen mBlue] = createAverage(reds greens blues bitrate)
[x y N] = size(reds);
%set up output matrices
pixels = x*y;
imgRed = double(zeros(xy));
imgGreen = double(zeros(xy));
imgBlue = double(zeros(xy));
%iterate over input images
for (i=1:N)
%add luminance values from ith image to running total
imgRed = imgRed + (double(reds(::i)).*(2^bitrate) ./ (N));
imgGreen = imgGreen + (double(greens(::i)).*(2^bitrate) ./ (N));
imgBlue = imgBlue + (double(blues(::i)).*(2^bitrate) ./ (N));
end
%return the result
mRed = imgRed;
mGreen = imgGreen;
mBlue = imgBlue;
end
%createWeighted
%Weights each images‘ color
function [mRed mGreen mBlue] = createWeighted(reds greens blues bitrate)
[x y N] = size(reds);
%set up output matrices
pixels = x*y;
imgRed = (zeros(xy));
imgGreen = (zeros(xy));
imgBlue = (zeros(xy));
bitrateDefault = 8;
%iterate over input images to find average and
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8769 2006-12-14 00:25 hdriCreating.m
文件 3806 2006-12-14 00:44 hdriMain.m
文件 2865 2006-12-13 22:55 hdriTest.m
文件 21950 2006-12-13 23:20 hdriToneMapping.m
目录 0 2006-12-21 01:36 images\
文件 308217 2006-12-13 04:18 images\belg001.jpg
文件 353702 2006-12-13 04:18 images\belg002.jpg
文件 411739 2006-12-13 04:18 images\belg003.jpg
文件 457056 2006-12-13 04:18 images\belg004.jpg
文件 516290 2006-12-13 04:18 images\belg005.jpg
文件 543131 2006-12-13 04:18 images\belg006.jpg
文件 554866 2006-12-13 04:18 images\belg007.jpg
文件 556535 2006-12-13 04:18 images\belg008.jpg
文件 534141 2006-12-13 04:19 images\belg009.jpg
文件 516226 2006-12-13 04:20 images\cathedral001.jpg
文件 95057 2006-12-13 04:39 images\cathedral001s.jpg
文件 729468 2006-12-13 04:20 images\cathedral002.jpg
文件 106042 2006-12-13 04:39 images\cathedral002s.jpg
文件 70582 2006-12-13 04:26 images\chairs001.jpg
文件 99272 2006-12-13 04:26 images\chairs002.jpg
文件 111318 2006-12-13 04:26 images\chairs003.jpg
文件 126837 2006-12-13 04:26 images\chairs004.jpg
文件 121237 2006-12-13 04:26 images\chairs005.jpg
文件 114287 2006-12-13 04:24 images\door001.jpg
文件 116826 2006-12-13 04:24 images\door002.jpg
文件 84614 2006-12-13 04:24 images\door003.jpg
文件 37021 2006-12-13 04:24 images\door004.jpg
文件 18918 2006-12-13 04:25 images\door005.jpg
文件 14567 2006-12-13 04:25 images\door006.jpg
文件 30579 2006-11-20 03:28 images\ebony001s.jpg
文件 34853 2006-11-20 03:28 images\ebony002s.jpg
............此处省略222个文件信息
相关资源
-
matlab7.0simuli
nk6.0的建模仿真开发与高 -
MATLAB_SIMUli
nk与液压控制系统仿真_宋 - 系统辨识理论及MATLAB仿真 刘金琨 部分
- MATLAB遗传算法工具箱及应用(第二版
- 13811540_卡尔曼滤波原理及应用MATLAB仿
- 精通MATLAB最优化计算书籍+源码
- 滑模变结构控制MATLAB仿真(第3版)
-
simuli
nk模块介绍 - 帧差法实现目标跟踪的Matlab代码
- Matlab模拟的电磁学时域有限差分法电
- SAR signal processing with MATLAB 书籍 对应代
- 控制数学问题的MATLAB求解
- Deep Learning 经典文章代码matlab
- Matlab反卷积和信号复原(邹谋炎)
- 基于ORL库和PCA方法的人脸识别系统m
- synthetic aperture radar signal processing wit
- 基于图像块低秩性的修复matlab代码
- 卡尔曼滤波器的原理以及在matlab中的
- Matlab深度学习工具箱160725
- 机器人控制系统的设计与MATLAB仿真p
- MATLAB+M语言高级编程
- DSP程序开发——MATLAB调试及直接目标
- 利用dbn+nn实现手写数字识别
- 通信天线建模与MATLAB仿真分析
- PnP位姿估计matlab工具包
- 卡尔曼滤波原理及应用:MATLAB仿真.
- 最先提出深度学习算法hinton的自动编
- 现代永磁同步电机控制原理及MATLAB仿
- MATLAB优化算法案例分析与应用案例及
- 运动模糊图像盲恢复程序matlab版
评论
共有 条评论