23 #include <core/exception.h>
24 #include <fvfilters/sobel.h>
28 #elif defined(HAVE_OPENCV)
29 # if CV_MAJOR_VERSION < 2 || (CV_MAJOR_VERSION == 2 && CV_MINOR_VERSION < 4)
30 # include <opencv/cv.h>
32 # include <opencv/cv.hpp>
34 # error "Neither IPP nor OpenCV available"
37 namespace firevision {
156 default:
throw fawkes::Exception(
"Cannot generate Sobel kernel for the given orientation");
break;
166 #if defined(HAVE_IPP)
173 if (
ori[0] == ORI_HORIZONTAL) {
182 }
else if (
ori[0] == ORI_VERTICAL) {
191 }
else if ((
ori[0] == ORI_DEG_0) || (
ori[0] == ORI_DEG_45) || (
ori[0] == ORI_DEG_90)
192 || (
ori[0] == ORI_DEG_135) || (
ori[0] == ORI_DEG_180) || (
ori[0] == ORI_DEG_225)
193 || (
ori[0] == ORI_DEG_270) || (
ori[0] == ORI_DEG_315) || (
ori[0] == ORI_DEG_360)) {
195 generate_kernel(kernel,
ori[0]);
197 IppiSize kernel_size;
198 kernel_size.width = kernel_size.height = 3;
201 anchor.x = anchor.y = 1;
217 status = ippStsNullPtrErr;
220 if (status != ippStsNoErr) {
223 #elif defined(HAVE_OPENCV)
224 cv::Mat srcm(
src_roi[0]->height,
243 if (
ori[0] == ORI_HORIZONTAL) {
255 }
else if (
ori[0] == ORI_VERTICAL) {
267 }
else if ((
ori[0] == ORI_DEG_0) || (
ori[0] == ORI_DEG_45) || (
ori[0] == ORI_DEG_90)
268 || (
ori[0] == ORI_DEG_135) || (
ori[0] == ORI_DEG_180) || (
ori[0] == ORI_DEG_225)
269 || (
ori[0] == ORI_DEG_270) || (
ori[0] == ORI_DEG_315) || (
ori[0] == ORI_DEG_360)) {
270 cv::Mat kernel(3, 3, CV_32F);
271 generate_kernel((
float *)kernel.ptr(),
ori[0]);
273 cv::filter2D(srcm, dstm, -1, kernel, cv::Point(1, 1));