why reshape command is actually needed ?

why reshape command is actually needed in image segmentation

댓글 수: 4

John D'Errico
John D'Errico 2017년 12월 28일
편집: KSSV 2017년 12월 29일
Impossible to answer. Reshape is useful and even necessary in a huge number of places. In your case, it was apparently needed because an array was the wrong shape for the next procedure.
But if you really want a better answer, you need to tell people what you are doing, and far more clearly. ACTUALLY show the operation. Then tell us what shape the input was before the reshape.
Touhidul islam
Touhidul islam 2017년 12월 29일
In an image processing code ,one coder has converted 218 180 3 images to 39240 3 by using reshape . why he did this he hasn't explained.
reshape() to something by 3 would be done as preparation for clustering by color, since the clustering routines expect the variables to go across the columns and that each row is a different sample.
sorry , i couldnot understand what you have tried to say. Please, can you again explain?

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2017년 12월 29일

0 개 추천

reshape() is never mandatory. There is always a way to write for loops to copy the data into the desired new shape. reshape() is just fast and convenient.
Star Strider
Star Strider 2018년 1월 1일

0 개 추천

@Touhidul islam
With the later advantage of being able to see what are apparently the entire code, what you describe is the ‘F’ matrix, formed by reshaping an image. The purpose (from the code you posted earlier today in Can anyone help me out with the following code ? (link)) appears to be to provide an easy reference for replacing NaN values by a specific random row of ‘F’ later in the code.
It would be of significant benefit to us if you would post all the relevant code so we can see it and provide you with the information you want.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2017년 12월 28일

답변:

2018년 1월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by