Vingetting an image using loop
Mostrar comentarios más antiguos
This is my work below I keep getting a black image for my vinColor. Any suggestions?
Color = imread('sunflower.jpg');
Center = size(Color)/2+.5;
[l,h,~] = size(Color);
for x=1:l
for y=1:h
d = sqrt((x-Center(1))^2+(y-Center(2))^2);
end
D = 246.9261
r = d./D
end
imshow(Color)
VinColor = Color .* (1-r.^2);
figure(2)
imshow(VinColor)
4 comentarios
Geoff Hayes
el 14 de Nov. de 2020
Yogesh - I don't understand the code within your loops. For example,
for y=1:h
d = sqrt((x-Center(1))^2+(y-Center(2))^2);
end
you replace the d calculated on subsequent iterations with the d calculated on the current iteration. Is this an oversight? Don't you want to somehow include the previous iteration calculations? Similarly, in
D = 246.9261
r = d./D
you overwrite the r that has been caculated on the previous iteration of the outer for loop. Is this intentional? How should the "historical" values be used in your calculations?
Yogesh Bhambhwani
el 14 de Nov. de 2020
KSSV
el 14 de Nov. de 2020
If you want to get the max..you have to store the d values in to an array.
for y=1:h
d(y) = sqrt((x-Center(1))^2+(y-Center(2))^2);
end
D = max(d) ;
Yogesh Bhambhwani
el 14 de Nov. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Grid Lines, Tick Values, and Labels en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!