Creating checkerboard image without inbuilt function and for loop
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Arturo Jr. Ongkeko
am 17 Mär. 2021
Beantwortet: Prudhvi Peddagoni
am 22 Mär. 2021
Hi,
I saw this code online and it works! It can indeed generate the checboard image but I hope you can enlighten me how each line actually works in creating the checkboard.
Thank you!
im=255*ones(800,800,'uint8');
im(1:100,101:200,:)=zeros(100,100,'uint8');
im(1:100,201:400,:)=im(1:100,1:200,:);
im(1:100,401:800,:)=im(1:100,1:400,:);
im(101:200,1:700,:)=im(1:100,101:800,:);
im(201:400,:,:)=im(1:200,:,:);
im(401:800,:,:)=im(1:400,:,:);
imshow(im)
rectangle('position',[1 1 799 799]);
0 Kommentare
Akzeptierte Antwort
Prudhvi Peddagoni
am 22 Mär. 2021
Hi,
In the image matrix, 255 means highest intensity (white) and 0 means lowest intensity(black). First the white background is created and later the black boxes are added to it. You can add imshow(im) command after each step and instead of running the whole code, you can use step button to run each command and see the changes.
hope this helps.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!