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;








0















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);









share|improve this question






















  • 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

















0















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);









share|improve this question






















  • 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













0












0








0








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);









share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 23:33









Brett HarrisonBrett Harrison

83




83












  • 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

















  • 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
















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












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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support 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!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved