How to set units of image of an array to pixels?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Anna
el 9 de Ag. de 2014
Comentada: Anna
el 18 de Ag. de 2014
I have a matrix (called V) of 1000*1000 random 0s and 1s. I want each 0 or 1 to be represented by a single pixel on the screen.
The command imagesc(V) makes each 0 or 1 a square which black(0) or white(1), how do I make each rectangle one pixel?
(I have made a color map for this, MAP = [0 0 0; 1 1 1]. If there was an easier way to make 0s appear black and 1s appear white, please let me know).
0 comentarios
Respuesta aceptada
Matz Johansson Bergström
el 9 de Ag. de 2014
Editada: Matz Johansson Bergström
el 9 de Ag. de 2014
2 comentarios
Image Analyst
el 9 de Ag. de 2014
That's fine if your figure only has one axes in it that takes up the whole figure. But what if you have 2 or 3 images on a figure. How do you set up one of them to be unit magnification?
bigImage = imread('concordorthophoto.png');
[rows, columns, numberOfColorChannels] = size(bigImage);
% First create some figure.
figure;
% Now create an axes in the upper left:
hAxes = subplot(2, 2, 1);
% Display the image in that axes
imshow(bigImage, 'InitialMagnification','fit')
cla reset;
imshow(bigImage, 'InitialMagnification', 100); % Doesn't work either
% Resize image to show image at its rows-by-column pixel size,
% one image pixel equals one screen pixel.
% Since the image is bigger than the axes, it should add scrollbars.
truesize(hAxes, [rows, columns])
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!