Rev 3 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3 | Rev 5 | ||
|---|---|---|---|
| Line 16... | Line 16... | ||
| 16 | \*------------------------------------------------------------------------------------------*/
|
16 | \*------------------------------------------------------------------------------------------*/
|
| 17 | 17 | ||
| 18 | #include <iostream>
|
18 | #include <iostream>
|
| 19 | using namespace std; |
19 | using namespace std; |
| 20 | 20 | ||
| 21 | #include "cv.h"
|
21 | #include <opencv/cv.h>
|
| 22 | #include "highgui.h"
|
22 | #include <opencv/highgui.h>
|
| 23 | #include "histogram.h"
|
23 | #include "histogram.h"
|
| 24 | 24 | ||
| 25 | int main() |
25 | int main() |
| 26 | {
|
26 | {
|
| 27 | // Read input image
|
27 | // Read input image
|
| Line 77... | Line 77... | ||
| 77 | // Show the new histogram
|
77 | // Show the new histogram
|
| 78 | cv::namedWindow("Stretched Histogram"); |
78 | cv::namedWindow("Stretched Histogram"); |
| 79 | cv::imshow("Stretched Histogram",h.getHistogramImage(str)); |
79 | cv::imshow("Stretched Histogram",h.getHistogramImage(str)); |
| 80 | 80 | ||
| 81 | // Create an image inversion table
|
81 | // Create an image inversion table
|
| 82 | uchar lookup[256]; |
82 | cv::Mat lookup; |
| 83 | 83 | ||
| 84 | for (int i=0; i<256; i++) { |
84 | for (int i=0; i<256; i++) { |
| 85 | 85 | ||
| 86 | lookup[i]= 255-i; |
86 | lookup.data[i]= 255-i; |
| 87 | }
|
87 | }
|
| 88 | 88 | ||
| 89 | // Apply lookup and display negative image
|
89 | // Apply lookup and display negative image
|
| 90 | cv::namedWindow("Negative image"); |
90 | cv::namedWindow("Negative image"); |
| 91 | cv::imshow("Negative image",h.applyLookUp(image,lookup)); |
91 | cv::imshow("Negative image",h.applyLookUp(image,lookup)); |