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!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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 (한국어)