Giter Site home page Giter Site logo

dirtmaxim / lungs-finder Goto Github PK

View Code? Open in Web Editor NEW
27.0 5.0 19.0 48 KB

Library for detecting lungs on chest x-ray images for further processing. It is fast and able to work on embedded devices.

License: Apache License 2.0

Python 100.00%
haar-lungs-finder hog-lungs-finder lbp-lungs-finder haar-lungs-detector hog-lungs-detector lbp-lungs-detector lungs-segmentation cxr-lungs

lungs-finder's Introduction

lungs-finder

Library for lungs detection on CXR images

Requirements:
- Python 3;
- OpenCV3.
Installation:
- pip install lungs-finder
You can test your dataset using lungs_viewer.py.
It is a program that is displayed on the screenshot above.
Usage: lungs_viewer.py /your/dataset True
The last parameter defines whether labels will be displayed or not.
You can get lungs using HOG, Haar or LBP.
Example:

import lungs_finder as lf

image = cv2.imread("/your/image/cxr.png", 0)

# Get both lungs image. It uses HOG as main method,
# but if HOG found nothing it uses HAAR or LBP.
found_lungs = lf.get_lungs(image)

if found_lungs is not None:
    cv2.imshow("Found lungs", found_lungs)
    code = cv2.waitKey(0)

# Or you can get left or right lung independently using HOG, Haar or LBP.
right_lung_hog_rectangle = lf.find_right_lung_hog(scaled_image)
left_lung_hog_rectangle = lf.find_left_lung_hog(scaled_image)
right_lung_lbp_rectangle = lf.find_right_lung_lbp(scaled_image)
left_lung_lbp_rectangle = lf.find_left_lung_lbp(scaled_image)
right_lung_haar_rectangle = lf.find_right_lung_haar(scaled_image)
left_lung_haar_rectangle = lf.find_left_lung_haar(scaled_image)

if right_lung_hog_rectangle is not None:
    x, y, width, height = right_lung_hog_rectangle
    right_image = image[y:y + height, x:x + width]
    cv2.imshow("Right lung", right_image)
    code = cv2.waitKey(0)

lungs-finder's People

Contributors

dirtmaxim avatar xiaoyongzhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lungs-finder's Issues

Lungs cannot be detected correctly

00000013_006
Hi,

Thanks for publishing this library, it is super helpful!

One issue I found is that when dealing with a specific data (see attached), it does not return the images correctly. Looks like there is some bug somewhere.

The bottom and top of lungs is missed a bit

screen shot 2018-08-06 at 9 01 32 pm

This library is very amazing. I'm working with lungs detection and analysis but I would like to detect lung until the bottom.

In the image as you see the bottom is missed. I used hog method how can I optimize this?

Documentation

Hi, do you have documentation on how the algorithm works for learning purposes?

Dataset for training

Thanks for sharing the great repo. May I ask what dataset you used to train the detector? (include both positive and negative samples) Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.