template<class BackInsertIterator>
Definition at line 16 of file MakeOverlappingRects.h. Referenced by Impala::Core::Geometry::RectanglePyramid::SetImageSize(). 00019 { 00020 imWidth -= 2*borderWidth; 00021 imHeight -= 2*borderWidth; 00022 int nrRects = 0; 00023 int toProduce = 0; 00024 for (int nr=nrRegionsMin ; nr<=nrRegionsMax ; nr+=nrRegionsStepSize) 00025 { 00026 int maxPerDim = nr + (nr - 1); 00027 toProduce += maxPerDim * maxPerDim; 00028 int regionWidth = imWidth/nr; 00029 int regionHeight = imHeight/nr; 00030 int regionXoffset = regionWidth/2; 00031 int regionYoffset = regionHeight/2; 00032 00033 int nrY = 1; 00034 for (int y=borderWidth+regionYoffset ; 00035 y<=imHeight-regionYoffset+borderWidth ; y+=regionYoffset) 00036 { 00037 if (nrY++ > maxPerDim) 00038 continue; 00039 int nrX = 1; 00040 for(int x=borderWidth+regionXoffset ; 00041 x<=imWidth-regionXoffset+borderWidth ; x+=regionXoffset) 00042 { 00043 if (nrX++ > maxPerDim) 00044 continue; 00045 Rectangle rect(x-regionXoffset, y-regionYoffset, 00046 x+regionXoffset-1, y+regionYoffset-1); 00047 *bi++ = rect; 00048 nrRects++; 00049 } 00050 } 00051 } 00052 if (nrRects != toProduce) 00053 std::cout << "MakeOverlappingRects: produced incorrect number: " 00054 << nrRects << " instead of " << toProduce << std::endl; 00055 }
|