User Tools

Site Tools


drexel_darwin_opencv

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
drexel_darwin_opencv [2016/11/06 04:53]
dwallace
drexel_darwin_opencv [2016/11/06 19:20] (current)
dwallace
Line 27: Line 27:
 I have also prepared a MS Power Point presentation for a step by step installation of OpenCV. I have also prepared a MS Power Point presentation for a step by step installation of OpenCV.
  
-{{dylanw:OpenCV_Tutorial.pptx}}\\ ​+{{dylanw:opencv_tutorial.pptx}}\\ ​
  
 ==== Rectangle Recognition Code ==== ==== Rectangle Recognition Code ====
Line 46: Line 46:
 while(1){ while(1){
 cap >> original; ​ //​constantly obtain new frame from camera cap >> original; ​ //​constantly obtain new frame from camera
-</​syntaxhighlight>​ +
-<​syntaxhighlight lang="​cpp">​+
 Mat original, pyr, timg, gray;//​declare Mat objects that can be used to store image datas Mat original, pyr, timg, gray;//​declare Mat objects that can be used to store image datas
 ... ...
Line 82: Line 81:
 //using the kernel of default aperture size of 3 as defined by "​Mat()"​ //using the kernel of default aperture size of 3 as defined by "​Mat()"​
 //at default start point specified by "​Point(-1,​-1)"​ //at default start point specified by "​Point(-1,​-1)"​
-</​syntaxhighlight>​ +
-<​syntaxhighlight lang="​cpp">​+
 vector<​vector<​Point>​ > contours; vector<​vector<​Point>​ > contours;
 //​declaration of a vector of a vector of X and Y points //​declaration of a vector of a vector of X and Y points
Line 139: Line 137:
 Here is a sample run of my code to filter out black rectangles and output the X and Y coordinates of the centers of the squares in the output MS-Prompt window. Here is a sample run of my code to filter out black rectangles and output the X and Y coordinates of the centers of the squares in the output MS-Prompt window.
  
-{{dylanw:squaresCoordinates.jpg}}\\ ​+{{dylanw:squarescoordinates.jpg}}\\ ​
  
 Some food for thought: Some food for thought:
Line 153: Line 151:
 [[https://​github.com/​mr1789/​darwindasl/​blob/​master/​Ladder.cpp|Here]] is my code and here is a video of it. [[https://​github.com/​mr1789/​darwindasl/​blob/​master/​Ladder.cpp|Here]] is my code and here is a video of it.
  
-{{#ev:youtube|R0gCfSxRoOk}}\\ ​+{{youtube>R0gCfSxRoOk?large}}\\ 
  
 Video explanation:​ Video explanation:​
Line 175: Line 173:
 However, as can be seen circled in red, when there is a smooth straight line, the points do not appear, and hence on the ladder rungs which has pretty smooth horizontal edge features, points are hard to come by and a rectangle is hard to detect.  ​ However, as can be seen circled in red, when there is a smooth straight line, the points do not appear, and hence on the ladder rungs which has pretty smooth horizontal edge features, points are hard to come by and a rectangle is hard to detect.  ​
  
-{{dylanw:contourPointsLadder.jpg}}\\ ​+{{dylanw:contourpointsladder.jpg}}\\ ​
  
 This means that one of the adjustments I made during my previous trial run, which was intended to smoothen the sides of the spaces in between ladder rungs by covering up the sides, should make the ladder rungs more difficult to be detected. However the opposite occur. ​ This means that one of the adjustments I made during my previous trial run, which was intended to smoothen the sides of the spaces in between ladder rungs by covering up the sides, should make the ladder rungs more difficult to be detected. However the opposite occur. ​
Line 187: Line 185:
 (I made the left cover slanted to achieve more points along vertical and prove my point) (I made the left cover slanted to achieve more points along vertical and prove my point)
  
-{{dylanw:contourPointsCoveredLadder.jpg}}\\ ​+{{dylanw:contourpointscoveredladder.jpg}}\\ ​
  
 When the ladder is tilted. the detection of rectangles improved greatly (detecting the ladder rungs instead of the spaces in between ladder rungs now by using black colored covers). ​ When the ladder is tilted. the detection of rectangles improved greatly (detecting the ladder rungs instead of the spaces in between ladder rungs now by using black colored covers). ​
Line 195: Line 193:
 Below is a picture of it. Below is a picture of it.
  
-{{dylanw:contourPointsTiltedLadder.jpg}}\\ ​+{{dylanw:contourpointstiltedladder.jpg}}\\ ​
  
 This algorithm which uses contour points and the **approxPolyDP()** function is not effective to detect lines which are perfectly vertical or horizontal to the camera, like the ladder rungs. ​ This algorithm which uses contour points and the **approxPolyDP()** function is not effective to detect lines which are perfectly vertical or horizontal to the camera, like the ladder rungs. ​
Line 217: Line 215:
 Here are some pictures. Here are some pictures.
  
-{{dylanw:ladderRungCanny.jpg}}\\  +{{dylanw:ladderrungcanny.jpg}}\\  
-{{dylanw:ladderRungSpaceCanny.jpg}}\\ ​+{{dylanw:ladderrungspacecanny.jpg}}\\ ​
drexel_darwin_opencv.txt · Last modified: 2016/11/06 19:20 by dwallace