how can i extract data between 4 points in a matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a matrix and 4 vertices of a rectangle. The rectangle is not aligned with the axes,i.e the rectangle is slanted. I want to extract the data between the 4 vertices into a new matrix. How can i do it? I've been trying to do it for weeks. Thanks
0 件のコメント
回答 (1 件)
Image Analyst
2013 年 10 月 1 日
Weeks? Wow. Do yo have the Image Processing Toolbox? If so, you can simply use poly2mask():
[rows, columns] = size(your2Darray);
logicalMap = poly2mask(x, y, rows, columns); % put in coords of the rectangle corners.
extractedValues = your2Darray(logicalMap);
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!