필터 지우기
필터 지우기

multi channel Image reconstruction

조회 수: 2 (최근 30일)
MD RESHAD UL HOQUE
MD RESHAD UL HOQUE 2017년 10월 27일
편집: Walter Roberson 2017년 10월 27일
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에서 Images에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by