??? Index exceeds matrix dimensions.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
displayDetectedBlocks('2.jpg',1,1,2) ??? Index exceeds matrix dimensions.
Error in ==> displayDetectedBlocks at 3 pos = pairsVec(booleanDistance==1,1:2);
CODE
function Jt = displayDetectedBlocks(It,blocks,booleanDistance,pairsVec)
pos = pairsVec(booleanDistance==1,1:2);
[m,n] = size(blocks);
[blockSize(1),blockSize(2)] = size(blocks{1,1}.intensity);
Jt = It;
for i=1:size(pos,1)
[K,L] = ind2sub([m,n],pos(i,1));
topLeftPel = blocks{K,L}.topLeftPixel;
Jt(topLeftPel(1):topLeftPel(1)+blockSize(1)-1,topLeftPel(2):topLeftPel(2)+blockSize(2)-1) = ones(blockSize(1),blockSize(2));
end
figure
subplot(121),imshow(It),xlabel('Tampered Image'),
subplot(122),imshow(Jt),xlabel('Potential Tampered Image')
0 Commenti
Risposte (1)
Amit
il 27 Gen 2014
The error is in line
pos = pairsVec(booleanDistance==1,1:2);
You entered displayDetectedBlocks('2.jpg',1,1,2) and the pairsVec is a scalar or 1X1 matrix. In the line where the error appars, you're trying to access pairsVec's 2nd column which does not exist. That why the error appears.
2 Commenti
Amit
il 27 Gen 2014
You can input pairVec as something like [2 2] That will atleast correct the current error.
However, if you input booleanDistance anything other than 1, it will throw an error again.
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!