Effacer les filtres
Effacer les filtres

multi channel Image reconstruction

2 vues (au cours des 30 derniers jours)
MD RESHAD UL HOQUE
MD RESHAD UL HOQUE le 27 Oct 2017
How can I reconstruct an image from [3410, 33, 33, 8] sub-images?.
  3 commentaires
Walter Roberson
Walter Roberson le 27 Oct 2017
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 le 27 Oct 2017
Modifié(e) : Walter Roberson le 27 Oct 2017
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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by