Computer Vision News - September 2016

16 Computer Vision News Tool Then, after the code was executed, in the command line you can type: Now, using your Web Browser, you will be able to observe the TensorFlow graph: (2) Function parameters In our code, the cv2.HoughLines() in the getHoughlines function has several parameters, which influence how the Hough transform method works. The best practice is to have those parameters supplied to the function and not have them as fixed numbers included in the function code. Luckily, TensorFlow allows you to define variables being part of the graph; those could be changed and evaluated for different values as part of the Framework. We will update the getHoughlines function to receive two variables, ‘rho’ and ‘theta’. The function will now be: To have those two variables as part of the TensorFlow graph, we update our code as follows: Tool tensorboard --logdir=/tmp/log This graph is quite simple and it provides an excellent visualization of the pipeline of two functions in the code. It starts at the bottom, having a data placeholder tensor of a size of (563x558x3). This is an RGB image to be processed: it is fed into the Edges function which perform the Canny Edges Detection. Next, the Hough transform is executed for getting the Sudoku grid lines. def getHoughlines(edges, _rho , _theta ): edges = np.squeeze(edges) lines = cv2.HoughLines(edges, _rho , _theta , 200) return lines 1. _rho = tf.Variable(1.0, name='rho') 2. _theta = tf.Variable (np.pi / 180, name='theta') 3. X1=tf.py_func(getEdges, [my_img], [tf.uint8], name='Edges') 4. X2=tf.py_func(getHoughlines,[X1,_rho,_theta],[tf.float32], name='Hough')

RkJQdWJsaXNoZXIy NTc3NzU=