Converting 2-D array back to image??
이전 댓글 표시
I am trying to apply a neural network that was trained on 2-D array data extracted from an image. I can successfully apply the trained network to the original image (2441,758,21) if I convert it to 2-D array (rows,columns*bands) = (2441,15918) then using cca fusion the band information is fused to a single band (2441,1) and used as the input data for the network. The resulting predicted values 't_img' are the shape (2441,1). How can this be mapped back to an image for display?
% reshape to 2-D array
img = reshape(im,2114,758*21);
normData = mapminmax(img);
TrainingData = normData(1:1000,1:end);
TestingData = normData(1001:end,1:end);
x = TrainingData(:,2:end);
y = TrainingData(:,7000);
y1 = TestingData(:,7001);
% Feature Fusion CCA %
[trainZ,testZ] = ccaFuse(x, y, TestingData(:,2:end), y1, 'sum');
trainZ = transpose(trainZ);
testZ = transpose(testZ);
t_img = [trainZ testZ];
% import trained network from file
y_img = net(t_img);
댓글 수: 4
Guillaume
2018년 11월 12일
Normally an image is either greyscale, in which case it is stored as 2D array Height x Width, or RGB in which case it is stored as a 3D array Height x Width x 3 whose 3rd dimension represen the colour channels (one Red, one Green and one Blue channel). Sometimes you can have a 4th Channel/band for transparency. So, what are your 21 channels?
It looks like your fusing loses more than the bands. It seems you've also fused the columns, leaving you with just one column. As such, there's not much left to display: just one column of an image.
Stephen23
2018년 11월 12일
Kyle Peterson
2018년 11월 12일
Guillaume
2018년 11월 12일
Well, as I said, in your result, not only have you fused the 21 bands, but you've also fused the 758 columns of the image, leaving you with just one column, so what would you display? Just that one column?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Pattern Recognition에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!