How to find the pixel information at a point whose coordinates are known ?
1 次查看(过去 30 天)
显示 更早的评论
I have a set of (x,y) coordinates and I wish to know the values of pixels at each of these points. How do I do that. Normally, finding the coordinates from pixel value is easy using 'find' function in MATLAB. But this problem is exactly inverse of it. I know coordinates and I want to find pixel values
0 个评论
回答(1 个)
Azzi Abdelmalek
2016-8-12
Im=randi(10,4)
x=[1 2 3]
y=[2 3 4]
id=sub2ind(size(Im),x,y)
pixels=Im(id)
2 个评论
Image Analyst
2016-8-12
If x is horizontal, and y is vertical coordinate (as usual), then this should be
id=sub2ind(size(Im), y, x)
since sub2ind() uses row, column, not x,y. So the rows come first, not the columns.
Mahsa khodaee
2017-11-30
Thanks for your answer! I have the same question! your answer with X, Y matrix is fine! how about the time that we have a points file with a specific coordinate system! In this case, we wouldn't have two specific X and Y matrix.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!