반응형
250x250
Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Archives
Today
Total
관리 메뉴

폴크(FOLC)

C# - 머신 비전 알고리즘 - OpenCV - 이미지처리11 본문

머신 비전/머신 비전 알고리즘 테크닉 C#

C# - 머신 비전 알고리즘 - OpenCV - 이미지처리11

folcjin 2021. 10. 19. 09:29
728x90
반응형

# 디지털 이미지 처리
   # 이미지의 상태 정보에서 일반적인 정보를 생성한다.
      > 추출된 정보를 일반화한다.

# 이미지 처리 - OpenCV 4.5.3 으로 테스트
   # 이미지의 상태 정보에서 일반적인 정보를 생성
   > Points : 입력, line_result : 결과, param : 수치형 매개변수(0 일때 최적화 자동 선택)
   > reps : 정확도(거리), aeps : 정확도(각도), dp : 해상도, param1 : canny 최대값, param2 : 최소 반지름

# Cv2.FitLine
   > List<Point2f> Points = new List<Point2f>();
   > DistanceTypes distType = DistanceTypes.L2;
   > double param = 0.0, reps = 0.01, aeps = 0.01;
   > Line2D line_result = Cv2.FitLine(Points, distType, param, reps, aeps);
   > double x0 = line_result.X1;
   > double y0 = line_result.Y1;
   > double x1 = x0 - (200.0 * line_result.Vx); // 200 길이를 갖는 벡터 추가 X 방향
   > double y1 = y0 - (200.0 * line_result.Vy); // 200 길이를 갖는 벡터 추가 Y 방향

# Cv2.FitEllipse
   > RotatedRect result1 = Cv2.FitEllipse(Points);
   > RotatedRect result2 = Cv2.FitEllipseAMS(Points);
   > RotatedRect result3 = Cv2.FitEllipseDirect(Points);

   > RotatedRect 안에 BoundingBox, Center PointXY, SizeXY, Angle 값이 존재

# Cv2.HoughLines
   > double thresh1 = 128.0, thresh2 = 228.0, max_val = 255.0;
   > ThresholdTypes type = ThresholdTypes.Binary;
   > Cv2.Threshold(srcImage, dstImage, thresh1, max_val, type);
   > Mat dstcannyImage = new Mat();
   > Cv2.Canny(srcImage, dstcannyImage, thresh1, thresh2);
   > double rho = 1.0, theta = Cv2.PI / 180.0, srn = 0.0, stn = 0.0;
   > int threshold = 150;
   > List<LineSegmentPolar> line_result1 = Cv2.HoughLines(dstcannyImage, rho, theta, threshold, srn, stn).ToList();

# Cv2.HoughLinesP
   > double minLineLength = 0.0, maxLineGap = 0.0;
   > List<LineSegmentPoint> line_result2 = Cv2.HoughLinesP(dstcannyImage, rho, theta, threshold, minLineLength, maxLineGap).ToList();

# Cv2.HoughCircles
   > HoughModes method = HoughModes.Gradient;
   > double dp = 1.0, minDist = 100, param1 = 228.0, param2 = 100;
   > int minRadius = 0, maxRadius = 0;
   > List<CircleSegment> circle_result = Cv2.HoughCircles(dstcannyImage, method, dp, minDist, param1, param2, minRadius, maxRadius).ToList();

728x90
반응형
사업자 정보 표시
사업자 등록번호 : -- | TEL : --