How to find row and column of a pixel in an Image?

Guys I want to find the rows and columns of pixels of image so that i can put that in if condition inside for loop. Bt i am unable to write that code. plz help me.

3 件のコメント

Camilo Andrés Roca Duarte
Camilo Andrés Roca Duarte 2011 年 3 月 21 日
I think you first have to clarify a litle your question, because you can use the coman [row,col]=find(variable==#) to find the pixel you want once you have the matrix of the pixel ( if it is not in truecolor). If you know the color of the pixel you just have to find the number that represent it in a scale (for instance 256 colors). I give this lines of a code I wrote recently to find the pixels in an images that are not totally white (in a scale of 256 colors.
[row,col]=find(Imagen~=255);
Radha r
Radha r 2016 年 4 月 23 日
how do find image row and coloumn pixel in matrix in train image because i would geetting the good and bad pixel find out
Image Analyst
Image Analyst 2016 年 4 月 23 日
Radha r, Start your own question and post your image and explain what "good" and "bad" means to you.

サインインしてコメントする。

 採用された回答

Wolfgang Schwanghart
Wolfgang Schwanghart 2011 年 3 月 21 日

0 投票

Hi, what about this:
[ROWS,COLUMNS] = ndgrid(1:size(I,1),1:size(I,2));
ROWS = ROWS(:);
COLUMNS = COLUMNS(:);
where I is your image.
Best regards, Wolfgang

1 件のコメント

Radha r
Radha r 2016 年 4 月 23 日
but how do find good and bad pixel in image

サインインしてコメントする。

その他の回答 (3 件)

Karan Ratnaparkhi
Karan Ratnaparkhi 2011 年 3 月 21 日

0 投票

Hi wolfgang I have an algorithm in which i am given a range of rows n columns lets say a to b (for rows) and c to d (for columns). now I hav to do operation only on those pixels which lie (whose rows n cols lie) in between a to b and c to d. Thats y i want to know how to get the row and column of given pixel (not the value of pixel.) Plz help me with this code.

2 件のコメント

Wolfgang Schwanghart
Wolfgang Schwanghart 2011 年 3 月 21 日
This sounds to me as if you want to perform some calculations within a subset of your image. Without knowing what exactly you want to do there, I suggest to take a look at the roi-based image processing section of the documentation.
http://www.mathworks.com/help/toolbox/images/ref/roifilt2.html
HTH, Wolfgang
Karan Ratnaparkhi
Karan Ratnaparkhi 2011 年 3 月 22 日
hey thnx wolfgang...

サインインしてコメントする。

Syed Ali Hassan
Syed Ali Hassan 2014 年 2 月 22 日

0 投票

Check this [row_limit,col_limit]=size(img);

3 件のコメント

Image Analyst
Image Analyst 2014 年 2 月 22 日
A bit risky and dangerous in general. See http://blogs.mathworks.com/steve/2011/03/22/too-much-information-about-the-size-function/ - Steve's blog. Unless you know for a fact in advance that the image is gray scale, you'll be safer and more robust if you do this:
% This works for grayscale and RGB images:
[rows, columns, numberOfColorChannels] = size(yourImage);
Radha r
Radha r 2016 年 4 月 23 日
it is not find the t my answer and what are you telling me i ont now please tell me example
Radha r
Radha r 2016 年 4 月 23 日
plz help me sir

サインインしてコメントする。

Radha r
Radha r 2016 年 4 月 23 日

0 投票

it is not find the t my answer and what are you telling me i ont now please tell me example

1 件のコメント

Image Analyst
Image Analyst 2016 年 4 月 23 日
Radha r, Start your own question and post your image and explain what "good" and "bad" means to you.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by