Display rgb image in cartesian plane
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
marie lasz
el 14 de Oct. de 2020
Comentada: Bjorn Gustavsson
el 15 de Oct. de 2020
hello,
Can we display transformed image in cartesian plane according to image's rotation or shear? iF yes, then how can we do this?(I want to display a rgb image not its color pixels )
Any help would be appreciated.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/380818/image.png)
0 comentarios
Respuesta aceptada
Más respuestas (2)
Image Analyst
el 14 de Oct. de 2020
Did you try view() -- I think that will do what you want.
Or else try Steve's blog:
or else do something like this:
% Takes an RGB image and stacks the separate color channels at different Z levels.
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 13;
filename = 'peppers.png';
rgbImage = imread(filename);
% Extract the individual red, green, and blue color channels.
redChannel = im2double(rgbImage(:, :, 1));
greenChannel = im2double(rgbImage(:, :, 2));
blueChannel = im2double(rgbImage(:, :, 3));
H(1) = slice(repmat(redChannel,[1 1 2]),[],[], 1); %slice() requires at least 2x2x2
set(H(1),'EdgeColor','none') %required so image isn't just an edge
hold on
H(2) = slice(repmat(greenChannel,[1 1 2]),[],[], 2); %slice() requires at least 2x2x2
set(H(2),'EdgeColor','none') %required so image isn't just an edge
H(3) = slice(repmat(blueChannel,[1 1 3]),[],[], 3); %slice() requires at least 2x2x2
set(H(3),'EdgeColor','none') %required so image isn't just an edge
hold off
colormap(gray(256))
axis ij
caption = sprintf('R, G, and B Color Channels of %s', filename);
title(caption, 'FontSize', fontSize);
% Put up legend that says what slice is what color channel.
legend('B', 'G', 'R')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/380863/image.png)
4 comentarios
Bjorn Gustavsson
el 15 de Oct. de 2020
That is just a convention-confusion, tcolor uses the same convention that pcolor uses, displayin the matrix-element M(1,1) in the lower-left-corner, and matrix-element M(N1,1) in the upper-left-corner, while image, imagesc and imshow display the matrices with M(1,1) in the upper-left-corner and M(N1,1) in the lower-left-corner. This you can change by either a simple: axis ij or flipping the image with flipdim, or flipping the dimensions on your x and y coordinate matrices. Or this is perhaps the "geographic" orientation your image should have if you've determined the x and y coordinates of your pixels.
HTH
Image Analyst
el 15 de Oct. de 2020
You can simply open the properties window of the axes and set the viewing property to manual, and then use the tools above the axes to tilt and spin your image around. Then you can use the "File->Generate Code" pulldown menu of the figure to generate the code if you want to do that all the time instead of interactively each time. Here is a screenshot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/381838/image.png)
1 comentario
Bjorn Gustavsson
el 15 de Oct. de 2020
Since the OP showed an example with multiple skew-transformed versions of an image it seems to be more on-target to use tcolor since that is a pcolor-modification with RGB-handling abilities.
Ver también
Categorías
Más información sobre Explore and Edit Images with Image Viewer App en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!