multi channel Image reconstruction

2 次查看(过去 30 天)
How can I reconstruct an image from [3410, 33, 33, 8] sub-images?.
  3 个评论
Walter Roberson
Walter Roberson 2017-10-27
How were the parts arranged relative to each other?
Do you currently have an numeric matrix, or do you have cell arrays?
MD RESHAD UL HOQUE
MD RESHAD UL HOQUE 2017-10-27
编辑:Walter Roberson 2017-10-27
Here it is a pansharpening project where two images (single channel image, 8 channel image) are merged to make a new image (8 channel). I crop sub-images from both images ( 1 channel and 8 channel ) and tiled it to feed CNN for training. It is an image restoration problem (regression problem). After training, I tested it and model gave desired 8 channel sub-images [3410, 33, 33, 8]. Now I have to reconstruct an image from sub-images.
This is how I extract sub-images(Code)
load('D:\keras-program\practice\MS_data.mat') %load image
image=M;
g=size(image,3);
%%settings sub-image dimension according to requirement
size_input = 33;
size_label = 21;
scale = 4;
stride = 14;
%%initialization
data = zeros(size_input, size_input, 1, 1);
label = zeros(size_label, size_label, 1, 1);
padding = abs(size_input - size_label)/2;
count = 0;
%%generate data
im_label = modcrop(image, scale);
%%%%%%%%%%%%%%%%%%
function imgs = modcrop(imgs, modulo)
if size(imgs,3)==1
sz = size(imgs);
sz = sz - mod(sz, modulo);
imgs = imgs(1:sz(1), 1:sz(2));
else
tmpsz = size(imgs);
sz = tmpsz(1:2);
sz = sz - mod(sz, modulo);
imgs = imgs(1:sz(1), 1:sz(2),:);
end
%%%%%%%%%%%%%%%%%%%%%%%%%
[hei,wid] = size(im_label);
im_input = imresize(imresize(im_label,1/scale,'bicubic'),[hei,wid],'bicubic');
for x = 1 : stride : hei-size_input+1
for y = 1 :stride : wid-size_input+1
count=count+1;
for i = 1:1:g
subim_input = im_input(x : x+size_input-1, y : y+size_input-1, i);
subim_label = im_label(x+padding : x+padding+size_label-1, y+padding : y+padding+size_label-1);
data(:, :, i, count) = subim_input;
label(:, :, i, count) = subim_label;
end
end
end
order = randperm(count);
data = data(:, :, :, order);
label = label(:, :, :, order);
save('MS_reduce.mat', 'data', '-v7.3')
Now I am stuck to reconstruct an image. Any reference code or suggestion as I am new in this area.
Thanks

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by