Skip to content

Commit 94d0250

Browse files
committed
Fix build of dnn_superres module without the quality module.
Remove not used dependency. Fix some warnings reported by VS2017.
1 parent 65abc70 commit 94d0250

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

modules/dnn_superres/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(the_description "Super Resolution using CNNs")
22

33
ocv_define_module(dnn_superres opencv_core opencv_imgproc opencv_dnn
4-
OPTIONAL opencv_datasets opencv_quality # samples
4+
OPTIONAL opencv_quality # samples
55
)

modules/dnn_superres/include/opencv2/dnn_superres.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ class CV_EXPORTS DnnSuperResImpl
4949

5050
int sc; //scale factor
5151

52-
void preprocess(InputArray inpImg, OutputArray outpImg);
53-
5452
void reconstruct_YCrCb(InputArray inpImg, InputArray origImg, OutputArray outpImg, int scale);
5553

56-
void reconstruct_YCrCb(InputArray inpImg, InputArray origImg, OutputArray outpImg);
57-
5854
void preprocess_YCrCb(InputArray inpImg, OutputArray outpImg);
5955

6056
public:

modules/dnn_superres/samples/dnn_superres_benchmark_quality.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// of this distribution and at http://opencv.org/license.html.
44

55
#include <iostream>
6+
#include <opencv2/opencv_modules.hpp>
67

8+
#ifdef HAVE_OPENCV_QUALITY
79
#include <opencv2/dnn_superres.hpp>
810
#include <opencv2/quality.hpp>
911
#include <opencv2/imgproc.hpp>
@@ -196,4 +198,11 @@ int main(int argc, char *argv[])
196198
waitKey(0);
197199

198200
return 0;
199-
}
201+
}
202+
#else
203+
int main()
204+
{
205+
std::cout << "This sample requires the OpenCV Quality module." << std::endl;
206+
return 0;
207+
}
208+
#endif

modules/dnn_superres/samples/dnn_superres_benchmark_time.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <iostream>
66

77
#include <opencv2/dnn_superres.hpp>
8-
#include <opencv2/quality.hpp>
98
#include <opencv2/imgproc.hpp>
109
#include <opencv2/highgui.hpp>
1110

modules/ximgproc/samples/colorize.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int main(int argc, char* argv[])
159159
if(show_count%5==0)
160160
{
161161
cv::Mat target_temp(target.size(),target.type());
162-
filtering_time = (double)getTickCount();
162+
filtering_time = static_cast<float>(getTickCount());
163163
if(mouseDraw)
164164
{
165165
cv::cvtColor(target, target_temp, cv::COLOR_BGR2YCrCb);
@@ -184,7 +184,7 @@ int main(int argc, char* argv[])
184184
{
185185
target_temp = target.clone();
186186
}
187-
filtering_time = ((double)getTickCount() - filtering_time)/getTickFrequency();
187+
filtering_time = static_cast<float>(((double)getTickCount() - filtering_time)/getTickFrequency());
188188
std::cout << "solver time: " << filtering_time << "s" << std::endl;
189189

190190
cv::Mat color_selected(target_temp.rows-mat_pallet.rows,PALLET_RADIUS*2,CV_8UC3,cv::Scalar(selected_b, selected_g, selected_r));
@@ -209,7 +209,7 @@ int main(int argc, char* argv[])
209209
cv::Mat result1 = cv::Mat(mat_input_gray.size(),mat_input_gray.type());
210210
cv::Mat result2 = cv::Mat(mat_input_gray.size(),mat_input_gray.type());
211211

212-
filtering_time = (double)getTickCount();
212+
filtering_time = static_cast<float>(getTickCount());
213213

214214
// dst_channels.push_back(src_channels[0]);
215215
dst_channels.push_back(mat_input_gray);
@@ -221,7 +221,7 @@ int main(int argc, char* argv[])
221221
cv::merge(dst_channels,target);
222222
cv::cvtColor(target, target, cv::COLOR_YCrCb2BGR);
223223

224-
filtering_time = ((double)getTickCount() - filtering_time)/getTickFrequency();
224+
filtering_time = static_cast<float>(((double)getTickCount() - filtering_time)/getTickFrequency());
225225
std::cout << "solver time: " << filtering_time << "s" << std::endl;
226226

227227

@@ -331,7 +331,7 @@ void drawTrajectoryByReference(cv::Mat& img)
331331
gray = *grayPix;
332332
grayPix++;
333333
mat_input_confidence.at<uchar>(y,x) = 255;
334-
float draw_y = 0.229*(float(selected_r)) + 0.587*(float(selected_g)) + 0.114*(float(selected_b));
334+
float draw_y = 0.229f*(float(selected_r)) + 0.587f*(float(selected_g)) + 0.114f*(float(selected_b));
335335
int draw_b = int(float(selected_b)*(gray/draw_y));
336336
int draw_g = int(float(selected_g)*(gray/draw_y));
337337
int draw_r = int(float(selected_r)*(gray/draw_y));
@@ -397,13 +397,13 @@ void createPlate(Mat &im1, int radius)
397397
Point pt2(j - cx, i - cy);
398398
if (inCircle(Point(0, 0), pt2, radius))
399399
{
400-
int theta = angle(pt1, pt2) * 180 / CV_PI;
400+
int theta = static_cast<int>(angle(pt1, pt2) * 180 / CV_PI);
401401
if (i > cx)
402402
{
403403
theta = -theta + 360;
404404
}
405-
hsvImag.at<Vec3b>(i, j)[0] = theta / 2;
406-
hsvImag.at<Vec3b>(i, j)[1] = module(pt2) / cx * 255;
405+
hsvImag.at<Vec3b>(i, j)[0] = saturate_cast<uchar>(theta / 2);
406+
hsvImag.at<Vec3b>(i, j)[1] = saturate_cast<uchar>(module(pt2) / cx * 255);
407407
hsvImag.at<Vec3b>(i, j)[2] = 255;
408408
}
409409
}

modules/ximgproc/src/fbs_filter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ namespace ximgproc
186186
bs_params()
187187
{
188188
lam = 128.0;
189-
A_diag_min = 1e-5;
190-
cg_tol = 1e-5;
189+
A_diag_min = 1e-5f;
190+
cg_tol = 1e-5f;
191191
cg_maxiter = 25;
192192
}
193193
};
@@ -261,7 +261,7 @@ namespace ximgproc
261261
++pix_idx;
262262
}
263263
}
264-
nvertices = hashed_coords.size();
264+
nvertices = static_cast<int>(hashed_coords.size());
265265

266266
// construct Blur matrices
267267
Eigen::VectorXf ones_nvertices = Eigen::VectorXf::Ones(nvertices);
@@ -373,7 +373,7 @@ namespace ximgproc
373373
++pix_idx;
374374
}
375375
}
376-
nvertices = hashed_coords.size();
376+
nvertices = static_cast<int>(hashed_coords.size());
377377

378378
// construct Blur matrices
379379
Eigen::VectorXf ones_nvertices = Eigen::VectorXf::Ones(nvertices);

0 commit comments

Comments
 (0)