Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function out = circle(Im,value,center_x,center_y,r) #Image to insert a circle, the color value of the circle, the x coordinate of the circle center, the y coordinate of the circle center, the radius of the circle
- out = [];
- if value != 0 && value != 1
- return
- endif
- for i = 1:rows(Im)
- for j = 1:columns(Im)
- Im(i,j) = ifelse(sqrt((j-center_x)^2 + (i-center_y)^2) <= r,value,Im(i,j));
- endfor
- endfor
- out = Im;
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement