Info
この質問は閉じられています。 編集または回答するには再度開いてください。
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
hello every one, i'am a newbie, i have a error ? how can i fix it ???
1 回表示 (過去 30 日間)
古いコメントを表示
13 件のコメント
Walter Roberson
2020 年 6 月 8 日
Your posted code has reshape(w1,128,2) which would require that w1 had exactly 128*2 = 256 elements in it.
The error message is for reshape(w1,128,3) which would require that w1 had exactly 128*3 = 384 elements in it.
The 3 hints at RGB, but w1 is not RGB: it is the result of im2bw() and so is class logical.
Since it is black and white, 2 classes, that hints that the 2 in reshape(w1,128,2) might be referring to the number of expected classes, possibly.
Join Snow
2020 年 6 月 8 日
when I changed the input image file it reported the same error, but if the default is not the original error
Join Snow
2020 年 6 月 8 日
clc
clear all
close all
warning off
%% audio input
ok_classical=0; % 1 selected 0 not-selected 1 t?c là ch?n , 0 là không ch?n
ok_jazz=0;
ok_pop=0;
ok_looney=1;
if ok_classical
[y,Fs] = audioread('classical.wav');
end
if ok_jazz
[y,Fs] = audioread('jazz.wav');
end
if ok_pop
[y,Fs] = audioread('pop.wav');
end
if ok_looney
[y,Fs] = audioread('Song-Gio-Huong-Ly.wav');
end
x1=y(1:262144);
x1=reshape(x1,1,262144);
figure
plot(x1)
title('Host Audio')
xlabel(' Thoi gian (Mau)');
ylabel('Bien do');
x=reshape(x1,512,512);
Key=7;
[L1, L2]=size(x);
%% image input chuy?n ?nh màu v? ?nh xám
img = imread('unnamed.jpg'); %Get the input image, ?nh c?n ??a vào
I = rgb2gray(img);
po=im2bw(I);
w1=im2bw(I);%Convert to grayscale image chuy?n v? ?nh thang ?? xám
figure
imshow(w1)
%% cyclic code encoding// mã hóa theo chu kì
w1=reshape(w1,128,2);
n = 3; k = 2; % A (3,2) cyclic code
code1 = encode(double(w1),n,k,'cyclic/binary'); % 2 level of encoding
code2 = encode(code1(:,1:2),n,k,'cyclic/binary');
code3 = encode(code1(:,2:3),n,k,'cyclic/binary');
part1=reshape(code2(:,1:2),128,2);
part2=reshape(code2(:,2:3),128,2);
part3=reshape(code3(:,1:2),128,2);
part4=reshape(code3(:,2:3),128,2);
a1=horzcat(part1,part2);
b1=horzcat(part3,part4);
z=vertcat(a1,b1);
w1=reshape(z,32,32);
%% Arnold Scrambling with Key
w1=arnold(w1,Key);
%% 3 level of DWT decomposition with HAAR wavelet
[L,H,V,D]=dwt2(x,'haar','sym');
[CL,CH,CV,CD]=dwt2(H,'haar','sym');
[CA1,CA2,CA3,CA4]=dwt2(CH,'haar','sym');
for i=1:16
a(i)=4;
end
for i=1:16
b(i)=4;
end
%% DCT of sub-band block CH->CA2
newCA2=mat2cell(CA2,a,b);
d=zeros(64,64);
nCA2=mat2cell(d,a,b);
for i=1:16
for j=1:16
nCA2{i,j}=dct2(newCA2{i,j});
end
end
Walter Roberson
2020 年 6 月 8 日
We do not have your 'unnamed.jpg' file, so we do not know how big img is.
You need to run the code and tell us what size(w1) is when the code stops running.
Or you can attach unnamed.jpg or CW16.jpg for us to be able to find out ourselves what the size is.
Walter Roberson
2020 年 6 月 8 日
For the original CW16.jpg, then reshape(w1,128,2) works for me as w1 does have exactly 256 elements, as the img is 16 x 16.
However, unknown.jpg is 562 by 1679 and so has no chance of being reshaped to 128 x 2. If you were to try to resize it to 16 x 16 first, it would be unreadable.
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)