Package: pyautocv
(Semi) Automated Image Processing with pyautocvProject AimsThe goal ofpyautocvis to provide a simple computer vision(cv) workflow that enables one to automate
or at least reduce the time spent in image (pre)-processing.Installing the packageFrom PyPIpipinstallpyautocvFrom GitHubpipinstallgit+https://github.com/Nelson-Gon/pyautocv.git#or# clone the repogitclonehttps://www.github.com/Nelson-Gon/pyautocv.gitcdpyautocv
python3setup.pyinstallExample UsageNote: Although these methods can be run via this script, the script is less flexible and might be useful for quick
exploration but not extended analysis.To run the script at the  commandline, we can do the followingpython-mpyautocv-d"images/cats"-s"png"-m"thresh_to_zero"-o"threshold"-mt200-t100Sample ResultTo perform edge detectionpython-mpyautocv-d"images/biology"-s"jpg"-o"detect_edges"-m"sobel_vertical"-k3To smooth imagespython-mpyautocv-d"images/houses"-s"jpg"-o"smooth"-m"gaussian"-k55--sigma0.7To get helppython-mpyautocv-hFurther exploration is left to the user.The following section shows how to use the more flexible class/methods approachImage Gra(e)yingTo grey an image directoryfrompyautocv.segmentationimportSegmentation,gray_images,show_imagesimages_list=Segmentation("images/cats")show_images(gray_images(images_list.read_images()),images_list.read_images(),number=2)SmoothingTo smooth a directory of images, we can useEdgeDetection'ssmoothmethod as
followsimages_list=Segmentation("images/cats")show_images(images_list.smooth(),images_list.read_images(),number=2)This will give usThe above uses default parameters including anrgbcolor mode. For biological images which are often in
grayscale, one can setcolor_modeto gray as shown below. All other operations will remain the same.images_list_gray_mode=Segmentation("images/dic",image_suffix="tif",color_mode="gray")show_images(images_list_gray_mode.read_images(),images_list_gray_mode.threshold_images(),number=4)ResultTo use a different filterimages_list=Segmentation("images/cats")show_images(images_list.read_images(),images_list.smooth(mask="median",kernel_shape=(7,7)))Edge DetectionTo detect edges in a directory of images, we can useSegmentation'sdetect_edges.show_images(images_list.read_images(),images_list.detect_edges(operator="roberts",mask="gaussian",sigma=0.8))The above will give us the following resultTo use a different filter e.g Laplace,show_images(images_list.read_images(),images_list.detect_edges(operator="laplace",mask="gaussian",sigma=0))This results inThresholdingTo perform thresholding, we can use the methodthreshold_images.to_threshold=Segmentation("images/biology")show_images(to_threshold.read_images(),to_threshold.threshold_images())To use a different thresholding method.show_images(to_threshold.read_images(),to_threshold.threshold_images(threshold_method="otsu"))The above gives us:For cat lovers, here's thresholding with inverse binary.show_images(images_list.read_images(),images_list.threshold_images(threshold_method="binary_inverse"))Result:Thresholding applied to images of houses.images_list=Segmentation("images/houses")show_images(images_list.read_images(),images_list.threshold_images(threshold_method="thresh_to_zero"))images_list=Segmentation("images/potholes")show_images(images_list.read_images(),images_list.threshold_images("binary"))These and more examples are available inexample.py. Image sources are
shown insources.md. If you feel attribution was not made, please file an issue and cite the violating image.CitationNelson Gonzabato(2021) pyautocv: (Semi) Automated Image Processing,https://github.com/Nelson-Gon/pyautocv.@misc{Gonzabato2021,author={Gonzabato,N},title={pyautocv:(Semi)AutomatedImageProcessing},year={2021},publisher={GitHub},journal={GitHubrepository},howpublished={\url{https://github.com/Nelson-Gon/pyautocv}},commit={7fe2e0f7894e8be4588a22758e8097c247cd1cd9}Thank you very much“A language that doesn't affect the way you think about programming is not worth knowing.”
― Alan J. PerlisReferencesBebisStandford, author unknownFunkhouser et al.,2013