how to create a Image using matrix

4 visualizzazioni (ultimi 30 giorni)
Der Turbanator
Der Turbanator il 3 Mag 2018
Commentato: Der Turbanator il 3 Mag 2018
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 :)

Risposta accettata

jonas
jonas il 3 Mag 2018

Più risposte (1)

KSSV
KSSV il 3 Mag 2018
Modificato: KSSV il 3 Mag 2018
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 Commento
Der Turbanator
Der Turbanator il 3 Mag 2018
i need that for 1:5 i have tried but its not getting into 1:5 ratio or to say meshgrid

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by