필터 지우기
필터 지우기

Calculate center of image

조회 수: 23 (최근 30일)
lotus whit
lotus whit 2017년 11월 23일
댓글: Image Analyst 2017년 11월 24일
i would ask how I can draw line pass through the center of image then across whole image end to end
figure ,imshow(whole_image)
figure,imshow(whole_image)
whole_image = imresize(whole_image,[500 750]);
se=strel('disk',50);
img_2=imdilate(whole_image,se);
di_imag = imdilate(whole_image,se);
imshow(di_imag), title('dilated')
rstats_w = regionprops(whole_image, 'Centroid');
Center_word =rstats_w.Centroid;%calculate center of word
hold on;
p1 = [Center_word(1) 0];
p2 = [Center_word(1) 750]
plot (p1,p2)

채택된 답변

KSSV
KSSV 2017년 11월 24일
I = imread('coins.png');
[ny,nx] = size(I) ;
imshow(I) ;
hold on
% Center
C = round([nx ny]/2) ;
plot(C(1),C(2),'*r') % mid point/ center of image
%%Draw line
P1 = [1 nx] ;
P2 = [C(2) C(2)] ;
plot(P1,P2,'b')
%
P3 = [C(1) C(1)] ;
P4 = [1 ny] ;
plot(P3,P4,'b')
  댓글 수: 2
lotus whit
lotus whit 2017년 11월 24일
Thanks
Image Analyst
Image Analyst 2017년 11월 24일
This will plot in the overlay above the image. If you want to burn the lines actually into the pixels of the image, see the attached demo.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by