반응형
250x250
Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
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 29 30 31
Archives
Today
Total
관리 메뉴

폴크(FOLC)

치수 계산하기 본문

카테고리 없음

치수 계산하기

folcjin 2025. 6. 19. 14:30
728x90
반응형

치수를 측정하는 소프트웨어는 반도체 공정 등에서 매우 중요한 역할을 하며, 일반적으로 엣지 검출, 바이너리 마스크 처리, 프로파일 분석 등이 있다.

목적
- 이미지에서 관심 영역(ROI)을 지정한 후
-
경계(edge)를 검출하여
-
임계 치수를 측정(Critical Dimension, CD)하는 간단한 알고리즘

 

예제

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;

// 임계 치수 측정 함수
double measureCD(const Mat& binary) {
    vector<vector<Point>> contours;
    findContours(binary, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);

    if (contours.empty()) return -1;

    double minWidth = DBL_MAX;

    for (const auto& contour : contours) {
        Rect bbox = boundingRect(contour);
        if (bbox.width < minWidth) {
            minWidth = bbox.width;
        }
    }

    return minWidth;
}

int main(int argc, char** argv) {
    if (argc < 2) {
        cout << "Usage: ./CDMeasurement <image_path>" << endl;
        return -1;
    }

    // 이미지 읽기 (Grayscale)
    Mat src = imread(argv[1], IMREAD_GRAYSCALE);
    if (src.empty()) {
        cerr << "Error loading image!" << endl;
        return -1;
    }

    // 전처리: 블러 + 임계처리
    Mat blurred, binary;
    GaussianBlur(src, blurred, Size(5, 5), 1.0);
    threshold(blurred, binary, 0, 255, THRESH_BINARY | THRESH_OTSU);

    // CD 측정
    double cd = measureCD(binary);
    if (cd >= 0)
        cout << "Measured Critical Dimension: " << cd << " pixels" << endl;
    else
        cout << "No valid structure found for CD measurement." << endl;

    // 결과 시각화
    imshow("Source", src);
    imshow("Binary", binary);
    waitKey(0);
    return 0;
}

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