Earlier quoted context omitted.
Really? Do you care to explain? What is the dividend and what is the divisor? Why can dividing a image by its low pass filtered version (or vice versa) be used to "clean up" the image, i.e. subtract the background, find main colors and cluster similar colors with k-means? What if the divisor has pixels near zero?
Areas of low contrast become whiter and areas of high contrast become more saturated. It is also more robust than k-means. The author's algo will only work on scanned images. Photographed pages from a book will often have a slight shadow on half the page from the curvature. Blur-divide will clean this up. K-means will think you've used a lot of gray and not figure out that there are multiple background colors.
Compressing and enhancing hand-written notes (2016)
71–78 of 78 posts
Re: Compressing and enhancing hand-written notes (2016)
#72I have an observation about scanning documents that results in good quality and smaller files, but I can't satisfactorily explain why it works. Consider these two cases: (1) Scan document at very high resolution as a JPG and then use a third-party program (like Photoshop or whatever) to re-encode the JPG at your preferred low resolution. (2) Scan document at your preferred low resolution as a JPG straight away. Don't…
Of course you get better results with 1. Here is why: if you go with (2), then (1) is still done: by the crap firmware in your printer or its driver. It scans at high resolution and then downsamples in some way over which you have no control. It might not even be done with floating-point math. 1. is a somewhat like getting the raw image from a camera: a higher quality source for your own processing.
Re: Compressing and enhancing hand-written notes (2016)
#73I can get seemingly comparable results with a couple of simple operations in Gimp. Here is a casual job on the first image: https://i.imgur.com/Sy2rvsU.png The steps: 1. Duplicate the layer. 2. Gaussian-blur the top layer with big radius, 30+. 3. Put the top layer in "Divide" mode. Now the image is level. 4. Merge the layers together into one. 5. Use Color->Curves to clean away the writing bleeding through from the o…
In particular my use case is cleaning up pictures of whiteboards, where the brightness from the room is not as constant as a scan, and the approach wouldn't work at all.
Probably an easy PR for that repo though?
Re: Compressing and enhancing hand-written notes (2016)
#74https://docs.opencv.org/3.4.0/d7/d4d/tutorial_py_thresholdin...
Re: Compressing and enhancing hand-written notes (2016)
#75Re: Compressing and enhancing hand-written notes (2016)
#76This reminds me of my time in university, when I saved all my lecture notes as DjVu [1] files. It's a great file format for space-efficient archiving of scans like that, with a bit of scripted preprocessing. [1]: https://en.wikipedia.org/wiki/DjVu
I like the idea, but DjVu seems to be very proprietary / single vendor and not in widespread use. This has made me reluctant to use it for archival purposes (vs say PDF, which has its own issues, but feels slightly more future proof to me). I think PDF can cover pretty much the same ground with JBig and Jpeg2k. (And I believe archive.org is doing that.) But I don't know of any open source code to do the segmentation…
Re: Compressing and enhancing hand-written notes (2016)
#77Re: Compressing and enhancing hand-written notes (2016)
#78 sudo pip install --upgrade --ignore-installed --install-option '--install-data=/usr/local' numpy==1.9.0
If you don't use the numpy==1.9.0 you'll get the 1.14.2 version which is also broke.The rest of the options allow pip to soft-override the macOS built-in numpy 1.8.0 which is immutable in the /System/ directory.
Anyway, after I did all that I was able to start playing with the app, I had previously been using a kludge workflow to get a nice output in black and white by using the imagemagick convert -shave option to remove the scanned edges of images, then doing a -depth 1 to force the depth down (which only works well on really clean scans), then I can -trim to clear the framing white pixels and re-center using the -gravity center -extent 5100x6600 to frame the contents centered inside a 600dpi image.
Rough but it works, I was hassling with trying to isolate "spot colors" for another thing, but this might actually do the trick!!!