How to overlay randomized point grid on photo?

조회 수: 1 (최근 30일)
Harriet Minc
Harriet Minc 2017년 10월 18일
댓글: Cedric 2017년 10월 21일
I need to take a randomized point grid with the code:
x=rand(1,50)*5
y=rand(1,50)*5
scatter(x,y)
And overlay it onto a picture. I am not sure if this can be done or how to do it? Any help would be appreciated!
  댓글 수: 1
Jonathan Chin
Jonathan Chin 2017년 10월 18일
im=imread('peppers.png');
imshow(im);
hold on
x=rand(1,50)*512
y=rand(1,50)*384
scatter(x,y)

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

답변 (1개)

Cedric
Cedric 2017년 10월 18일
편집: Cedric 2017년 10월 18일
I = imread( 'MyImage.png' ) ;
x = rand( 1, 50 ) * size( I, 2 ) ;
y = rand( 1, 50 ) * size( I, 1 ) ;
imshow( I ) ;
hold on ;
scatter( x, y ) ;
  댓글 수: 1
Cedric
Cedric 2017년 10월 21일
Is this answer working for you? If so please [Accept it]. If not, I am happy to provide more information.

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

Community Treasure Hunt

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

Start Hunting!

Translated by