2D interpolation in a specific region in a given image

조회 수: 5 (최근 30일)
Yuzhen Lu
Yuzhen Lu 2017년 1월 8일
댓글: Image Analyst 2017년 1월 8일

I am going to perform two-dimensional (2D) interpolation in a region of interest (ROI) in an image as shown below.

*This image contains two ROIs as enclosed by two colored solid lines. The interpolation is conducted in these regions based on knowledge of the region outside the ROI. In using interp2(x,y,z,xi,yi,'method'), x,y,z are required to be matrices. In either of the two cases, how to construct the matrices?

In the case of the rectangular ROI, e.g., the xi and yi are easy to obtain, but how to form x, y and z, noting that the matrix or grid vectors should be strictly monotonic increasing in coordinate values.

Without the interpolation method, is there any other way to estimated values in the ROI based on values outside the ROI, assuming no abrupt changes?

답변 (1개)

Image Analyst
Image Analyst 2017년 1월 8일
I believe you are asking for what the regionfill() function does. You can get a binary mask from poly2mask() if all you have is coordinates of the colored lines.
  댓글 수: 2
Yuzhen Lu
Yuzhen Lu 2017년 1월 8일
The regionfill() is indeed a good solution, compared to 1D interpolation row by row. But it still suffers from a relatively large interpolation error around the center of ROI, as illustrated below. And the function is not based on conventional linear or spline interpolation.
Image Analyst
Image Analyst 2017년 1월 8일
The assumption is that you don't know anything about the interior so the replacement/guessed pixel value is a weighted sum of pixels around the border. Of course it may be wrong if you know what's inside. Let's say you had a picture of a cat or a face or virtually anything else. There is no way you could know what's inside if all you have is what's around the border. If you know what's inside then you can do better. So if you knew for a fact that what was inside is a linear gradient in the column/x direction and a uniform value in the row/x direction, then you could easily develop an algorithm to just extend the top row of the hole's perimeter down to the bottom row of the hole. But since you required "Without the interpolation method, is there any other way to estimated values in the ROI based on values outside the ROI, assuming no abrupt changes?", that meant that we could not assume such a combination linear gradient that we know exists. And since we don't know that, a weighted sum of the boundaries, knowing nothing whatsoever about the interior, is about as good a guess as you can make.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by