how do i use the rand command in an array of an image, i want the program to read the image and draw some elements from that array

1 visualización (últimos 30 días)
Como uso o comando rand em uma matriz de uma imagem? Quero que o programa leia a imagem e desenhe alguns elementos dessa matriz.
  2 comentarios
Ajay Kumar
Ajay Kumar el 12 de Oct. de 2019
what is the size of image? and what size do you want in the output matrix?
Felipe Koga
Felipe Koga el 19 de Oct. de 2019
seria de uma imagem qualquer, size(x), eu queria sortear pontos dentro da matriz dessa imagem, como se fosse o comando ''impixel'' , porem com pontos sorteado ao inves de selecionados

Iniciar sesión para comentar.

Respuestas (2)

Image Analyst
Image Analyst el 13 de Oct. de 2019
Try something like this:
randomIndexes = randperm(numel(grayImage), numIndexes);
extractedPixels = grayImage(randomIndexes);
where grayImage is your grayscale image, and numIndexes is the number of pixels you want to extract from the full image.

Felipe Koga
Felipe Koga el 14 de Oct. de 2019
obrigado !!

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by