New topic: RGB HISTOGRAM from a picture
<http://forums.realsoftware.com/viewtopic.php?t=33303> Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message DaveS Post subject: RGB HISTOGRAM from a picturePosted: Wed Apr 07, 2010 7:05 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 2233 Location: San Diego, CA Ok.. I thought I knew how to do this...... and collecting the data isn't the hard part.... the hard part seems to be what to do with it.. I had thought a RGB histogram [like in iPhoto, Photoshop etc] was created by Scanning a picture.... counting how many pixels had a accumulating the counts of the Red, Green and Blue values Code: for y=0 to h for x=0 to w m.ColorValue(1,24)=s.Pixel(x,y)// convert color into an integer i=m.byte(1) red(i)=red(i)+1 i=m.Byte(2) grn(i)=grn(i)+1 i=m.Byte(3) blu(i)=blu(i)+1 next next and then drawing a graph with the X-Axis being 0 to 255 and the Y-Axis being 0 to Maxvalue counted And this DOES produce a pretty chart.... but it is NOT the same as what iPhoto shows... [I don't have any of the other programs to compare it to] So... am a) I graphing the wrong data? or b) is iPhoto showing a different type of Histogram? for clarity I left off the actual graphing part _________________ Dave Sisemore MacPro, OSX 10.6.2 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top timhare Post subject: Re: RGB HISTOGRAM from a picturePosted: Wed Apr 07, 2010 7:11 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 7544 Location: Portland, OR USA You have the bytes reversed. Red is byte(3), blue is byte(1). Top DaveS Post subject: Re: RGB HISTOGRAM from a picturePosted: Wed Apr 07, 2010 7:18 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 2233 Location: San Diego, CA thanks... but other than that... is that the proper data to be graphing for a "proper" RGB Histogram? _________________ Dave Sisemore MacPro, OSX 10.6.2 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top guykuo Post subject: Re: RGB HISTOGRAM from a picturePosted: Thu Apr 08, 2010 12:04 am Joined: Mon Apr 02, 2007 5:51 pm Posts: 243 Looks to me like you are binning and counting the values appropriately to make a histogram. Perhaps iPhoto is using different size bins than 1 wide? Top DaveS Post subject: Re: RGB HISTOGRAM from a picturePosted: Thu Apr 08, 2010 12:22 am Joined: Sun Aug 05, 2007 10:46 am Posts: 2233 Location: San Diego, CA Well if I make a picture that is 3 colors only.. .PURE red, green and blue blocks... My method makes a "bookend" histogram.... 100% at 0 and 100% at 255 with nothing in the middle... which makes sense But iPhoto shows Two blips about 1/3 the way from each end..... which is wierd... If I have a "normal" photo... my graph and iPhoto are very similar.. but still not the same _________________ Dave Sisemore MacPro, OSX 10.6.2 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 5 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
