Halcon?
Halcon은 고급 머신 비전 소프트웨어이다. ( 사용 라이센스부터 엄청 비쌈 ) Halcon은 산업용 이미지 처리 분야에서 자주 사용되는 고급 소프트웨어로, 다양한 기능과 강력한 성능을 자랑한다. 현업에서는 반도체 검사, 로봇 비전, 품질 관리 등 다양한 곳에 활용되고 있다. 하지만 한국어 문서가 없기 때문에 오늘은 Halcon을 공부하면서 자주 사용하는 명령어나 헷갈렸던 함수들을 다시 보기 위해 정리해보았다.
https://www.mvtec.com/products/halcon
HALCON - the powerful Machine Vision Software: MVTec Software
Please note: Once you watch the video, data will be transmitted to Youtube/Google. For more information, see Google Privacy. Activate video MVTec HALCON offers you all the advantages of a commercial, proprietary machine vision standard software. You benefi
www.mvtec.com
1. 반복문
| for ... to ... by ... | 고정 반복 횟수 루프를 작성한다. |
- for Index := Start to End by Step
I:=[]
for Index := 1.3 to 1.6 by 0.1
I := [I,Index]
endfor
2. 디버그 및 실행 제어
| dev_update_off() | 창/변수/PC 업데이트 비활성화 | dev_update_off() |
| dev_update_on() | 업데이트 다시 활성화 | dev_update_on() |
| stop() | 중단점 지정 (F9) | stop() |
dev_update_off ()
* do something
dev_update_on ()
3. 파일 및 이미지 불러오기
| list_image_files() | 디렉토리 내 이미지 목록을 가져온다 | list_image_files('.', [], [], ImageFiles) |
| read_image() | 이미지 파일을 읽는다 | read_image(Image, 'monkey') |
| read_image([...]) | 여러 이미지 배열을 한 번에 읽는다 | read_image(Images, ['ic0','ic1','ic2']) |
list_image_files ('.',[] ,[] , ImageFiles)
for Index := 1 to |ImageFiles| by 1
read_image (Image,ImageFiles[Index-1])
* do something
endfor
* Reading an image:
read_image(Image,'mreut')
* Reading 3 images into an image array:
read_image(Images,['ic0','ic1','ic2'])
* Setting of search path for images on '/mnt/images' and '/home/images':
set_system('image_dir','/mnt/images:/home/images')
4. 시각화 관련
| dev_display() | 이미지나 객체를 창에 표시 | dev_display(Image) |
| dev_set_color() | 출력 색상 설정 | dev_set_color('red') |
| dev_set_draw() | 'fill' 또는 'margin' 모드 설정 | dev_set_draw('margin') |
| dev_disp_text() | 창에 텍스트 표시 | dev_disp_text('Hello', 'window', 12, 12, 'black', [], []) |
read_image (Image, 'fabrik')
regiongrowing (Image, Regions, 3, 3, 6, 100)
dev_clear_window ()
dev_display (Image)
dev_set_colored (12)
dev_set_draw ('margin')
dev_display (Regions)
5. 이미지 전처리 및 필터
| rgb1_to_gray() | RGB → Grayscale 변환 | rgb1_to_gray(Image, GrayImage) |
| threshold() | 이미지 이진화 | threshold(Image, Region, 100, 200) |
| binary_threshold() | 자동 이진화 | binary_threshold(Image, Region, 'max_separability', 'dark', UsedThreshold) |
| scale_image_max() | 명암 대비 확대 | scale_image_max(Image, ImageScaled) |
| reduce_domain() | 이미지 영역 제한 | reduce_domain(Image, Region, ImageReduced) |
* Transformation from rgb to gray
read_image(Image,'patras')
dev_display(Image)
rgb1_to_gray(Image,GrayImage)
dev_display(GrayImage)
- threshold( Image , Region , MinGray , MaxGray )
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
6. 형태 기반 연산 (Morphology)
| closing_circle() | 원형 커널로 닫기 | closing_circle(Region, RegionClosed, 3.5) |
| opening_circle() | 원형 커널로 열기 | opening_circle(Region, RegionOpened, 3.5) |
| erosion_rectangle1() | 직사각형 커널로 침식 | erosion_rectangle1(Region, RegionEroded, 11, 11) |
| closing_rectangle1() | 직사각형 커널로 닫기 | closing_rectangle1(Region, RegionClosed, 10, 10) |
| fill_up() | 내부 빈 공간 채우기 | fill_up(Region, RegionFilled) |
7. 객체 및 모양 분석
| connection() | 연결된 구성요소 분리 | connection(Region, ConnectedRegions) |
| select_shape() | 조건 기반 영역 선택 | select_shape(Regions, Selected, 'area', 'and', 100, 1000) |
| select_shape_std() | 표준 모양 비교 기반 선택 | select_shape_std(Regions, Selected, 'rectangle1', 80.0) |
| area_center() | 면적 및 중심 좌표 계산 | area_center(Region, Area, Row, Column) |
8. 메트로로지 (정밀 치수 측정)
| create_metrology_model() | 메트로로지 모델 생성 |
| add_metrology_object_rectangle2_measure() | 측정할 사각형 정의 |
| apply_metrology_model() | 이미지에 모델 적용 |
| get_metrology_object_result_contour() | 윤곽선 결과 추출 |
| clear_metrology_object() | 메트릭 객체 삭제 |
9. XLD 윤곽선 처리
| gen_cross_contour_xld() | 십자 표시 생성 |
| gen_arrow_contour_xld() | 화살표 표시 생성 |
| gen_polygons_xld() | 다각형 근사 |
| split_contours_xld() | 윤곽선 분할 |
| length_xld() | 윤곽선 길이 계산 |
| area_center_points_xld() | XLD 영역 면적 및 중심 계산 |
| min() | 튜플 내 최소값 | min([131, 121, 15, 71]) → 15 |
| max() | 튜플 내 최대값 | max([131, 121, 15, 71]) → 131 |
| deg() | rad → degree 변환 | deg(1.5708) → '90.00' |
| tuple_concat() | 두 튜플 연결 | tuple_concat([1,2], [3,4], T3) |
Length := [131,121,15,71]
minlength := min(Length)
maxlength := max(Length)
https://www.mvtec.com/doc/halcon/13/en/toc_control.html
Control [HALCON Operator Reference / Version 13.0.4]
Use the tabs on the upper right to switch to a different programming language. Use the tabs on the upper right to switch to a different programming language. Use the tabs on the upper right to switch to a different programming language. Use the tabs on the
www.mvtec.com
'Memo' 카테고리의 다른 글
| [Memo] 분석에서 활용할 수 있는 공개 데이터 사이트 모음 (0) | 2025.02.18 |
|---|---|
| [Memo] Anaconda 가상환경 자주 쓰는 명령어 정리 (2) | 2024.12.26 |
| [Memo] 리눅스 (Linux) vi 편집기 명령어 35개 정리 (3) | 2024.03.27 |
| [Memo] 유닉스 (Unix) / 리눅스 (Linux) 자주 쓰는 명령어 50개 정리 (4) | 2024.03.26 |