박민혀기
CELLON I 시료 걸쇠 Canny 추출 본문
CELLON I 시료 걸쇠 Canny 추출
최적 Threshold
Low Threshold = 10
High Threshold = 50
블러링 X
샤프링 X
GrayScale 원본에서 추출
추출 & 저장 소스 코드
#pragma comment(lib, "opencv_world453.lib")
#pragma comment(lib, "opencv_world453d.lib")
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
int main(){
for (int i = 8; i < 23; i++) {
char file_name[80];
sprintf_s(file_name, "C:\\Users\\MinHyeok\\Downloads\\capture_%d.png", i);
Mat img = imread(file_name, IMREAD_GRAYSCALE);
if (img.empty()) {
cout << "can't find Image" << endl;
continue;
}
//Mat Gaussian_img, result;
//GaussianBlur(img, Gaussian_img, Size(5, 5), 1);
//addWeighted(img, 6, Gaussian_img, -5, 0, result);
//int kernel_size = 3;
//int scale = 1;
//int delta = 0;
//int ddepth = CV_32F;
//cv::Mat scharr_x, scharr_y, scharr_x_result, scharr_y_result;
////cv::Sobel(result, sobel_x, ddepth, 1, 0);
////cv::Sobel(result, sobel_y, ddepth, 0, 1);
//// Scharr Filter
//cv::Sobel(img, scharr_x, cv::FILTER_SCHARR, 1, 0);
//cv::Sobel(img, scharr_y, cv::FILTER_SCHARR, 0, 1);
//cv::Sobel(result, scharr_x_result, cv::FILTER_SCHARR, 1, 0);
//cv::Sobel(result, scharr_y_result, cv::FILTER_SCHARR, 0, 1);
//Mat add_result;
//addWeighted(scharr_x_result, 0.5, scharr_y_result, 0.5, 0, add_result);
//imshow("scharr_x", scharr_x);
//imshow("scharr_y", scharr_y);
//imshow("scharr_x_result", scharr_x_result);
//hconcat(img, scharr_y_result, img);
Mat canny_img;
Canny(img, canny_img, 10, 50);
hconcat(img, canny_img, img);
sprintf_s(file_name, "C:\\Users\\MinHyeok\\Desktop\\Canny_Result\\Canny_%d.jpg", i);
imwrite(file_name, img);
}
추출 이미지 왼쪽 상단 : 1번
오른쪽 상단 : 2번
왼쪽 하단 : 3번
오른쪽 하단 : 4번
Canny_Result.zip
1.82MB
위에 이미지 원본 다운
결과 : 2, 4번은 환연하게 판단 가능 하지만 1, 3번은 기본적으로 추출자체가 쉽지 않고, 추출이 되더라도 잡음이 많아 프로그램 처리 과정에서 판단 하는게 쉽지 않아 보인다!
해결법 : Sobel 필더링으로 해결 가능해 보임
※ 다음 포스팅에 비교사진, 결과 업로드!
'CELLON Vision > Test Result' 카테고리의 다른 글
CELLON I 뒷판 Sobel 필터링 양품, 불량품 결과 (0) | 2023.03.23 |
---|---|
CELLON I 시료 걸쇠 Sobel 추출 (1) | 2023.03.20 |
CELLON 광량, 진동의 따른 HSV 값 변화, Yellow Color (0) | 2023.01.02 |
히스토그램 컴페어 테스트 파일 (0) | 2022.12.19 |
비전 검사기 Model CELLON 시간 측정(2022년 11월 06일) (0) | 2022.11.06 |