summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongkyun, Son <dongkyun.s@samsung.com>2016-10-25 14:33:24 +0900
committerDongkyun, Son <dongkyun.s@samsung.com>2016-10-25 18:35:18 +0900
commit5e39ab7af3dc7007f32c6b7897843409ae12756f (patch)
tree2306d88dd53ca499e3eb59a95f828a931624322a
parente2aca33b4287e28d322038a8425539b3516dd8dc (diff)
downloadopencv-sandbox/dkson95/gcc62.tar.gz
opencv-sandbox/dkson95/gcc62.tar.bz2
opencv-sandbox/dkson95/gcc62.zip
[PATCH] Fix FTBFS with GCC 6 (#1307821)sandbox/dkson95/gcc62
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com> Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
-rw-r--r--modules/contrib/src/chamfermatching.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/modules/contrib/src/chamfermatching.cpp b/modules/contrib/src/chamfermatching.cpp
index 64d77cf0d5..dbe27f396b 100644
--- a/modules/contrib/src/chamfermatching.cpp
+++ b/modules/contrib/src/chamfermatching.cpp
@@ -966,10 +966,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis
for (int y=0;y<h;++y) {
for (int x=0;x<w;++x) {
// initialize
- if (&annotate_img!=NULL) {
- annotate_img.at<Vec2i>(y,x)[0]=x;
- annotate_img.at<Vec2i>(y,x)[1]=y;
- }
+ annotate_img.at<Vec2i>(y,x)[0]=x;
+ annotate_img.at<Vec2i>(y,x)[1]=y;
uchar edge_val = edges_img.at<uchar>(y,x);
if( (edge_val!=0) ) {
@@ -1013,10 +1011,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis
dist_img.at<float>(ny,nx) = dist;
q.push(std::make_pair(nx,ny));
- if (&annotate_img!=NULL) {
- annotate_img.at<Vec2i>(ny,nx)[0]=annotate_img.at<Vec2i>(y,x)[0];
- annotate_img.at<Vec2i>(ny,nx)[1]=annotate_img.at<Vec2i>(y,x)[1];
- }
+ annotate_img.at<Vec2i>(ny,nx)[0]=annotate_img.at<Vec2i>(y,x)[0];
+ annotate_img.at<Vec2i>(ny,nx)[1]=annotate_img.at<Vec2i>(y,x)[1];
}
}
}
@@ -1106,27 +1102,22 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs
}
float cost = (sum_distance/truncate_)/addr.size();
+ float* optr = orientation_img.ptr<float>(y)+x;
+ float sum_orientation = 0;
+ int cnt_orientation = 0;
+ for (size_t i=0;i<addr.size();++i) {
- if (&orientation_img!=NULL) {
- float* optr = orientation_img.ptr<float>(y)+x;
- float sum_orientation = 0;
- int cnt_orientation = 0;
-
- for (size_t i=0;i<addr.size();++i) {
-
- if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){
- if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) {
- sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i])));
- cnt_orientation++;
- }
+ if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){
+ if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) {
+ sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i])));
+ cnt_orientation++;
}
}
+ }
- if (cnt_orientation>0) {
- cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation);
- }
-
+ if (cnt_orientation>0) {
+ cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation);
}
if(cost > 0){