>From my understanding of what you are trying to do is remap the dynamic range of your image. So in essence you want to set your lowest intensity to 0 and the highest to 256 (given an 8 bit image). The transformation given is non-linear, if you are using this for gel quantification this is a very very very bad idea. If it's just screwing around, then it's fine.
So first you say what is the range, (hi-lo), and divide 256 by this to give your effective intensity per value within your range (so taking a low of 100, a max of 250, each 'point' now represents 1.70 intensity). You also want to subtract the lowest intensity from each point to make your new effective "0 intensity". This is done dynamically by your given y equation. For a linear equation, you would want do use this: outJ = outI.point(lambda i:(i-y)*x) So all pixels which were 100 should now map to 0, a pixel of 250 would map to 255. On Thu, Feb 9, 2012 at 12:16 PM, Nelson Tong <tongsnelson....@gmail.com>wrote: > >> > >> On 2/4/12, Randolph Bentson <bent...@holmsjoen.com> wrote: > >> > Oh, I guess the lambda function should be generalized by > >> > > >> > (lo,hi) = outI.getextrema() > >> > x = 256.0/(hi-lo) > >> > y = (0-lo)/256.0 > >> > outJ = outI.point(lambda i:i*x+y) > > > > I have no experience with these type images, so I don't know if > > constant values are appropriate. The performance of the generalized > > mapping seems quick enough, so that may be safer. BUT, there's > > one questionable issue with this function: it turns the darkest > > source pixel to black and the lightest pixel to white. I hope > > others can provide some comments on that. > > I'm not an expert in image processing. I just want to learn more > about this since we are talking about the mapping function here. > > I don't quite completely understand how this generalized mapping > function work with im.point(). Given the hi and lo from getextema(), > I understand that x = 256.0/(hi-lo) > is a way to to adjust the scale parameter to the have a range of > values from 0 to 256. but where does the offset of (y= (0-lo) /256 ) > comes from ? is there any reference anyone can recommend as a tutorial > about this kind of mapping function? > > > > > > > > > > > > -- > > Randolph Bentson > > bent...@holmsjoen.com > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig >
_______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig