MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / processInputData

Method processInputData

IPL/src/processes/IPLScharr.cpp:50–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool IPLScharr::processInputData(IPLData* data, int, bool useOpenCV)
51{
52 IPLImage* image = data->toImage();
53
54 // delete previous result
55 delete _result;
56 _result = NULL;
57
58 int width = image->width();
59 int height = image->height();
60
61 _result = new IPLImage( image->type(), width, height );
62
63 // get properties
64 int threshold = getProcessPropertyInt("threshold");
65 /*double sigma = getProcessPropertyDouble("sigma");
66 double lowThreshold = getProcessPropertyDouble("lowThreshold");
67 double highThreshold = getProcessPropertyDouble("highThreshold");*/
68
69 /*std::stringstream s;
70 s << "Window: ";
71 s << window;
72 addInformation(s.str());*/
73
74 notifyProgressEventHandler(-1);
75 cv::Mat input;
76 cv::Mat output;
77 cvtColor(image->toCvMat(), input, CV_BGR2GRAY);
78
79 /// Detector parameters
80 int blockSize = 2;
81 int apertureSize = 3;
82 double k = 0.04;
83
84 cv::Mat dst_norm;
85
86 /// Detecting corners
87 cv::cornerHarris(input, output, blockSize, apertureSize, k, cv::BORDER_DEFAULT );
88
89 /// Normalizing
90 cv::normalize( output, dst_norm, 0, 255, cv::NORM_MINMAX, CV_32FC1, cv::Mat() );
91 cv::convertScaleAbs( dst_norm, output );
92
93 cvtColor(output, output, CV_GRAY2BGR);
94
95 /// Drawing a circle around corners
96 for( int j = 0; j < dst_norm.rows ; j++ )
97 {
98 for( int i = 0; i < dst_norm.cols; i++ )
99 {
100 if( (int) dst_norm.at<float>(j,i) > threshold )
101 {
102 cv::line(output, cv::Point(i-3, j), cv::Point(i+3, j), cv::Scalar(0,0,255));
103 cv::line(output, cv::Point(i, j-3), cv::Point(i, j+3), cv::Scalar(0,0,255));
104 }
105 }
106 }
107

Callers

nothing calls this directly

Calls 7

MatFunction · 0.85
toImageMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
toCvMatMethod · 0.80
normalizeFunction · 0.50
typeMethod · 0.45

Tested by

no test coverage detected