diff --git a/Output_Images/output1.jpg b/Output_Images/output1.jpg new file mode 100644 index 0000000..e49ba69 Binary files /dev/null and b/Output_Images/output1.jpg differ diff --git a/Output_Images/output10.jpg b/Output_Images/output10.jpg new file mode 100644 index 0000000..ac25bbc Binary files /dev/null and b/Output_Images/output10.jpg differ diff --git a/Output_Images/output11.jpg b/Output_Images/output11.jpg new file mode 100644 index 0000000..f042479 Binary files /dev/null and b/Output_Images/output11.jpg differ diff --git a/Output_Images/output2.jpg b/Output_Images/output2.jpg new file mode 100644 index 0000000..3e1335b Binary files /dev/null and b/Output_Images/output2.jpg differ diff --git a/Output_Images/output3.jpg b/Output_Images/output3.jpg new file mode 100644 index 0000000..0e8b7e2 Binary files /dev/null and b/Output_Images/output3.jpg differ diff --git a/Output_Images/output4.jpg b/Output_Images/output4.jpg new file mode 100644 index 0000000..9857e4b Binary files /dev/null and b/Output_Images/output4.jpg differ diff --git a/Output_Images/output5.jpg b/Output_Images/output5.jpg new file mode 100644 index 0000000..d148437 Binary files /dev/null and b/Output_Images/output5.jpg differ diff --git a/Output_Images/output6.jpg b/Output_Images/output6.jpg new file mode 100644 index 0000000..5179ffd Binary files /dev/null and b/Output_Images/output6.jpg differ diff --git a/Output_Images/output7.jpg b/Output_Images/output7.jpg new file mode 100644 index 0000000..c35cfdc Binary files /dev/null and b/Output_Images/output7.jpg differ diff --git a/Output_Images/output8.jpg b/Output_Images/output8.jpg new file mode 100644 index 0000000..a7c8d22 Binary files /dev/null and b/Output_Images/output8.jpg differ diff --git a/Output_Images/output9.jpg b/Output_Images/output9.jpg new file mode 100644 index 0000000..998f01a Binary files /dev/null and b/Output_Images/output9.jpg differ diff --git a/auv_task.cpp b/auv_task.cpp new file mode 100644 index 0000000..7bb5420 --- /dev/null +++ b/auv_task.cpp @@ -0,0 +1,162 @@ +#include "opencv2/highgui/highgui.hpp" +#include +#include +#include + +using namespace cv; + +using namespace std; +int main(int argc, char *argv[]) +{ + Mat img = imread(argv[1], 1); + Mat img1 = imread(argv[1],1 ); + Mat grayimg= imread(argv[1], 0); + Mat canny_output; + int low_threshold=50; + int high_threshold=100; + Mat img_output; + namedWindow("Output Image", WINDOW_AUTOSIZE); + namedWindow("Canny", WINDOW_AUTOSIZE); + Canny(img, canny_output, low_threshold, high_threshold); + vector lines; + std::vector o_lines; + HoughLines(canny_output, lines, 0.01, CV_PI/180, 120); + int count=0; + for( size_t i = 0; i < lines.size(); i++ ) + { + float rho = lines[i][0], theta = lines[i][1]; + double a = cos(theta), b = sin(theta); + + float alpha=theta*180/CV_PI; + if((fabs(alpha)==0 or fabs(alpha)==90 )){ + if (rho>7 and rhopt1.x){ + px1.x=pt1.x; + } + } + if(alpha==90){ + if(py1.y > contours; + vector hierarchy; + if (origin.x>500){ + origin.x=img.cols/5; + } + if (origin.y<=0){ + origin.y=img.rows-img.rows/5; + } + // This Part of code was used to detect and print contours in an image. + // This code is commented to show the flow of code. + + findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); + Mat drawing = Mat::zeros( canny_output.size(), CV_8UC3 ); + for( int i = 0; i< contours.size(); i++ ) + { + Scalar color = Scalar( 0, 255, 0 ); + drawContours( drawing, contours, i, color, 2, 8, hierarchy, 0, Point() ); + } + for(size_t i=0; iorigin.x or contours[i][j].x==1 or contours[i][j].x+1==img.cols ){//contours[i][j].y