??? Index exceeds matrix dimensions.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Amit
el 27 de En. de 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 comentarios
Amit
el 27 de En. de 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.
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!