index exceeds matrix dimensions
이전 댓글 표시
I am tring to code the parallelogram haar like features and while calculating the sum of intensities in the parallelogram region I get this error.
labeledImage = bwlabel(TP1);
measurements = regionprops(labeledImage, 'BoundingBox');
allBB = zeros(length(measurements), 4);
for k = 1 : length(measurements)
thisBB = round(measurements(k).BoundingBox);
allBB(k, :) = thisBB;
[x, y, w1, h1] = deal(thisBB(1),thisBB(2),thisBB(3),thisBB(4));
end
SP1 = TP1(y+h1-1,-(x+w1-h1)) + TP1(-(x-h1),y+h1-1) - TP1(x+w1,y-1) - TP1(x,y-1); % (ERROR LINE)
if any one is getting my point than kindly help me.
댓글 수: 1
Walter Roberson
2019년 6월 14일
When you put in a breakpoint at the assignment to SP1, then what shows up as the values of x, y, w1, h1, and what shows up as size(TP1) ?
Note that you are overwriting x, y, w1, h1 at each iteration of the for k loop, so your assignment to SP1 uses the final values that x y w1 h1 happened to get set to.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Segmentation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

