I am trying to create a rectangle image as you see but I have a problem with the equation part of the rectangle. Can anyone help to fix this up? Thank you in advance.
function outimg = RectIm(x, y)SizeX = 256;SizeY = 256;[C, R] = meshgrid(1:SizeX, 1:SizeY);centerX = 128;centerY = 128;rectangle = (R - centerY/2)*(C - centerX/2) <= x*y ;outimg=image(rectangle);colormap([0 0 0.4; 1 1 1]);end
Best Answer