Am 23.01.2012 18:17, schrieb Chris Barker:
> On Wed, Jan 18, 2012 at 1:26 AM, wrote:
>> Your ideas are very helpfull and the code is very fast.
> I'm curios -- a number of ideas were floated here -- what did you end up
> using?
>
> -Chris
>
>
I'am sorry but when i see the code of Torgil Svenso
On Wed, Jan 18, 2012 at 1:26 AM, wrote:
> Your ideas are very helpfull and the code is very fast.
I'm curios -- a number of ideas were floated here -- what did you end up using?
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-
unique has an option to get indexes out which you can use in
combination with sort to get the actual counts out.
tab0 = zeros( 256*256*256 , dtype=int)
col=ravel(((im0[...,0].astype('u4')*256+im0[...,1])*256)+im0[...,2])
col,idx=unique(sort(col),True)
idx=hstack([idx,[2500*2500]])
tab0[col]=idx[1:
Sorry,
that i use this way to send an answer to Tony Yu , Nadav Horesh , Chris Barker.
When iam direct answering on Your e-mail i get an error 5.
I think i did a mistake.
Your ideas are very helpfull and the code is very fast.
Thank You
elodw
___
im_flat)
>
> Nadav
>
>
> From: numpy-discussion-boun...@scipy.org
> [numpy-discussion-boun...@scipy.org] On Behalf Of Tony Yu [tsy...@gmail.com]
> Sent: 15 January 2012 18:03
> To: Discussion of Numerical Python
> Subject: Re: [Numpy-discussion] Counting the Colors of RG
Numerical Python
Subject: Re: [Numpy-discussion] Counting the Colors of RGB-Image
On Sun, Jan 15, 2012 at 10:45 AM, mailto:a...@pdauf.de>> wrote:
Counting the Colors of RGB-Image,
nameit im0 with im0.shape = 2500,3500,3
with this code:
tab0 = zeros( (256,256,256) , dtype=int)
tt = im0.view()
tt
On Sun, Jan 15, 2012 at 10:45 AM, wrote:
>
> Counting the Colors of RGB-Image,
> nameit im0 with im0.shape = 2500,3500,3
> with this code:
>
> tab0 = zeros( (256,256,256) , dtype=int)
> tt = im0.view()
> tt.shape = -1,3
> for r,g,b in tt:
> tab0[r,g,b] += 1
>
> Question:
>
> Is there a faster wa
Counting the Colors of RGB-Image,
nameit im0 with im0.shape = 2500,3500,3
with this code:
tab0 = zeros( (256,256,256) , dtype=int)
tt = im0.view()
tt.shape = -1,3
for r,g,b in tt:
tab0[r,g,b] += 1
Question:
Is there a faster way in numpy to get this result?
MfG elodw
___