| 39 | } |
| 40 | |
| 41 | void IPHistogramWidget::updateHistogram(IPLImage *image) |
| 42 | { |
| 43 | if(!image) |
| 44 | { |
| 45 | _type = IPL_UNDEFINED; |
| 46 | update(); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | // only update if the panel is not hidden |
| 51 | if(isVisible()) |
| 52 | { |
| 53 | _type = image->type(); |
| 54 | |
| 55 | QElapsedTimer timer; |
| 56 | timer.start(); |
| 57 | if(_type == IPL_IMAGE_BW) |
| 58 | { |
| 59 | _histogram.reset(new IPLHistogram(image->plane(0), 2, 100)); |
| 60 | } |
| 61 | else if(_type == IPL_IMAGE_GRAYSCALE || _type == IPL_IMAGE_ORIENTED ) |
| 62 | { |
| 63 | _histogram.reset(new IPLHistogram(image->plane(0), 256, 100)); |
| 64 | } |
| 65 | else if(_type == IPL_IMAGE_COLOR) |
| 66 | { |
| 67 | _histogramR.reset(new IPLHistogram(image->plane(0), 256, 100)); |
| 68 | _histogramG.reset(new IPLHistogram(image->plane(1), 256, 100)); |
| 69 | _histogramB.reset(new IPLHistogram(image->plane(2), 256, 100)); |
| 70 | } |
| 71 | |
| 72 | // repaint |
| 73 | update(); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | void IPHistogramWidget::setLogarithmic(bool logarithmic) |
| 78 | { |
no test coverage detected