Skip to content

Commit

Permalink
first worktin sobel filter in library
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfgang Brueckner committed Apr 5, 2018
1 parent 93b1fd2 commit 2010e22
Show file tree
Hide file tree
Showing 9 changed files with 2,477 additions and 5 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -0,0 +1 @@
recursive-include cv2pynq/bitstreams *
21 changes: 19 additions & 2 deletions cv2pynq/__init__.py
@@ -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 added cv2pynq/bitstreams/filter2D_hls.bit
Binary file not shown.

0 comments on commit 2010e22

Please sign in to comment.