Anonymous avatar Anonymous committed 9bc27c6

Adding more debug info.

Comments (0)

Files changed (1)

Cosc428_NPR/start.cpp

 
 	writeImage("_original", src);
 
+    // dump HSV images
+    Mat h(src.rows, src.cols, CV_8UC1), s(src.rows, src.cols, CV_8UC1), v(src.rows, src.cols, CV_8UC1);
+    Mat hsv, hsvarr[] = { h, s, v };
+    int hsv_from_to[] = { 0, 0,  1, 1,  2, 2 };    
+    cvtColor(src, hsv, CV_BGR2HSV);
+    mixChannels(&hsv, 1, hsvarr, 3, hsv_from_to, 3);
+    writeImage("_hue", h);
+    writeImage("_sat", s);
+    writeImage("_val", v);
+    // dump HSV images
+
 	// LOCATE ALL POLYGONS
 	cout << "finding plate candidates..." << endl;
 	//findPolygons(plate_cand, plate_candidates, 50, 11);
-	findPolygons(plate_cand, plate_candidates, hierarchy, -1, 7);
+	//findPolygons(plate_cand, plate_candidates, hierarchy, -1, 7);
+	findPolygons(plate_cand, plate_candidates, hierarchy, 50, 7);
 	cout << "found " << plate_candidates.size() << " polygons. filtering..." << endl;
 	
-	PolygonFilter tempFilter(4, 100, 1000, 0, 0.0, 0.2);
+	PolygonFilter tempFilter(4);
+	
+	tempFilter.sides = 4;
+	tempFilter.min_area = 100;
+	tempFilter.max_area = 1000;
+	tempFilter.area_tol = 0;
+	tempFilter.min_cos = 0.0;
+	tempFilter.max_cos = 0.2;
+	
 	tempFilter.print();
 	filterPolygons(plate_candidates, plate_candidates, tempFilter);
 	cout << "drawing " << plate_candidates.size() << " candidate polygons..." << endl;
 		// THRESHOLDING
 		Mat tplate, rgbPlate[3];
 		int from_to[] = { 0, 0,  1, 1,  2, 2 };
+		
 		cvtColor(plate, tplate, CV_BGR2GRAY);
 		adaptiveThreshold(tplate, tplate, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 65, 5);
-		//dilate(tplate, tplate, Mat(), Point(-1, -1), 3);
 		erode(tplate, tplate, Mat(), Point(-1, -1), 3);
 		dilate(tplate, tplate, Mat(), Point(-1, -1), 3);
 		
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.