일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 빅 데이터
- 주일설교
- 김양재 목사님
- 빅데이터
- Statistics
- Big Data
- openCV
- 확률
- 김양재
- nodeJS
- 인공지능
- Deep learning
- No SQL
- 몽고디비
- Artificial Intelligence
- 빅데이타
- 우리들교회
- 빅 데이타
- probability
- 김양재 목사
- data science
- 통계
- 데이터 과학
- Machine Learning
- node.js
- MongoDB
- R
- c++
- 딥러닝
- WebGL
- Today
- Total
Scientific Computing & Data Science
[Image Processing] Edge Detector / Homogeneity Operator 본문
[Image Processing] Edge Detector / Homogeneity Operator
cinema4dr12 2014. 6. 7. 11:26MATLAB CODE: "HomogeneityOperator.m"
function HomogeneityOperator %% read an image img = imread('./res/test_02.jpg'); imshow(img); img = rgb2gray(img); subplot(2,1,1); [nrow, ncol] = size(img); img = cast(img, 'double'); newImg = zeros(nrow,ncol); % Corners i = 1; j = 1; tmp(1) = abs(img(i,j) - img(i,j+1)); tmp(2) = abs(img(i,j) - img(i+1,j+1)); tmp(3) = abs(img(i,j) - img(i+1,j)); newImg(i,j) = max(tmp); i = 1; j = ncol; tmp(1) = abs(img(i,j) - img(i+1,j)); tmp(2) = abs(img(i,j) - img(i+1,j-1)); tmp(3) = abs(img(i,j) - img(i,j-1)); newImg(i,j) = max(tmp); i = nrow; j = ncol; tmp(1) = abs(img(i,j) - img(i,j-1)); tmp(2) = abs(img(i,j) - img(i-1,j-1)); tmp(3) = abs(img(i,j) - img(i-1,j)); newImg(i,j) = max(tmp); i = nrow; j = 1; tmp(1) = abs(img(i,j) - img(i-1,j)); tmp(2) = abs(img(i,j) - img(i-1,j+1)); tmp(3) = abs(img(i,j) - img(i,j+1)); newImg(i,j) = max(tmp); % Edges i = 1; for(j = 2:ncol-1) tmp(1) = abs(img(i,j) - img(i,j-1)); tmp(2) = abs(img(i,j) - img(i+1,j-1)); tmp(3) = abs(img(i,j) - img(i+1,j)); tmp(4) = abs(img(i,j) - img(i+1,j+1)); tmp(5) = abs(img(i,j) - img(i,j+1)); newImg(i,j) = max(tmp); end i = nrow; for(j = 2:ncol-1) tmp(1) = abs(img(i,j) - img(i,j-1)); tmp(2) = abs(img(i,j) - img(i-1,j-1)); tmp(3) = abs(img(i,j) - img(i-1,j)); tmp(4) = abs(img(i,j) - img(i-1,j+1)); tmp(5) = abs(img(i,j) - img(i,j+1)); newImg(i,j) = max(tmp); end j = 1; for(i = 2:nrow-1) tmp(1) = abs(img(i,j) - img(i-1,j)); tmp(2) = abs(img(i,j) - img(i-1,j+1)); tmp(3) = abs(img(i,j) - img(i,j+1)); tmp(4) = abs(img(i,j) - img(i+1,j+1)); tmp(5) = abs(img(i,j) - img(i+1,j)); newImg(i,j) = max(tmp); end j = ncol; for(i = 2:nrow-1) tmp(1) = abs(img(i,j) - img(i+1,j)); tmp(2) = abs(img(i,j) - img(i+1,j-1)); tmp(3) = abs(img(i,j) - img(i,j-1)); tmp(4) = abs(img(i,j) - img(i-1,j-1)); tmp(5) = abs(img(i,j) - img(i-1,j)); newImg(i,j) = max(tmp); end % Inner for(i = 2:nrow-1) for(j = 2:ncol-1) tmp(1) = abs(img(i,j)-img(i-1,j-1)); tmp(2) = abs(img(i,j)-img(i-1,j)); tmp(3) = abs(img(i,j)-img(i-1,j+1)); tmp(4) = abs(img(i,j)-img(i,j-1)); tmp(5) = abs(img(i,j)-img(i,j+1)); tmp(6) = abs(img(i,j)-img(i+1,j-1)); tmp(7) = abs(img(i,j)-img(i+1,j)); tmp(8) = abs(img(i,j)-img(i+1,j+1)); newImg(i,j) = max(tmp); end end subplot(2,1,2); newImg = cast(newImg, 'uint8'); imshow(newImg); end
테스트용 이미지(test_02.jpg)
결과 (위: 원본 이미지, 아래: 에지 검출된 이미지)
'Scientific Computing > Image Processing' 카테고리의 다른 글
[Programming / Image Processing] Binary Image를 Text 파일로 변환하기 (0) | 2016.06.10 |
---|---|
[Image Processing] Edge Detector / Laplacian (0) | 2014.06.07 |
[Image Processing] Sharpening (0) | 2014.06.06 |
[Image Processing] Gaussian Blurring (0) | 2014.06.06 |
[Image Processing] Blurring (0) | 2014.06.06 |