【问题标题】:MATLAB - translate colour image from fileMATLAB - 从文件中转换彩色图像
【发布时间】:2015-12-09 20:29:04
【问题描述】:

我有一个彩色 PNG 图像,我需要翻译它并绘制结果,它应该具有与原始图像相同的色阶。使用下面的代码,我得到一个灰度图像;你知道如何解决这个问题吗?谢谢!

[E_col, map_E] = imread('E.png');
shift_vert = 35; % 152
shift_hor = 30;
E_col_shift = zeros(size(E_col,1) + shift_vert, size(E_col,2) + shift_hor);
E_col_shift = imtranslate(E_col_shift,[shift_hor, shift_vert]);
figure; imshow(E_col_shift, map_E);

在这里你可以找到我正在使用的图片:

【问题讨论】:

  • 你能发布一个下载链接到你的图片吗?如果您在 SO 中发布,它将被转换为 jpg,更改代码的格式和行为(可能)。

标签: matlab plot png


【解决方案1】:

你有一个印刷错误:

% // This image is JUST ZEROES!!!!!!!!!!!!!!!!!!!!!!!!!!
E_col_shift = zeros(size(E_col,1) + shift_vert, size(E_col,2) + shift_hor);


%// So why are you translating the empthy image?!?!?!
E_col_shift = imtranslate(E_col_shift,[shift_hor, shift_vert]);

%// It should be the original image!!!!!
E_col_shift = imtranslate(E_col,[shift_hor, shift_vert]);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-11
    • 2010-12-19
    • 2011-04-29
    • 2016-01-11
    • 2013-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多