카테고리
Package Drillpackage-drill
코드와 해설을 함께 읽는 학습 문서
Code Detail
Visualization 중심의 Octave 학습 예제
ex-pkg/ex-image.m
코드를 복사해 Octave에서 바로 실행할 수 있습니다.
39 lines
run("../startup.m")
pkg load image
% 예제 1: 이미지 로드 및 표시
% 이미지 파일 로드 (예: 'image.jpg' 파일)
img = imread('purple neon border circle 300.png');
% 예제 2: 이미지 그레이스케일로 변환
gray_img = rgb2gray(img);
% 예제 3: 이미지의 경계선 감지 (엣지 검출)
edge_img = edge(gray_img, 'Canny');
% 예제 4: 이미지를 회전 (90도)
rotated_img = imrotate(img, 90);
param_f = {"Size", [960, 960], "Name", "Image Manipulation"};
param_a = {
"XLabel", "", "Ylabel", "", ...
};
fig = figured(param_f);
ax = subplots(2, 2, param_a);
imshow(img, "parent", ax(1, 1));
imshow(gray_img, "parent", ax(1, 2));
imshow(edge_img, "parent", ax(2, 1));
imshow(rotated_img, "parent", ax(2, 2));
set(ax(1, 1), "title", "원본 이미지");
set(ax(1, 2), "title", "그레이스케일 이미지");
set(ax(2, 1), "title", "엣지 감지 결과 (Canny 알고리즘)");
set(ax(2, 2), "title", "회전된 이미지");
# set(ax(1, 1), "position", [0.05, 0.52, 0.42, 0.42]); % 좌측 상단
# set(ax(1, 2), "position", [0.53, 0.52, 0.42, 0.42]); % 우측 상단
# set(ax(2, 1), "position", [0.05, 0.05, 0.42, 0.42]); % 좌측 하단
# set(ax(2, 2), "position", [0.53, 0.05, 0.42, 0.42]); % 우측 하단
ex-pkg/ex-cms.m
ex-pkg/ex-control.m
ex-pkg/ex-fmt.m
ex-pkg/ex-fstring.m
ex-pkg/ex-io.m
ex-pkg/ex-optim.m
ex-pkg/ex-signal.m
ex-pkg/ex-statistics.m