From fe6ac64b4bfe624a2b71dcff234ffad3e4a79be6 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Mon, 19 Dec 2011 14:48:24 +0100 Subject: [PATCH] Adds histogram support to 3 channels images Finishes support for 3 channels images. Adds a function allowing to extract only one desired channel Updates the example to extract all channels. Support for 16 and 32 bits images should be tested. Function for 3c to 1c to be added quickly! Reported-by: Julien Lengrand-Lambert Signed-off-by: Julien Lengrand-Lambert --- examples/histogram_display.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/histogram_display.py b/examples/histogram_display.py index 2eeb932..a094dfa 100644 --- a/examples/histogram_display.py +++ b/examples/histogram_display.py @@ -17,4 +17,22 @@ representation of teh histogram result for one channel. To end the script, the user simply needs to hit a keyboard key with the input image in the foreground. ''' +import cv +import tippy.statistics as st +import tippy.display_operations as do +<<<<<<< HEAD +img_name = "tippy/data/tippy.jpg" +img = cv.LoadImage(img_name, cv.CV_LOAD_IMAGE_COLOR) +hist = st.Histogram(img) + +imgs = hist.to_images() # list of Red, Green, Blue channels +do.display_single_image(imgs[2], "Blue channel histogram of the tippy image") +======= +img_name = "tippy/data/gnu.jpg" +img = cv.LoadImage(img_name, cv.CV_LOAD_IMAGE_COLOR) +hist = st.Histogram(img) + +hist_img = hist.hist2image() + +do.display_single_image(hist_img[0], "Gray-Level histogram of the gnu image")