Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Malaria sucks. Ruby can help.

Malaria sucks. Ruby can help.

Using computer vision to identify malaria parasites using ruby-opencv. Given at Denver.rb's April meetup.

Jason Ardell

April 14, 2015
Tweet

More Decks by Jason Ardell

Other Decks in Technology

Transcript

  1. $> opencv_traincascade -featureType HAAR -data ... ===== TRAINING 0-stage =====

    ... ===== TRAINING 21-stage ===== <BEGIN POS count : consumed 804 : 914 NEG count : acceptanceRatio 600 : 9.0543e-06 Precalculation time: 13 +----+---------+---------+ | N | HR | FA | +----+---------+---------+ | 1| 1| 1| +----+---------+---------+ | 2| 0.996269| 0.923333| +----+---------+---------+ | ... | +----+---------+---------+ | 24| 0.995025| 0.496667| +----+---------+---------+ END> Training until now has taken 0 days 1 hours 0 minutes 15 seconds.
  2. $> ls -ald classifier/* -rw-r--r-- 125357 Apr 12 12:21 cascade.xml

    -rw-r--r-- 594 Apr 12 12:21 params.xml -rw-r--r-- 745 Apr 12 12:21 stage0.xml -rw-r--r-- 1102 Apr 12 12:21 stage1.xml -rw-r--r-- 1283 Apr 12 12:21 stage2.xml -rw-r--r-- 1636 Apr 12 12:21 stage3.xml -rw-r--r-- 1645 Apr 12 12:21 stage4.xml -rw-r--r-- 1641 Apr 12 12:21 stage5.xml ...
  3. include OpenCV # Load test image and classifier image =

    CvMat.load(source_image) classifier = CvHaarClassifierCascade.load(cascade_xml) # Draw red rectangle for each match classifier.detect_objects(image).each do |rect| image.rectangle! rect.top_left, rect.bottom_right, color: CvColor::Red end # Write resulting image to a new file image.save(output_file)