How to extract particular pixel values from an image?

32 ビュー (過去 30 日間)
Nikhil
Nikhil 2012 年 12 月 24 日
コメント済み: Image Analyst 2016 年 10 月 24 日
Hello,
I'm doing project on image processing, and in one of my module i need to extract the particular bunch of the pixels.I know the values of that pixel but i'm not getting how exactly to extract that values. so please help me to get out of this!
  2 件のコメント
Walter Roberson
Walter Roberson 2012 年 12 月 24 日
What do you mean by "extract" in this case?
Are the pixels RGB or grayscale?
Nikhil
Nikhil 2012 年 12 月 26 日
sir, here extract means retrieval of those pixels, i mean only "1". and its a grayscale image and i converted it into binary image. how can i do this, please guide me!

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

回答 (4 件)

Walter Roberson
Walter Roberson 2012 年 12 月 24 日
[PixelRows, PixelColumns] = find( YourImage(:,:,1) == RedValue & YourImage(:,:,2) == GreenValue & YourImage(:,:,3) == BlueVaue );

Nikhil
Nikhil 2012 年 12 月 24 日
sir i appreciate your answer but my image is binary image, sorry i completely forgot to mention it!! Now what to do??
  7 件のコメント
Kris
Kris 2013 年 1 月 2 日
Dear Nikhil, Are you sure those are the images or they are just for example??...if so, please share the original image you are working on through flickr.com or picasa, tiny pic or any other photo sharing site...
Also, I feel that the labeling of image will be helpful for you..try image labeling once you label the regions of your image, it will be relatively easy to extract them...try once this might be helpful...
Nikhil
Nikhil 2013 年 1 月 2 日
Kris Sir, which link i had mentioned above that is database link, i mean the same database using for my project. and for further work i need to delete/remove the background but i got stuck here only.
how can i do this??

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


Image Analyst
Image Analyst 2012 年 12 月 24 日
You say
  1. You have a binary image (which means value of 0 and 1)
  2. You know the values in the particular bunch (either 0, 1, or both of course)
  3. You need to extract their values (which will again be either 0 or 1 or both)
So the question remains,
  1. Do you know the locations of the "particular bunch" of pixels?
  2. If you already know their values then what exactly does it mean that you need to extract their values? You mean you want a vector that is the length of the "particular bunch" and has the 0 or 1 values in the vector? Like your image is 1 megapixel but you want a vector of pixel values from a small 1000 pixel chunk in the image?
  41 件のコメント
Walter Roberson
Walter Roberson 2013 年 1 月 2 日
What is the name of your black-and-white image array?
Nikhil
Nikhil 2013 年 1 月 3 日

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


Anuradhi Umayangani
Anuradhi Umayangani 2016 年 9 月 14 日
Hi, I have a matrix with only 0's & 1 's .I actually it is a square devided in to 9 equal squares some are coloured in black and some quares are white.this master square is printed in a white background.it has a black outline.I want to crop the square from the white background.do u know a way to do that. i need to write the program to identify the margine by itself
  3 件のコメント
snehal jaipurkar
snehal jaipurkar 2016 年 10 月 24 日
If I am having a color image and I want to find the total no of pixels in a specific range of pixel values then what should I do????and how to find out the range of pixel values in a certain region of an image???
Image Analyst
Image Analyst 2016 年 10 月 24 日
You can take the histogram of each channel:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
[countsR, edgesR] = imhist(redChannel);
[countsG, edgesG] = imhist(greenChannel);
[countsB, edgesB] = imhist(blueChannel);
To do it with a masked image, put the binary image mask as an index to the images.
% Extract the individual red, green, and blue
% color channels but only in the masked region(s);
[countsR, edgesR] = imhist(redChannel(mask));
[countsG, edgesG] = imhist(greenChannel(mask));
[countsB, edgesB] = imhist(blueChannel(mask));

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

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by