int main(
int argc,
char** argv)
{
Mat dst, cdst, cdstP;
const char* default_file = "sudoku.png";
const char* filename = argc >=2 ? argv[1] : default_file;
if(src.empty()){
printf(" Error opening image\n");
printf(" Program Arguments: [image_name -- default %s] \n", default_file);
return -1;
}
Canny(src, dst, 50, 200, 3);
cdstP = cdst.clone();
vector<Vec2f> lines;
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);
double x0 = a*rho, y0 = b*rho;
}
vector<Vec4i> linesP;
for( size_t i = 0; i < linesP.size(); i++ )
{
}
imshow(
"Detected Lines (in red) - Standard Hough Line Transform", cdst);
imshow(
"Detected Lines (in red) - Probabilistic Line Transform", cdstP);
return 0;
}
Point2i Point
Definition: modules/core/include/opencv2/core/types.hpp:209
Scalar_< double > Scalar
Definition: modules/core/include/opencv2/core/types.hpp:709
Vec< int, 4 > Vec4i
Definition: matx.hpp:454
Quat< T > cos(const Quat< T > &q)
Quat< T > sin(const Quat< T > &q)
cv::String findFile(const cv::String &relative_path, bool required=true, bool silentMode=false)
Try to find requested data file.
int cvRound(double value)
Rounds floating-point number to the nearest integer.
Definition: fast_math.hpp:200
#define CV_PI
Definition: cvdef.h:380
void imshow(const String &winname, InputArray mat)
Displays an image in the specified window.
int waitKey(int delay=0)
Waits for a pressed key.
@ IMREAD_GRAYSCALE
If set, always convert image to the single channel grayscale image (codec internal conversion).
Definition: imgcodecs.hpp:70
CV_EXPORTS_W Mat imread(const String &filename, int flags=IMREAD_COLOR_BGR)
Loads an image from a file.
void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0, AlgorithmHint hint=cv::ALGO_HINT_DEFAULT)
Converts an image from one color space to another.
@ COLOR_GRAY2BGR
Definition: imgproc/include/opencv2/imgproc.hpp:557
void line(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws a line segment connecting two points.
@ LINE_AA
antialiased line
Definition: imgproc/include/opencv2/imgproc.hpp:894
void Canny(InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false)
Finds edges in an image using the Canny algorithm .
void HoughLines(InputArray image, OutputArray lines, double rho, double theta, int threshold, double srn=0, double stn=0, double min_theta=0, double max_theta=CV_PI, bool use_edgeval=false)
Finds lines in a binary image using the standard Hough transform.
void HoughLinesP(InputArray image, OutputArray lines, double rho, double theta, int threshold, double minLineLength=0, double maxLineGap=0)
Finds line segments in a binary image using the probabilistic Hough transform.
int main(int argc, char *argv[])
Definition: highgui_qt.cpp:3
Definition: core/include/opencv2/core.hpp:107