Prev: Bezout matrix
Next: mnrfit
From: Ying Li on 22 Dec 2009 16:54 Hi All, I am wondering is there any algorithm that you can get eh the pixels with same RGB value in a picture very quickly. Any hints will be appreciated. Thanks a lot!! Merry Christmas, Ying
From: Andy on 22 Dec 2009 17:08 "Ying Li" <liyingapply(a)hotmail.com> wrote in message <hgrf5s$bn6$1(a)fred.mathworks.com>... > Hi All, > > I am wondering is there any algorithm that you can get eh the pixels with same RGB value in a picture very quickly. > > Any hints will be appreciated. Thanks a lot!! > > Merry Christmas, > Ying I'm pretty sure you could use SplitVec to do something like this: http://www.mathworks.com/matlabcentral/fileexchange/24255-consecutive-vector-spliter
From: ImageAnalyst on 22 Dec 2009 17:26 Ying: first you have to construct your 3D color gamut, and then you have to inspect it to look for elements with a count greater than 1, meaning more than one pixel has that color. You can get the color gamut like this: gamut3D = zeros(256,256,256); lastRow = sizeOfImage(1); lastCol = sizeOfImage(2); for row = 1 : lastRow for col = 1: lastCol redValue = originalImage(row, col, 1) + 1; % Convert from 0-255 to 1-256 greenValue = originalImage(row, col, 2) + 1; % Convert from 0-255 to 1-256 blueValue = originalImage(row, col, 3) + 1; % Convert from 0-255 to 1-256 gamut3D (redValue, greenValue, blueValue) = gamut3D (redValue, greenValue, blueValue) + 1; end end Then just scan it looking for >1. I think you can do this: (r,g,b) = find(gamut3D > 1); Then you have a list of all RGB colors where more than one pixel has that color. Now you loop over all colors to find the x,y locations for k = 1:length(r) redValue = r(k); greenValue = g(k); blueValue = b(k); % Use the find() command to find pixels (i.e. the pixel x,y coordinates) where the original image's red value = redValue, etc. Details are very simple and left as an exercise for you. end
From: ImageAnalyst on 22 Dec 2009 17:28 Just as aside -- you might be interested in this article: %------------------------------------------------------------------------------- % http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?tp=&arnumber=4421050&isnumber=4420928 % Introduction of frequency image and applications % Kashiwagi, T. Oe, S. % Tokushima Prefectural Ind. Technol. Center, Tokushima; % % This paper appears in: SICE (Society of Instrument and Control Engineers), 2007 Annual Conference % Publication Date: 17-20 Sept. 2007 % On page(s): 584-591 % Location: Takamatsu, % ISBN: 978-4-907764-27-2 % INSPEC Accession Number: 9853526 % Digital Object Identifier: 10.1109/SICE.2007.4421050 % Current Version Published: 2008-01-07 % % Abstract % We introduce a new imaging method of "Frequency Image" and its applications. % This new image is made from multi-dimensional features of an image and presents % a distribution of the frequency of feature vectors. Especially, selecting R, G and B colors % as the three features of an image, Frequency Image is a feature image of which pixel % represents the frequency of the same color pixels. In this paper, first, we explain % the basic idea and how to make this Frequency Image. Next, we introduce some effective % applications using this image. Finally we mention excellent potentials of Frequency Images. %-------------------------------------------------------------------------------
|
Pages: 1 Prev: Bezout matrix Next: mnrfit |