동차테이블을 이용한 라벨링 프로그래밍중이다.
공부하면서 중요한거 정리할 예정
관련 논문: SparseCCL: Connected Components Labeling and Analysis for sparse images
참고 페이지
- Connected-component labeling
https://en.wikipedia.org/wiki/Connected-component_labeling#Algorithms
Connected-component labeling - Wikipedia
Connected-component labeling (CCL), connected-component analysis (CCA), blob extraction, region labeling, blob discovery, or region extraction is an algorithmic application of graph theory, where subsets of connected components are uniquely labeled based o
en.wikipedia.org
https://birthxmas.tistory.com/230
[컴퓨터 비전] Connected Component Labeling
□ 문제 1. 첨부된 영상 T-3m1-inv.pgm을 입력으로 하여, 흰 dot영역이 1이되고, 검은 배경영역이 0이 되도록 이진화를 한 후, connected component labeling을 수행하여, 각 dot 영역의 면..
birthxmas.tistory.com
- Binary Image Analysis : 이진화 방법에 대해 자세히 나와있어서 학습에 도움이 된다.
http://www.cse.msu.edu/~stockman/Book/2002/Chapters/ch3.pdf
- Hoshen–Kopelman algorithm
https://en.wikipedia.org/wiki/Hoshen%E2%80%93Kopelman_algorithm
Hoshen–Kopelman algorithm - Wikipedia
From Wikipedia, the free encyclopedia Jump to navigation Jump to search Algorithm for labeling clusters on a grid The Hoshen–Kopelman algorithm is a simple and efficient algorithm for labeling clusters on a grid, where the grid is a regular network of ce
en.wikipedia.org
소스코드
- 2번 기반
if (i == 0 && j == 0) {
if (image.at<uchar>(i, j) > 0) {
label_count++;
result.at<float>(i, j) = label_count;
eq_table[label_count+1] = label_count;
}
}
if (i == 0&&j!=0) {
if (image.at<uchar>(i, j-1) > 0) {
result.at<float>(i, j) = result.at<float>(i, j-1);
}
else {
label_count++;
result.at<float>(i, j) = label_count;
eq_table[label_count + 1] = label_count;
}
}
if (i != 0 && j == 0) {
if (image.at<uchar>(i-1, j) > 0) {
result.at<float>(i, j) = result.at<float>(i-1, j);
}
else {
label_count++;
result.at<float>(i, j) = label_count;
eq_table[label_count + 1] = label_count;
}
}
if ((i != 0&& j != 0)&&image.at<uchar>(i-1, j) > 0 && image.at<uchar>(i, j-1) > 0) { //왼, 위 다 값 있을 때
if (result.at<float>(i - 1, j) > result.at<float>(i, j - 1)) {
result.at<float>(i, j) = result.at<float>(i, j - 1);
}
else {
result.at<float>(i, j) = result.at<float>(i - 1, j);
}
}
if ((i != 0 && j != 0) && image.at<uchar>(i - 1, j) > 0 && image.at<uchar>(i, j - 1) == 0) {
result.at<float>(i, j) = result.at<float>(i - 1, j);
}
if ((i != 0 && j != 0) && image.at<uchar>(i - 1, j) == 0 && image.at<uchar>(i, j - 1) > 0) {
result.at<float>(i, j) = result.at<float>(i, j - 1);
}
if ((i != 0 && j != 0) && image.at<uchar>(i - 1, j) == 0 && image.at<uchar>(i, j - 1) == 0) {
label_count++;
result.at<float>(i, j) = label_count;
eq_table[label_count + 1] = label_count;
}
'컴퓨터비전' 카테고리의 다른 글
[OpenCV] PCA (Principal Component Analysis), 주성분 분석이란 무엇일까? (0) | 2022.07.18 |
---|---|
[Python/OpenCV] 디렉터리에서 이미지 데이터셋 가져와 .npy 로 저장하기 (0) | 2022.05.10 |
[Python/OpenCV] Perspective Transform(투시 변환) (0) | 2022.05.06 |
[Python/OpenCV] Affine Transform (0) | 2022.05.06 |
[C++/OpenCV] 허프 변환 (0) | 2022.03.10 |