I am working on Image processing with deep learning and I came on to the topic Error level Analysis which gives/shows the difference in compression level(I'm trying to show if the image as gone under multiple compressions or not) in JPEG (lossy compression).
Are there any other techniques which are similar to ELA on JPEG and techniques similar or different which can be used on PNG as well to show multiple compressions?
There cannot be, IMHO.
Since PNG compression is lossless, every decompression must result in the identical original image. Therefore, every recompression will start from the same place so no history can be retained.
Related
Im thinking to use the Huffman coding to make an app that takes pictures right from the iPhone camera and compress it. Would it be possible for the hardware to handle the complex computation and building the tree ? In other words, is it doable?
Thank you
If you mean the image files (like jpg, png, etc), then you should know that they are already compressed with algorithms specific to images. The resulting files would not huffman compress much, if at all.
If you mean that you are going to take the UIImage raw pixel data and compress it, you could do that. I am sure that the iPhone could handle it.
If this is for a fun project, then go for it. If you want this to be a useful and used app, you will have some challenges
It is very unlikely that Huffman will be better than the standard image compression used in JPG, PNG, etc.
Apple has already seen a need for better compression and implemented HEIF in iOS 11. WWDC Video about HEIF
They did a lot of work in the OS and Photos app to make sure to use HEIF locally, but if you share the photo it turns it into something anyone could use (e.g. JPG)
All of the compression they implement uses hardware acceleration. You could do this too, but the code is a lot harder than Huffman.
So, for learning and fun, it's a good project -- it might be easier to do as a Mac app instead, but for something meant to be real, it would be extremely hard to overcome the above issues.
There are 2 parts, encoding and decoding. The encoding process involves constructing a tree or a table based representation of a tree. The decoding process covers reading from huff encoding bytes and undoing a delta. It would likely be difficult to get much speed advantage in the encoding as compared to PNG, but for decoding a very effective speedup can be seen by moving the decoding logic to the GPU with Metal. You can have a look at the full source code of an example that does just that for grayscale images on github Metal Huffman.
I have a bmp image and when i converted the image to jpg image using OpenCV and Paint, the two jpeg images looks same but while doing comparison they are different, even the file sizes are different.
I take the image from this link.
And Saved it on my PC, and then i used mspaint to edit this image and save it as jpeg, the file size of this image is 356kb.
And when i used OpenCV to load the original downloaded bmp image and then saved the image as jpg, then the file size is 408kb.
When i used Beyond Compare to compare these images, the result is as follow:
Can anyone please help me in understanding this.
Why I Want this
Actually one of my colleague is capturing images using a pc application for preparing a database of images, so he is capturing the image using key F3 (Shortcut for capturing image in that software) and then click on File -> Save As -> Change the Type of Image of to JPG and then rename it as 0001---9999.jpg and finally save the image.
The problem with this Software is that if we press the F3 and then Ctrl+S, it saves the file as bmp and with the name as time-stamp.
So what i told my friend that, just click F3 and Ctrl+S (so that he can take many pictures for database) and then i will write a python script which will convert all the bmp files into jpg and rename them from 0000-9999. And this part is completed but then i came to know about the problem i shared above.
The database will be used with OpenCV.
Please suggest the reasons for this.
JPEG compression is a lossy compression. The fact that you have different output sizes already suggests that you have different compression rates. Therefor you cannot expect identical results.
The standard does not specify any quantization precision.
The maths involved in the compression (like the discrete cosine transform) require several approximations. For example how many digits will you use for Pi? How will you approximate cosine?...
All those things may differ between different implementations so even if you have the same compression rate you are not guaranteed to get identical results.
Read https://en.wikipedia.org/wiki/JPEG (and the standards) if you are interested in more details.
So unless you run both images through the same software it is unlikely that you will get what you want. Even in the same software there might be differences.
I’m working on dataset that is made of avi videos and I want to apply Gist on its frames and use Gist features of each frames for training my classifier to recognize actions. If I convert this videos to mp4 format and then perform Gist what will be the result?
mpeg4 is just a container, it says nearly nothing about how the actual data is compressed. In short - if you use lossy compression then Gist descriptors will change, if you use lossless then they will be the same, and since most common default video compressors are lossy, your Gist will most probably change.
I was wondering if the type of photo used to train an object detector makes a difference, I can't seem to find anything about this online. I am using opencv and dlib if that makes a difference but I am interested in a more general answer if possible.
Am I correct in assuming that lossless file formats would be better than lossey formats? And if training for an object jpg would be better than png as pngs are optimized for text and graphs?
As long as the compression doesn't introduce noticeable artifacts it generally won't matter. Also, many real world computer vision systems need to deal with video or images acquired from less than ideal sources. So you usually shouldn't assume you will get super high quality images anyway.
I'm curious as to what type of experiences people have had with libgd. I am looking for an alternative to GDI+ (something faster). I have tried ImageMagick, but can't get the performance out of it i need.
I have heard that ligd is fast, but less feature rich, and that ImageMagick is slow, but more feature rich.
I only need very simple image processing procedures (scale, crop) on a limited number of formats mainly jpg. However I need very high quality interpolation and it has to be fast (well faster than GDI+).
I am considering trying libgd does this seem like a good fit, given my requirements?
My own experiences with libgd are very good.
I've used it on a website where I'm taking jpeg images from disk, adding a text title to them, and rendering them back out, and it feels just about as fast as if the file was being served straight from disk.
Given that each time it's decoding the jpeg, altering it, and then re-encoding it, that's pretty good!