- Convolve the image with the mask. This will create a new image, called the convolved image, where each pixel value is the sum of the product of the mask values and the image values under the mask.
- Find the maximum intensity value in the convolved image using the “max” function (Refer to the documentation: https://www.mathworks.com/help/releases/R2021b/matlab/ref/max.html)
- Use the “find” function to find the coordinates of all the pixels in the convolved image that have the maximum intensity value. (Refer to the documentation: https://www.mathworks.com/help/releases/R2021b/matlab/ref/find.html)
How to find the coordinates from an convolution with an mask
5 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I created an rectagular mask or elliptical mask that i rotate and convolute with an gray-scale image with some intensity content. I like to plot the position of the mask (mask that have the highest intensity value), but i am having a little trouble to figure out how to find the coordiantes of the mask that gave the highest intensity so i can then mark out the location of the worst-case rectangular or elliptical mask with an line contour. Any ideas?
Thanks!
0 件のコメント
回答 (1 件)
Dhruv
2023 年 9 月 4 日
To find the coordinates of the mask that gives the highest intensity, you can use the following steps:
Here is an example code:
function find_max_intensity_coordinates(image, mask)
% convolve the image with the mask
convolved_image = conv2(image, mask)
% find the maximum intensity value in the convolved image
max_intensity = max(convolved_image)
% find the coordinates of the maximum intensity value
max_intensity_coordinates = find(convolved_image == max_intensity)
return max_intensity_coordinates
The function returns the coordinates of the maximum intensity pixels. Further, you may mark it with a line contour or any other desired visualization.
I hope this helps!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!