index exceeds matrix dimensions
Show older comments
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 Comment
Walter Roberson
on 14 Jun 2019
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.
Accepted Answer
More Answers (0)
Categories
Find more on Image Segmentation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
