Effacer les filtres
Effacer les filtres

I have a problème when i use the function reshape if you can help me or get me another equal function

1 vue (au cours des 30 derniers jours)
message=reshape(message(Mn*Mc,1)./256);
this following error will always apear:
to reshape an image the number of elements must not change
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 5 Avr 2016
Your question is not clear. What is the size of your original matrix? What is the size of the expected result?

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 5 Avr 2016
What are the rows and columns in the "message" image? Are the number of rows exactly equal to Mn*Mc? If so, then message(Mn*Mc,1) refers to the last pixel in the first column of message. So you're trying to reshape that single value. However, you don't even give any new number of rows and columns. For it to even work, you'd have to have two additional inputs of 1,1 to reshape:
message=reshape(message(Mn*Mc,1)./256, 1, 1);
But reshaping a scalar to be a scalar again will just give the very same scalar value (again, the last value in the first column).
Perhaps do you want to resize the image? Like
newMessage = imresize(message, newRows, newColumns);

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by