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.
댓글 수: 0
채택된 답변
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
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
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 Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!