MATLAB: How to generate an image 512 pixels x 512 pixels with a square 50 pixels x 50 pixels located at the center

imageMATLAB C/C++ Math Library

How do I generate an image 512 pixels x 512 pixels with a square 50 pixels x 50 pixels located at the center? How would I apply these changes? 8 bit representation, background intensity value 100, square intensity value 150 16 bit representation, background intensity value 1000, square intensity value 1500 Float representation, background intensity value 0.3, square intensity value 0.4

Best Answer

A=zeros(512);
A(232:281,232:281)=1;
a1=uint8(50*A+100);
a2=uint16(500*A+1000);
a3=single(...);