Skip to content

luiscarlosgph/endoseg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Endoseg is a Python package that facilitates the segmentation of the visible circular area of endoscopic images.

Install dependencies

  • Numpy
# Ubuntu/Debian
$ sudo apt update
$ sudo apt install python3-pip
$ python3 -m pip install numpy --user
  • OpenCV
# Ubuntu/Debian
$ sudo apt update
$ sudo apt install libopencv-dev python3-opencv

Install with pip

$ python3 -m pip install endoseg --user

Install from source

$ git clone https://github.com/luiscarlosgph/endoseg.git
$ cd endoseg
$ python3 setup.py install --user

Run

$ git clone https://github.com/luiscarlosgph/endoseg.git
$ cd endoseg
$ python3 -m endoseg.run --input data/demo.jpg --output-seg data/demo_seg.png --output-crop data/demo_crop.jpg
Input image Output segmentation Output crop

Note that the output crop is a square cut of the area within the segmentation mask.

Exemplary code snippet

import cv2
import endoseg

# Read input image
im = cv2.imread('input_image.jpg', cv2.IMREAD_UNCHANGED)

# Segment the visible area of the endoscopic image
segmenter = endoseg.Segmenter()
seg = segmenter.segment(im)

# Save the segmentation to file
cv2.imwrite('output_segmentation.png', seg)

# Get a rectangular crop of the visible area
crop = segmenter.get_rect_crop(im)

# Save the crop to file
cv2.imwrite('output_crop.jpg', crop)

# Get the properties of the endoscopic content area circle
xc, yc, radius = segmenter.get_content_area_circle(im)

License

This code is released under an MIT license.

About

Segmentation of the circular area typically present in endoscopic images.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages