Display rgb image in cartesian plane

5 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Bjorn Gustavsson
Bjorn Gustavsson il 14 Ott 2020
Previously I've used: tcolor, with good results.
HTH
  3 Commenti
Bjorn Gustavsson
Bjorn Gustavsson il 15 Ott 2020
Possibly, I've used them interchangeably in this context.

Accedi per commentare.

Più risposte (2)

Image Analyst
Image Analyst il 14 Ott 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')
  4 Commenti
marie lasz
marie lasz il 15 Ott 2020
I used that but why the image is flipping ?
Bjorn Gustavsson
Bjorn Gustavsson il 15 Ott 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

Accedi per commentare.


Image Analyst
Image Analyst il 15 Ott 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:
  1 Commento
Bjorn Gustavsson
Bjorn Gustavsson il 15 Ott 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.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by