get the position of pixel in the window after sorting the image

1 回表示 (過去 30 日間)
UTA
UTA 2012 年 10 月 1 日
Say there has a image 'I' with size 256 * 256, and a window with size of 9 * 9 pixel. Here I want to set the center pixel of the window as a pixel exist in image 'I', let's say it is I(i,j) as center pixel of the window; here the position of I(i,j) can change as: idx = (j-1)*M + i, where M is the number of row of image I. It means that the pixel I(i,j) be located as number 'idx' after sort image 'I' as column vector I(:).
Here I want to get all the position as sort number as 'idx' of pixels inside the window.

回答 (2 件)

Matt J
Matt J 2012 年 10 月 1 日
Use the sub2ind command

Image Analyst
Image Analyst 2012 年 10 月 1 日
There could be efficient functions to do whatever it is that you want to do. More efficient than the method you think you want to use. For example, the functions conv2(), imfilter(), nlfilter(), blockproc(), etc. Let's say you could do what you're asking (which is not clear but appears to be some kind of spatial filtering), what would you do then? Do you think conv2() can do it better and faster?

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by