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 (최근 30일)
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
Ajay Kumar
Ajay Kumar 2019년 10월 12일
what is the size of image? and what size do you want in the output matrix?
Felipe Koga
Felipe Koga 2019년 10월 19일
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

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2019년 10월 13일
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 2019년 10월 14일
obrigado !!

태그

Community Treasure Hunt

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

Start Hunting!

Translated by