bw=bwlabel(H);
num=max(bw(:));
ObjectsArea=regionprops(bw,'Area','BoundingBox');
for s=1:num
Ymin=round(ObjectsArea(s).BoundingBox(1));
Ymax=round(ObjectsArea(s).BoundingBox(1))+ObjectsArea(s).BoundingBox(3);
Xmin=round(ObjectsArea(s).BoundingBox(2));
Xmax=round(ObjectsArea(s).BoundingBox(2))+ObjectsArea(s).BoundingBox(4);
f2=256*img23;
sum1(s)=0;
for i=Xmin:(Xmax-1)
for j=Ymin:(Ymax-1)
sum1(s)=f2(i,j)+sum1(s);
end
end