create a loop to determine the pixel distance from the center using the distance formula
조회 수: 1 (최근 30일)
이전 댓글 표시
using the distance formula I need to find the the pixel distance from the center of my image 'sunflower.jpg'. I have found the center of my image im just cofused on how to write the loop and what values my x and y would be.
d^2 = (x-x_c)^2 + (y-y_c)^2 (distance formula)
댓글 수: 0
채택된 답변
Setsuna Yuuki.
2020년 11월 12일
편집: Setsuna Yuuki.
2020년 11월 12일
you just have to move (x, y).
(x_c, y_x) are fixed.
image = imread('sunflower,jpg');
[l,h,~] = size(image);
%(x_c,y_c) = center of image
for x=1:l
for y=1:h
d = sqrt((x-x_c)^2+(y-y_c)^2);
end
end
댓글 수: 6
Setsuna Yuuki.
2020년 11월 13일
편집: Setsuna Yuuki.
2020년 11월 13일
what is color ??
VinColor = Color * (1-r.^2) %maybe can be like that if r is a vector
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!