### Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#" onclick="window._kiq.push(['set', { 'event': 'Turn off MT' }]);">ここ</a>」をクリックしてください。

## select a region from an image satisfying a condition

Elysi Cochin

### Elysi Cochin (view profile)

さんによって質問されました 2018 年 3 月 26 日

### Elysi Cochin (view profile)

さんによって 編集されました 2018 年 4 月 5 日
Image Analyst

### Image Analyst (view profile)

さんの 回答が採用されました
How to select a region from an orientation image satisfying the following condition

#### 0 件のコメント

サインイン to comment.

## 1 件の回答

2018 年 3 月 26 日
採用された回答

Walter Roberson

### Walter Roberson (view profile)

2018 年 3 月 27 日
``` [
0 1 1 1 1 1 1 1 0;
1 1 1 1 1 1 1 1 1;
0 1 1 1 1 1 1 1 0;
0 1 1 1 1 1 1 1 0;
0 0 1 1 1 1 1 0 0;
0 0 0 0 1 0 0 0 0]```
Image Analyst

### Image Analyst (view profile)

2018 年 3 月 27 日

I have no idea how you got the underlying image beneath your circular mask. I assume you had that already. What formula or operations are you using to get those values? Or do you not have them already? If you don't have those numbers yet, what distances are they measuring displacement from? Like do you have two images and are tracking some object (e.g. a car, a ball, a laser spot) and the object moved from location 1 in image 1 to location 2 in image 2?

Walter Roberson

### Walter Roberson (view profile)

2018 年 3 月 27 日

You need to read the caption more carefully. The dx and dy are the horizontal and vertical displacement of the element's position relative to the center. The formulas show simply define a truncated circle as a mask, without in any way talking about the content of the image.

```(j.^2) > -1
```

Incorrect: in the original it is dy, not dy^2.

If you must construct the mask computationally then:

```KR = 4;
[row, col, p] = size(IMG);
xc = col/2; yc = row/2;
if xc ~= floor(xc) || yc ~= floor(yc)
error('cannot handle images with odd numbers of rows or columns')
end
[X, Y] = ndgrid(1:col, 1:row);
mask = (X-xc).^2 + (Y-yc).^2 <= KR.^2 & (Y-yc) >= -1;
```

The reason for ruling out images with odd dimensions is that the centre of those would be in-between pixels, which would lead to masks of slightly different shape than you need.

サインイン to comment.

Translated by