[Robotvision-commit] SF.net SVN: robotvision:[14] vision
Brought to you by:
phildavidson
From: <phi...@us...> - 2010-05-24 19:27:58
|
Revision: 14 http://robotvision.svn.sourceforge.net/robotvision/?rev=14&view=rev Author: phildavidson Date: 2010-05-24 19:27:52 +0000 (Mon, 24 May 2010) Log Message: ----------- update... Modified Paths: -------------- vision/.project vision/src/test.cpp vision/src/test2.cpp vision/testimg.png Added Paths: ----------- vision/images/flipper.png Modified: vision/.project =================================================================== --- vision/.project 2010-05-20 01:00:10 UTC (rev 13) +++ vision/.project 2010-05-24 19:27:52 UTC (rev 14) @@ -27,7 +27,7 @@ </dictionary> <dictionary> <key>org.eclipse.cdt.make.core.buildLocation</key> - <value>${workspace_loc:/vision/Release}</value> + <value>${workspace_loc:/vision/Debug}</value> </dictionary> <dictionary> <key>org.eclipse.cdt.make.core.contents</key> Added: vision/images/flipper.png =================================================================== (Binary files differ) Property changes on: vision/images/flipper.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: vision/src/test.cpp =================================================================== --- vision/src/test.cpp 2010-05-20 01:00:10 UTC (rev 13) +++ vision/src/test.cpp 2010-05-24 19:27:52 UTC (rev 14) @@ -169,19 +169,18 @@ { int sthreshold = 86, erode = 4, dialate = 8; - int hlower = 127, hupper = 5;/* + int hlower = 127, hupper = 18;/* here hlower is the lower cut off and the hupper is the upper cut off for hue values of red.*/ cvNamedWindow("original", CV_WINDOW_AUTOSIZE); - cvNamedWindow("Monochrome Of red Blob", CV_WINDOW_AUTOSIZE); + cvNamedWindow("processed", CV_WINDOW_AUTOSIZE); - cvCreateTrackbar("sthreshold", "Monochrome Of red Blob", &sthreshold, 255, - 0); - cvCreateTrackbar("hlower", "Monochrome Of red Blob", &hlower, 255, 0); - cvCreateTrackbar("hupper", "Monochrome Of red Blob", &hupper, 255, 0); - cvCreateTrackbar("erode", "Monochrome Of red Blob", &erode, 20, 0); - cvCreateTrackbar("dialate", "Monochrome Of red Blob", &dialate, 20, 0); + //cvCreateTrackbar("sthreshold", "Monochrome Of red Blob", &sthreshold, 255, 0); + //cvCreateTrackbar("hlower", "Monochrome Of red Blob", &hlower, 255, 0); + //cvCreateTrackbar("hupper", "Monochrome Of red Blob", &hupper, 255, 0); + //cvCreateTrackbar("erode", "Monochrome Of red Blob", &erode, 20, 0); + //cvCreateTrackbar("dialate", "Monochrome Of red Blob", &dialate, 20, 0); int i, j, k;//for iterations int temp = 0;//if we use a temporary var @@ -225,7 +224,7 @@ // } - frame = cvRetrieveFrame(capture); + //frame = cvRetrieveFrame(capture); for (;;) {/*keep looping till we are out of frames...*/ @@ -244,6 +243,7 @@ exit(0); } //printf("frame loaded"); + colimgbot = cvCreateImage(cvGetSize(frame), 8, 3); monoimgbot = cvCreateImage(cvGetSize(frame), 8, 1); @@ -275,6 +275,7 @@ } else /*A very simple concept with the loops here if the hue values are in the aforementioned range and the threshold is met then logic one else logic zero*/ + datamono[i * stepmono + j * channelsmono] = 0; } } @@ -328,9 +329,10 @@ } } - w = w / countw; - h = h / counth; - + if(countw!=0 && counth!=0) { + w = w / countw; + h = h / counth; + } cvCircle(frame, cvPoint(w, h), 20, cvScalar(0, 255, 0), 1); //printf("w: %i, h: %i", w, h); @@ -341,13 +343,13 @@ IplImage * img2 = cvLoadImage("testimg.png", 1); - drawSquares( img2, findSquares4( img2 ) ); + drawSquares(img2, findSquares4(img2)); cvCircle(img2, cvPoint(w, h), 20, cvScalar(0, 255, 0), 1); cvShowImage("original", frame); //cvSaveImage("red-ballmonochrome.jpg",monoimgbot);/*if you want to save the image*/ - cvShowImage("Monochrome Of red Blob", img2); + cvShowImage("processed", img2); int c = cvWaitKey(100); if ((char) c == 27) break; @@ -357,11 +359,13 @@ check the other posts on this blog*/ } + + /* free memory */ //cvReleaseVideoWriter(&writer); - cvDestroyWindow("Monochrome Of red Blob"); + cvDestroyWindow("processed"); cvDestroyWindow("original"); cvReleaseCapture(&capture); Modified: vision/src/test2.cpp =================================================================== --- vision/src/test2.cpp 2010-05-20 01:00:10 UTC (rev 13) +++ vision/src/test2.cpp 2010-05-24 19:27:52 UTC (rev 14) @@ -49,7 +49,7 @@ //frame = cvLoadImage("images/3dballs.jpg", 1); - frame=cvLoadImage("images/pipe.png",1); + frame=cvLoadImage("images/flipper.png",1); if (frame == NULL) { puts("unable to load the frame"); Modified: vision/testimg.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |