How do I get the values of the surrounding pixels when I choose a particular pixel in an image?

7 ビュー (過去 30 日間)
I'm trying to estimate the possible points of intersection between two lines (arrays) in an image. Is there any function to return the values of the surrounding pixels for a particular value of the array?

採用された回答

Image Analyst
Image Analyst 2016 年 11 月 2 日
Assuming it's a gray scale image, and that the row and column is not on the edge of the image:
surroundingWindow = grayImage(row-1:row+1, col-1:col+1);
If it's color:
surroundingWindow = rgbImage(row-1:row+1, col-1:col+1, :);
  6 件のコメント
Image Analyst
Image Analyst 2016 年 11 月 3 日
You'd need to do this:
[rows, columns] = find(abs(Pdist) > 50);
The Imagician
The Imagician 2016 年 11 月 3 日
Thank you! The logic is great and helped me a lot :-)

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by