KDOXG

circle

Nov 24th, 2020
684
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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
  2.   out = [];
  3.   if value != 0 && value != 1
  4.     return
  5.   endif
  6.   for i = 1:rows(Im)
  7.     for j = 1:columns(Im)
  8.       Im(i,j) = ifelse(sqrt((j-center_x)^2 + (i-center_y)^2) <= r,value,Im(i,j));
  9.     endfor
  10.   endfor
  11.   out = Im;
  12. endfunction
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×