<s> """<STR_LIT>""" <EOL> from matplotlib import cm <EOL> from skimage . transform import ( hough_line , hough_line_peaks , <EOL> probabilistic_hough_line ) <EOL> from skimage . feature import canny <EOL> from skimage import data <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> image = np . zeros ( ( <NUM_LIT:100> , <NUM_LIT:100> ) ) <EOL> idx = np . arange ( <NUM_LIT> , <NUM_LIT> ) <EOL> image [ idx [ : : - <NUM_LIT:1> ] , idx ] = <NUM_LIT:255> <EOL> image [ idx , idx ] = <NUM_LIT:255> <EOL> h , theta , d = hough_line ( image ) <EOL> fig , ( ax0 , ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:3> , figsize = ( <NUM_LIT:12> , <NUM_LIT:6> ) ) <EOL> plt . tight_layout ( ) <EOL> ax0 . imshow ( image , cmap = cm . gray ) <EOL> ax0 . set_title ( '<STR_LIT>' ) <EOL> ax0 . set_axis_off ( ) <EOL> ax1 . imshow ( np . log ( <NUM_LIT:1> + h ) , extent = [ np . rad2deg ( theta [ - <NUM_LIT:1> ] ) , np . rad2deg ( theta [ <NUM_LIT:0> ] ) , <EOL> d [ - <NUM_LIT:1> ] , d [ <NUM_LIT:0> ] ] , cmap = cm . gray , aspect = <NUM_LIT:1> / <NUM_LIT> ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . set_xlabel ( '<STR_LIT>' ) <EOL> ax1 . set_ylabel ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT:image>' ) <EOL> ax2 . imshow ( image , cmap = cm . gray ) <EOL> row1 , col1 = image . shape <EOL> for _ , angle , dist in zip ( * hough_line_peaks ( h , theta , d ) ) : <EOL> y0 = ( dist - <NUM_LIT:0> * np . cos ( angle ) ) / np . sin ( angle ) <EOL> y1 = ( dist - col1 * np . cos ( angle ) ) / np . sin ( angle ) <EOL> ax2 . plot ( ( <NUM_LIT:0> , col1 ) , ( y0 , y1 ) , '<STR_LIT>' ) <EOL> ax2 . axis ( ( <NUM_LIT:0> , col1 , row1 , <NUM_LIT:0> ) ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . set_axis_off ( ) <EOL> image = data . camera ( ) <EOL> edges = canny ( image , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT> ) <EOL> lines = probabilistic_hough_line ( edges , threshold = <NUM_LIT:10> , line_length = <NUM_LIT:5> , <EOL> line_gap = <NUM_LIT:3> ) <EOL> fig , ( ax0 , ax1 , ax2 ) = plt . subplots ( <NUM_LIT:1> , <NUM_LIT:3> , figsize = ( <NUM_LIT:16> , <NUM_LIT:6> ) , sharex = True , <EOL> sharey = True ) <EOL> plt . tight_layout ( ) <EOL> ax0 . imshow ( image , cmap = cm . gray ) <EOL> ax0 . set_title ( '<STR_LIT>' ) <EOL> ax0 . set_axis_off ( ) <EOL> ax0 . set_adjustable ( '<STR_LIT>' ) <EOL> ax1 . imshow ( edges , cmap = cm . gray ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . set_axis_off ( ) <EOL> ax1 . set_adjustable ( '<STR_LIT>' ) <EOL> ax2 . imshow ( edges * <NUM_LIT:0> ) <EOL> for line in lines : <EOL> p0 , p1 = line <EOL> ax2 . plot ( ( p0 [ <NUM_LIT:0> ] , p1 [ <NUM_LIT:0> ] ) , ( p0 [ <NUM_LIT:1> ] , p1 [ <NUM_LIT:1> ] ) ) <EOL> row2 , col2 = image . shape <EOL> ax2 . axis ( ( <NUM_LIT:0> , col2 , row2 , <NUM_LIT:0> ) ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> ax2 . set_axis_off ( ) <EOL> ax2 . set_adjustable ( '<STR_LIT>' ) <EOL> plt . show ( ) </s>
