double matrix to image conversion
조회 수: 67 (최근 30일)
이전 댓글 표시
i have a double matrix i have to convert it to an image
댓글 수: 0
답변 (2개)
Cris LaPierre
2020년 1월 31일
How are you trying to view the image?
I suspect you need to use uint8 to first convert your doubles to a value between 0 and 255. See here.
Subhadeep Koley
2020년 2월 1일
Hi, try the code below
% Rescale your matrix in 0-255 range
rescaledMatrix = rescale(yourDoubleMatrix, 0, 255);
% Typecasted to uint8
rescaledMatrix = uint8(rescaledMatrix);
% Display your image
figure; imshow(rescaledMatrix, []);
This might help!
댓글 수: 8
Subhadeep Koley
2020년 2월 1일
The "q" is generated from "c1" by your algorithm only. Therefore it is not possible for me to comment on how this can be solved.
The code for the 3D scatter plot is below.
close all; clear all;
load q.mat;
r = q(:,:,1);
g = q(:,:,2);
b = q(:,:,3);
plot3(r(:),g(:),b(:),'.');
grid on; box on;
xlabel('Red Channel');
ylabel('Green Channel');
zlabel('Blue Channel');
title('Scatterplot of the Visible Bands');
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!