how can i perform operations on the basis of image location?

1 次查看(过去 30 天)
I have 2 vectors containing x and y location of a point of an image. My actual image size is 1024*1024 and i have extracted nearly 660 points. these points having x and y location of my image. how can i create a new image in which, value 0 occurs at extracted points and 1 at other locations.

采纳的回答

Image Analyst
Image Analyst 2014-6-12
outputImage = zeros(size(grayImage)); % Initialize image to 0.
for k = 1 : length(x);
outputImage(y(k), x(k)) = 1;
end
Use false instead of zeros if you want a binary (logical) image instead of a double.

更多回答(1 个)

imene mannou
imene mannou 2014-6-12
编辑:Image Analyst 2014-6-12
result=I;
result(:,:)=1;
for i=1:length(x)
result(x(i),y(i))=0;
end
  2 个评论
VIJENDRA
VIJENDRA 2014-6-12
编辑:VIJENDRA 2014-6-12
I have 2 vectors of size 660 i.e. I have row and column information of the points. 1st vector is containing column number and second vector is containing row number. how could i generate a new image from those 2 reference vectors which have 1's at the point locations and 0's elsewere?
Image Analyst
Image Analyst 2014-6-12
imene made a common mistake of thinking that array indices are (x,y). They are not, they are (y,x) because the first index is the row, which is the y value.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by