Skip to content

Commit 55ab93d

Browse files
authored
Use std::ceil instead of round in ImagePyramid::create
1 parent 0728dcd commit 55ab93d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/FAST/Data/ImagePyramid.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ ImagePyramid::ImagePyramid(int width, int height, int channels, int patchWidth,
9797
while(true) {
9898
if(currentLevel > 0) {
9999
if(levelDownsamples.empty()) {
100-
currentWidth = round((float)width / std::pow(2, currentLevel));
101-
currentHeight = round((float)height / std::pow(2, currentLevel));
100+
currentWidth = std::ceil((float)width / std::pow(2, currentLevel));
101+
currentHeight = std::ceil((float)height / std::pow(2, currentLevel));
102102
if(currentLevel > 0 && (currentWidth < 1024 || currentHeight < 1024))
103103
break;
104104
} else {
@@ -107,8 +107,8 @@ ImagePyramid::ImagePyramid(int width, int height, int channels, int patchWidth,
107107
if(levelDownsamples[currentLevel-1] <= 1.0f)
108108
throw Exception("Invalid level downsample factor smaller than 1.0");
109109
currentDownsample *= levelDownsamples[currentLevel-1];
110-
currentWidth = round((float)width / currentDownsample);
111-
currentHeight = round((float)height / currentDownsample);
110+
currentWidth = std::ceil((float)width / currentDownsample);
111+
currentHeight = std::ceil((float)height / currentDownsample);
112112
if(currentWidth < 1 || currentHeight < 1)
113113
throw Exception("Invalid level downsamples resulting in width and height smaller than 1");
114114
}

0 commit comments

Comments
 (0)