.. note::
If the size of the created library is a critical issue (like in case of an Android build) you can use the ``install/strip`` command to get the smallest size as possible. The *stripped* version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.
+
++ If the size of the created library is a critical issue (like in case of an Android build) you can use the ``install/strip`` command to get the smallest size as possible. The *stripped* version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.
#define CV_IMPL extern "C"
#endif //CV_IMPL
-#if defined(__cplusplus)
-#include "opencv2/core/internal.hpp"
-#endif //__cplusplus
-
#endif // __OPENCV_OLD_CV_H_
-
///////////// StereoMatchBM ////////////////////////
PERFTEST(StereoMatchBM)
{
- Mat left_image = imread(abspath("aloeL.jpg"), cv::IMREAD_GRAYSCALE);
- Mat right_image = imread(abspath("aloeR.jpg"), cv::IMREAD_GRAYSCALE);
- Mat disp,dst;
- ocl::oclMat d_left, d_right,d_disp;
- int n_disp= 128;
- int winSize =19;
+ Mat left_image = imread(abspath("aloeL.jpg"), cv::IMREAD_GRAYSCALE);
+ Mat right_image = imread(abspath("aloeR.jpg"), cv::IMREAD_GRAYSCALE);
+ Mat disp,dst;
+ ocl::oclMat d_left, d_right,d_disp;
+ int n_disp= 128;
+ int winSize =19;
- SUBTEST << left_image.cols << 'x' << left_image.rows << "; aloeL.jpg ;"<< right_image.cols << 'x' << right_image.rows << "; aloeR.jpg ";
+ SUBTEST << left_image.cols << 'x' << left_image.rows << "; aloeL.jpg ;"<< right_image.cols << 'x' << right_image.rows << "; aloeR.jpg ";
- StereoBM bm(0, n_disp, winSize);
- bm(left_image, right_image, dst);
+ Ptr<StereoBM> bm = createStereoBM(n_disp, winSize);
+ bm->compute(left_image, right_image, dst);
- CPU_ON;
- bm(left_image, right_image, dst);
- CPU_OFF;
+ CPU_ON;
+ bm->compute(left_image, right_image, dst);
+ CPU_OFF;
- d_left.upload(left_image);
- d_right.upload(right_image);
+ d_left.upload(left_image);
+ d_right.upload(right_image);
- ocl::StereoBM_OCL d_bm(0, n_disp, winSize);
+ ocl::StereoBM_OCL d_bm(0, n_disp, winSize);
- WARMUP_ON;
- d_bm(d_left, d_right, d_disp);
- WARMUP_OFF;
+ WARMUP_ON;
+ d_bm(d_left, d_right, d_disp);
+ WARMUP_OFF;
cv::Mat ocl_mat;
d_disp.download(ocl_mat);
1, flags, centers);
ocl::kmeans(d_src, K, d_labels,
- TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 100, 0),
+ TermCriteria( TermCriteria::EPS + TermCriteria::MAX_ITER, 100, 0),
1, flags, d_centers);
-
+
Mat dd_labels(d_labels);
Mat dd_centers(d_centers);
if(flags & KMEANS_USE_INITIAL_LABELS)
Mat dst_lab(srcImgs[0].size(), srcImgs[0].type());
mixChannels(l_ab_denoised, 2, &dst_lab, 1, from_to, 3);
- cvtColor(dst_lab, dst, CV_Lab2LBGR);
+ cvtColor(dst_lab, dst, COLOR_Lab2LBGR);
}
-
-
return 0.3f*bgr.x + 0.59f*bgr.y + 0.11f*bgr.z;
}
-template <typename T> inline T& at(int index, T *items, int size)
-{
- return items[cv::borderInterpolate(index, size, cv::BORDER_WRAP)];
-}
-
-template <typename T> inline const T& at(int index, const T *items, int size)
-{
- return items[cv::borderInterpolate(index, size, cv::BORDER_WRAP)];
-}
-
-template <typename T> inline T& at(int index, std::vector<T> &items)
-{
- return at(index, &items[0], static_cast<int>(items.size()));
-}
-
-template <typename T> inline const T& at(int index, const std::vector<T> &items)
-{
- return items[cv::borderInterpolate(index, static_cast<int>(items.size()), cv::BORDER_WRAP)];
-}
-
#endif
-
{ circle( copy, corners[i], r, Scalar(rng.uniform(0,255), rng.uniform(0,255), rng.uniform(0,255)), -1, 8, 0 ); }
/// Show what you got
- namedWindow( source_window, CV_WINDOW_AUTOSIZE );
+ namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, copy );
}
-
return -1;
}
- namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
- imshow( "Display window", image ); // Show our image inside it.
+ namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
+ imshow( "Display window", image ); // Show our image inside it.
- waitKey(0); // Wait for a keystroke in the window
+ waitKey(0); // Wait for a keystroke in the window
return 0;
- }
+ }
if __name__ == '__main__':
import sys
- try: video_src = sys.argv[1]
- except: video_src = 0
+ try:
+ video_src = sys.argv[1]
+ except:
+ video_src = 0
print __doc__
App(video_src).run()
-