how to create a Image using matrix

조회 수: 4 (최근 30일)
Der Turbanator
Der Turbanator 2018년 5월 3일
댓글: Der Turbanator 2018년 5월 3일
I want to create a circle IMAGE using matrix . i dont know much of matrix but if anyone can help me will be great creating image of circle like black background and white circle using matlab :)

채택된 답변

jonas
jonas 2018년 5월 3일

추가 답변 (1개)

KSSV
KSSV 2018년 5월 3일
편집: KSSV 2018년 5월 3일
th = linspace(0,2*pi) ; % theta
r = 100 ; % radius of circle
x = r*cos(th) ;
y = r*sin(th) ;
N = 500 ; % dimensions of image
I = zeros(N,N,3) ;
c = round(N/2) ; % center of circle
x = c+x ; y = y+c ;
[X,Y] = meshgrid(1:N,1:N) ;
idx = inpolygon(X(:), Y(:),x,y) ;
for i = 1:3
T = I(:,:,i) ;
T(idx) = 255 ;
I(:,:,i) = T ;
end
  댓글 수: 1
Der Turbanator
Der Turbanator 2018년 5월 3일
i need that for 1:5 i have tried but its not getting into 1:5 ratio or to say meshgrid

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

Community Treasure Hunt

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

Start Hunting!

Translated by