News for hackers. Stuff that matters.
Re:Universal algorithm set to boost microscopes by jerf on Thursday August 29, 2019 @01:14PM (#20831519)
I've been looking for an algorithm for a while to examine photos to get their "real" resolution, both to compress my personal collection better, and to provide a relatively rigorous demonstration of when a "12 megapixel photo" is "really" a 2MP photo due to the camera as a whole not being able to support it. I wonder if this could be the basis for what I'm looking for.
Re:Universal algorithm set to boost microscopes by ska on Thursday August 29, 2019 @02:07PM (#20832081)
For compressing your personal collection, you are probably best off doing a parameter search with a desired max/average error. Too many variables in image quality to do anything based on signal chain alone, probably.

As fare as a rigorous demonstration goes, that's what resolution targets are for :)

Re:Universal algorithm set to boost microscopes by jobigoud on Thursday August 29, 2019 @01:41PM (#20831833)
Naive idea: do a downscale-upscale roundtrip using bilinear interpolation and then compare that with the original. Any difference should be the added value over the lower res. This diff image would contain noise and signal though, the final score should increase with the signal noise ratio.
Re:Universal algorithm set to boost microscopes by the8472 on Thursday August 29, 2019 @03:26PM (#20832753)
this is intended to find the native resolution of upscaled anime, but maybe the getnative tool or the fourier approach can help pointing at the original resolution of a blown up photograph.

https://github.com/Infiziert90/getnative

https://ddl.kageru.moe/kbz12.pdf

Re:Universal algorithm set to boost microscopes by raymondh on Thursday August 29, 2019 @01:37PM (#20831775)
Re:Universal algorithm set to boost microscopes by ipunchghosts on Thursday August 29, 2019 @09:41PM (#20835297)
I doubt it. The method they are using makes a bunch of implicit assumptions about the content of the image. Microscope images generally are very sparse and have lots of black areas which makes this method work very well on them. At the very least, you may have to adapt some of the parameters (like dt in max finder) to work for photographs.
Re:Universal algorithm set to boost microscopes by mehrdadn on Thursday August 29, 2019 @03:55PM (#20832989)
Be glad you're not taking RAW photos, or this isn't even an option. :(

Anyone have any suggestions for doing the same thing for video?

Re:Universal algorithm set to boost microscopes by ChrisLomont on Thursday August 29, 2019 @04:47PM (#20833498)
RAW usually compresses, just not as well as lossy. For example, the lossless FLIF image format usually compresses images quite well (and it's lossless - you can binary compare the before and roundtrip images to check).

For video, I suspect there's things like FLIF, but with interframe knowledge, allowing even more compression.

None of these should beat good lossy codecs, but they vastly outperform completely uncompressed data for the stuff people normally capture.

If you somehow capture true random noise, then these wont' work. But most recordings of interest are much more structured, hence compressible.

https://flif.info/

Re:Universal algorithm set to boost microscopes by mehrdadn on Thursday August 29, 2019 @05:59PM (#20834129)
Not really. Some RAWs from some cameras do compress, but not others. (Not sure why; maybe it's already pre-compressed.) As an example, I tried just compressing a random 30MB RAW from my camera (just a photo of jeans, nothing particularly unusual) with 7z on Ultra compression, and it saved—guess what—a whopping 2.2% of its size.
Re:Universal algorithm set to boost microscopes by remcob on Thursday August 29, 2019 @06:24PM (#20834306)
7z is a generic lossless compressor. These algorithms tend to specialize in exact repeating patterns in sequences. Good for english prose, but images tend to have non-exact patterns in two dimension. A dedicated algorithm like FLIF will be much better at picking those up. I would expect an order of magnitude difference in performance between 7z and FLIF.

For the curious: the way these non-exact pattern compressors work is by subtracting out the predicted pattern and then storing the remaining signal, which will be smaller numbers and therefore take less bits to store.

Re:Universal algorithm set to boost microscopes by ChrisLomont on Thursday August 29, 2019 @09:12PM (#20835170)
What is your camera? Multiply your sensor size by the bit depth, and I suspect you’ll have more than 30mb.

Also image compressors like FLIF vastly outperform general compressors on images.

Re:Universal algorithm set to boost microscopes by mpais on Friday August 30, 2019 @12:57PM (#20840334)
Some RAW formats are pre-compressed, usually with very simple (hence fast) algorithms, and some aren't even lossless (Sony ARW). It's often possible to further compress them with specialized tools.

Disclosure: I'm the author of PackRAW, a tool that does exactly that (https://encode.su/threads/2762-PackRAW)

Re:Universal algorithm set to boost microscopes by pletnes on Thursday August 29, 2019 @06:16PM (#20834257)
The RAW format is probably using e.g zlib for compression internally. You can check by calculating how many bytes in total a truly raw image is: 12-16 bits (1.5-2 byte) per pixel.
Re:Universal algorithm set to boost microscopes by the8472 on Friday August 30, 2019 @04:41PM (#20842498)
Many lossy video formats (e.g. h.264, h.265, av1) have a special lossless profile. But there are also dedicated lossless codecs such as ffv1.