how to Initialize the starting point for region growth.
4 views (last 30 days)
Show older comments
how to Initialize the starting point for region growth.
Using the [x,y] coordinates entered by the user, initialize the image
so that only the point (x,y) is at “1” and the rest of the image is at “0”.
knowing that the x coordinate indicates the column number and the coordinate
y indicates the line number in the image.
0 Comments
Accepted Answer
Voss
on 7 May 2022
"only the point (x,y) is at “1” and the rest of the image is at “0”. knowing that the x coordinate indicates the column number and the coordinate y indicates the line [row] number in the image."
Assuming you have gotten x and y from the user already, one way or another, then to initialize such an image, you can do this:
image_size = [100 100];
x = 30; % 30th column in image
y = 44; % 44th row in image
image_matrix = zeros(image_size); % initialize image to a matrix of all zeros of the specified size
image_matrix(y,x) = 1; % set element at row y, column x to 1
imshow(image_matrix)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!