pedrocr / rawloader

rust library to extract the raw data and some metadata from digital camera images
GNU Lesser General Public License v2.1
304 stars 53 forks source link

Access blackarea values #16

Closed powturns closed 5 years ago

powturns commented 5 years ago

Thanks for the library!

To learn Rust I'm trying to re-implement the magiclantern cr2hdr tool. One of the methods attempts to calculate the standard deviation of the black noise in the image. It would be useful to be able to access the values of blackareah and blackareav in a loaded raw image for this purpose (perhaps similar to the crops property).

Any advice on how to do this, or why this is a bad idea are appreciated. I can also send you a pull request that will expose it too!

pedrocr commented 5 years ago

For the cameras that have those areas the blackpoint is already calculated from them. So just calculating the standard deviation itself in rawloader and exposing that in a blackarea_stdev: Option<u16> in RawImage could be an option if that's actually something that's usable in multiple places. All the other formats will just have None there though. Exposing the actual areas is fine too. They're already in Camera so it's just a matter of pushing them into RawImage as well.

PRs more than welcome, have fun! For any help feel free to show up on #chimper in irc.mozilla.org. I'm not always around but have the IRC client always running and will get back to you eventually.

powturns commented 5 years ago

Thanks for the advice, I think exposing the areas is the best bet as the cr2hdr software calculates different noise values depending on the ISO of the given scanline, so the stddev for the entire region wouldn't work for my purpose.