Transpose and reshape - is there a more elegant / relevant way to do the following? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Working with Gaussian filter in frequency domain + MatlabTranspose and reshape a 3d array in matlabmatrix inside matrix when multiplying symbolic matricesFiltering in Frequency DomainFast celllarray by matrix multiplicationMatlab : Reshaping Matrix to separate matricesChange the size of matrix?Efficient way to reshape (alternately) thousands of dataHow to address the following error “To RESHAPE the number of elements must not change”?Transform image via a given matrix using OpenCv
Can two people see the same photon?
Nose gear failure in single prop aircraft: belly landing or nose-gear up landing?
What is the difference between a "ranged attack" and a "ranged weapon attack"?
Simple HTTP Server
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
Why not use the yoke to control yaw, as well as pitch and roll?
In musical terms, what properties are varied by the human voice to produce different words / syllables?
Is there any word for a place full of confusion?
How does TikZ render an arc?
Trying to understand entropy as a novice in thermodynamics
A proverb that is used to imply that you have unexpectedly faced a big problem
Is there public access to the Meteor Crater in Arizona?
Co-worker has annoying ringtone
How do living politicians protect their readily obtainable signatures from misuse?
New Order #6: Easter Egg
Can humans save crash-landed aliens?
Relating to the President and obstruction, were Mueller's conclusions preordained?
Did pre-Columbian Americans know the spherical shape of the Earth?
My mentor says to set image to Fine instead of RAW — how is this different from JPG?
Sally's older brother
Is it possible for SQL statements to execute concurrently within a single session in SQL Server?
Why BitLocker does not use RSA
Tannaka duality for semisimple groups
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Transpose and reshape - is there a more elegant / relevant way to do the following?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Working with Gaussian filter in frequency domain + MatlabTranspose and reshape a 3d array in matlabmatrix inside matrix when multiplying symbolic matricesFiltering in Frequency DomainFast celllarray by matrix multiplicationMatlab : Reshaping Matrix to separate matricesChange the size of matrix?Efficient way to reshape (alternately) thousands of dataHow to address the following error “To RESHAPE the number of elements must not change”?Transform image via a given matrix using OpenCv
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Here I am trying to multiply the r g b data of this image by a 3x3 matrix.
fil=size(image,1);
col=size(image,2);
N = fil * col;
primaries = reshape(image, N, 3);
primaries = primaries';
% modification
primaries = primaries';
result = reshape(primaries, fil, col, 3);
matlab
add a comment |
Here I am trying to multiply the r g b data of this image by a 3x3 matrix.
fil=size(image,1);
col=size(image,2);
N = fil * col;
primaries = reshape(image, N, 3);
primaries = primaries';
% modification
primaries = primaries';
result = reshape(primaries, fil, col, 3);
matlab
Well, you could add the transpose into thereshape
line, if that helps any. Anything beyond that depends on what you're doing in% modification
.
– beaker
Mar 8 at 23:51
Thank you beaker. I'm multiplying the r g b data by a 3x3 color matrix transform to change the gamut of the image. I would have thought there's a simpler way to do that by taking the image file in it's normal form of x by y by color format and multiplying it by the 3x3 matrix using indexing like [1 0 0; 0 1 0; 0 0 1] * image(:,:,1);. Forgive my novice question!
– Brett Harrison
Mar 9 at 0:00
Your approach looks fine to me. Maybe somebody else will have a better idea.
– beaker
Mar 9 at 0:05
add a comment |
Here I am trying to multiply the r g b data of this image by a 3x3 matrix.
fil=size(image,1);
col=size(image,2);
N = fil * col;
primaries = reshape(image, N, 3);
primaries = primaries';
% modification
primaries = primaries';
result = reshape(primaries, fil, col, 3);
matlab
Here I am trying to multiply the r g b data of this image by a 3x3 matrix.
fil=size(image,1);
col=size(image,2);
N = fil * col;
primaries = reshape(image, N, 3);
primaries = primaries';
% modification
primaries = primaries';
result = reshape(primaries, fil, col, 3);
matlab
matlab
asked Mar 8 at 23:33
Brett HarrisonBrett Harrison
83
83
Well, you could add the transpose into thereshape
line, if that helps any. Anything beyond that depends on what you're doing in% modification
.
– beaker
Mar 8 at 23:51
Thank you beaker. I'm multiplying the r g b data by a 3x3 color matrix transform to change the gamut of the image. I would have thought there's a simpler way to do that by taking the image file in it's normal form of x by y by color format and multiplying it by the 3x3 matrix using indexing like [1 0 0; 0 1 0; 0 0 1] * image(:,:,1);. Forgive my novice question!
– Brett Harrison
Mar 9 at 0:00
Your approach looks fine to me. Maybe somebody else will have a better idea.
– beaker
Mar 9 at 0:05
add a comment |
Well, you could add the transpose into thereshape
line, if that helps any. Anything beyond that depends on what you're doing in% modification
.
– beaker
Mar 8 at 23:51
Thank you beaker. I'm multiplying the r g b data by a 3x3 color matrix transform to change the gamut of the image. I would have thought there's a simpler way to do that by taking the image file in it's normal form of x by y by color format and multiplying it by the 3x3 matrix using indexing like [1 0 0; 0 1 0; 0 0 1] * image(:,:,1);. Forgive my novice question!
– Brett Harrison
Mar 9 at 0:00
Your approach looks fine to me. Maybe somebody else will have a better idea.
– beaker
Mar 9 at 0:05
Well, you could add the transpose into the
reshape
line, if that helps any. Anything beyond that depends on what you're doing in % modification
.– beaker
Mar 8 at 23:51
Well, you could add the transpose into the
reshape
line, if that helps any. Anything beyond that depends on what you're doing in % modification
.– beaker
Mar 8 at 23:51
Thank you beaker. I'm multiplying the r g b data by a 3x3 color matrix transform to change the gamut of the image. I would have thought there's a simpler way to do that by taking the image file in it's normal form of x by y by color format and multiplying it by the 3x3 matrix using indexing like [1 0 0; 0 1 0; 0 0 1] * image(:,:,1);. Forgive my novice question!
– Brett Harrison
Mar 9 at 0:00
Thank you beaker. I'm multiplying the r g b data by a 3x3 color matrix transform to change the gamut of the image. I would have thought there's a simpler way to do that by taking the image file in it's normal form of x by y by color format and multiplying it by the 3x3 matrix using indexing like [1 0 0; 0 1 0; 0 0 1] * image(:,:,1);. Forgive my novice question!
– Brett Harrison
Mar 9 at 0:00
Your approach looks fine to me. Maybe somebody else will have a better idea.
– beaker
Mar 9 at 0:05
Your approach looks fine to me. Maybe somebody else will have a better idea.
– beaker
Mar 9 at 0:05
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072436%2ftranspose-and-reshape-is-there-a-more-elegant-relevant-way-to-do-the-followi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072436%2ftranspose-and-reshape-is-there-a-more-elegant-relevant-way-to-do-the-followi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Well, you could add the transpose into the
reshape
line, if that helps any. Anything beyond that depends on what you're doing in% modification
.– beaker
Mar 8 at 23:51
Thank you beaker. I'm multiplying the r g b data by a 3x3 color matrix transform to change the gamut of the image. I would have thought there's a simpler way to do that by taking the image file in it's normal form of x by y by color format and multiplying it by the 3x3 matrix using indexing like [1 0 0; 0 1 0; 0 0 1] * image(:,:,1);. Forgive my novice question!
– Brett Harrison
Mar 9 at 0:00
Your approach looks fine to me. Maybe somebody else will have a better idea.
– beaker
Mar 9 at 0:05