다음은 C++의 코드입니다. 당신이 볼 수있는
![enter image description here](https://i.stack.imgur.com/T7f5h.png)
, 원하는 :이 출력을 얻을 귀하의 의견과
int main()
{
// loading your image. you dont need theses parts
cv::Mat input = cv::imread("../inputData/FormularLineDetection.png");
// convert to grayscale: you will do something similar:
cv::Mat gray;
cv::cvtColor(input, gray, CV_BGR2GRAY);
// computation of binary thresholding so that dark areas of the image will bevcome "foreground pixel".
// If your image have bright features you'll have to choose different parameters.
// If you want to detect contour lines instead you'll compute gradient magnitude first.
cv::Mat mask;
cv::threshold(gray, mask, 0, 255, CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
std::vector<cv::Vec4i> lines;
//cv::HoughLinesP(mask, lines, 1, CV_PI/180.0, 50, 50, 10);
// I've changed the min-Size of a line to 1/3 of the images width. Maybe you'll have to adjust that parameter to your needs!
cv::HoughLinesP(mask, lines, 1, CV_PI/180.0, 50, input.cols/3, 10);
// draw the lines to visualize: you might not do this at all
for(size_t i = 0; i < lines.size(); i++)
{
cv::Vec4i l = lines[i];
cv::line(input, cv::Point(l[0], l[1]), cv::Point(l[2], l[3]), cv::Scalar(0,0,255), 3, CV_AA);
}
// display and save to disk
cv::imshow("mask", mask); // you might not want to display the image here.
cv::imshow("output",input);
cv::imwrite("../outputData/FormularLineDetection.png", input);
cv::waitKey(0);
return 0;
}
: 대부분 OpenCV의 기능을 사용하고 있기 때문에, 당신은 쉽게 안드로이드 CV 할 포트 수있을 것 선이 감지되지만 큰 두께의 "선"도 감지됩니다. 그런 구조를 감지하고 걸러 낼 수 있습니다.
아마 너의 선이 너무 두꺼워서 두꺼운 선에서 너비가 넓은 선들을 많이 볼 수있을 것이다. origibal 이미지를 게시하고 가능하면 검출 된 모든 선이 그려진 이미지를 게시하십시오. – Micka
minLineSize는 픽셀 거리로 측정해야합니다 (아마도 유클리드 또는 대략 유클리드). – Micka
@Micka 이미지가 이제 질문입니다. –