资源简介
使用Matlab给灰度图像上色的 Gray2RGB 函数,需要额外提供一张配色接近的图片。
该原始算法源于Jeny Rajan , Chandrashekar,但其运行速度过慢,我做了一些Matlab特有的小优化,大大提高了运行速度。
该原始算法源于Jeny Rajan , Chandrashekar,但其运行速度过慢,我做了一些Matlab特有的小优化,大大提高了运行速度。
代码片段和文件信息
function R=gray2rgb(img1img2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This Program converts a gray image ro RGB image based on the colors of the destination image. The better the destination image match with the source gray image the better the coloring will be. The program takes some time as the searching time is high. You can decrease the searching time by taking only samples from the used color image but quality may decrease. U can use jittered sampling for improving running speed. %
% You can use also use the attahed test images Use the following combinations for better result nature1.jpg(as img1) and nature2.jpg(as img2) or test1.jpg(as img1) and test2.jpg (as img2) %
% Usage: gray2rgb(‘nature1.jpg‘‘nature2.jpg‘); %
% Authors : Jeny Rajan Chandrashekar P.S %
% 鄙人做了一点微小的优化。 P.S %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% img1 - Source Image (gray image)
% img2 - Selected color image for coloring the gray image.
%% 导入
tic;clc;
warning off;
imG=imread(img1);
imR=imread(img2);
[txtytz]=size(imG);
[sxsysz]=size(imR);
if tz~=1
imG=rgb2gray(imG);
end
imG(::2)=imG(::1);
- 上一篇:蝙蝠算法BA代码
- 下一篇:根据亮度分布检测火焰
相关资源
- Pattern Recognition and Machine Learning(高清
- MATLAB 编程 第二版 Stephen J. Chapman 著
- 均值滤波和FFT频谱分析Matlab代码
- 《MATLAB扩展编程》代码
- HDB3码、AMI码的MATLAB实现
- 3点GPS定位MATLAB仿真
- MATLAB数字信号处理85个实用案例精讲入
- matlab从入门到精通pdf94795
- 欧拉放大论文及matlab代码
- 跳一跳辅助_matlab版本
- 全面详解LTE MATLAB建模、仿真与实现
- MIMO-OFDM无线通信技术及MATLAB实现_孙锴
- MATLAB Programming for Engineers 4th - Chapman
- matlab 各种谱分析对比
- 分数阶chen混沌matlab程序
- 基于粒子群算法的非合作博弈的matl
- MATLAB车流仿真 包括跟驰、延误
- matlab空间桁架计算程序
- 基于MATLAB的图像特征点匹配和筛选
- DMA-TVP-FAVAR
- GPS信号的码捕获matlab代码.7z
- 一维光子晶体MATLAB仿真代码吸收率折
- newmark法源程序
- 传统关联成像、计算鬼成像matlab
- pri传统分选算法
- 摆动滚子推杆盘形凸轮设计
- 医学图像重建作业matlab源码
- Matlab实现混沌系统的控制
- 检测疲劳驾驶
- Matlab锁相环仿真-Phase Locked Loop.rar
评论
共有 条评论