Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first worktin sobel filter in library
- Loading branch information
Wolfgang Brueckner
committed
Apr 5, 2018
1 parent
93b1fd2
commit 2010e22
Showing
9 changed files
with
2,477 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include cv2pynq/bitstreams * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
import cv2 | ||
from cv2 import * | ||
import numpy as np | ||
from .cv2pynq import * | ||
|
||
def Sobel(): | ||
return 1 | ||
__version__ = 0.1 | ||
|
||
c = cv2pynq() | ||
|
||
#def Sobel(src, ddepth, dx, dy[, dst[, ksize[, scale[, delta[, borderType]]]]]) : | ||
def Sobel(src, ddepth, dx, dy, dst=0, ksize=3, scale=1, delta=0, borderType=cv2.BORDER_DEFAULT): | ||
"""Executes the Sobel operator on hardware if input parameters fit to hardware constraints. | ||
Otherwise the OpenCV Sobel function is called.""" | ||
if (dst == 0) and (ksize == 3) and (scale == 1) and (delta == 0) and (borderType == cv2.BORDER_DEFAULT) : | ||
if (src.dtype == np.uint8) and (src.ndim == 2) : | ||
if (src.shape[0] <= cv2pynq.MAX_HEIGHT) and (src.shape[0] > 0) and (src.shape[1] <= cv2pynq.MAX_WIDTH) and (src.shape[1] > 0) : | ||
if ((ddepth == -1) and (dx == 1) and (dy == 0)) or ((ddepth == -1) and (dx == 0) and (dy == 1)) : | ||
return c.Sobel(src, ddepth, dx, dy) | ||
|
||
return cv2.Sobel(src, ddepth, dx, dy, dst, ksize, scale, delta, borderType) |
Binary file not shown.
Oops, something went wrong.