Hey guys. Ive been having problems with something. Im trying to load a picture and put random dots on a square part of that image. Right now I got it to put dots on the whole image but I cant seem to get it to just a certain section of rows and columns. My code is the following:

img = imread('image.png','png');
[X,map] = rgb2ind(img,256);
i=randint(1,200,102720);
X(i)=54;
imshow(X,map);

This code will create 200 random white dots on the image.

Whenever I try to get a certain square section out of the image, it only shows that section and not the entire image. Any suggestions?? Thanks in advance

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.