일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- probability
- 김양재
- c++
- 빅 데이타
- 김양재 목사님
- WebGL
- 김양재 목사
- Machine Learning
- 통계
- data science
- 몽고디비
- 인공지능
- 데이터 과학
- openCV
- R
- 주일설교
- Big Data
- node.js
- 우리들교회
- nodeJS
- 빅데이타
- 확률
- 빅데이터
- Artificial Intelligence
- Statistics
- MongoDB
- 빅 데이터
- Deep learning
- 딥러닝
- No SQL
- 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 |