I'm looking for an image analyzing algorithm that estimates the "original" resolution of a picture after is has been scaled up.
I understand the result would depend a lot on image motive, focus, noise and post effects, but getting a rough estimate of a minimum size image that has the same information content would be quite interesting.
Is there something like this out there already, maybe even an existing tool/plugin?
(assuming this is a practical problem, as opposed to a theoretical question).
Have you looked at metadata? A lot of image processing software leaves the EXIF headers untouched, or appends helpful information to them...
Related
I'm trying to create a model that segment various part of an aerial image.
I'm using a dataset found in kaggle: https://www.kaggle.com/datasets/bulentsiyah/semantic-drone-dataset
My question regards about the right way of treat images for semantic segmentation.
In this case is it better to simply resize the images (e.g. 6000x4000 to 256x256 pixel) or is it better to resize them less but then create patches from it (e.g. 6000x4000 to 1024x1024 pixel and then patches in 256x256 pixel).
I think that resizing too much an image may cause the loss of information but at the same time patching could not guarantee a full view of the image.
I also found a notebook that got 96% accuracy just by resizing so i'm not sure how to proceed:
https://www.kaggle.com/code/yesa911/aerial-semantic-segmentation-96-acc/notebook
I think there is not one correct answer to this. Dependant on the amount and size of the areas you want to segmentate, it seems unlikely to get a proper/accurate segemantion with images of your size. However, if there are only easy detectable and big areas in the image I would definetly go for the approach without patches, since the patch-approach is way more complex as it has more variables to consider (size of patches, overlapping patches, edge treatment). It would save you a lot of implementation time for preprocessing and stichting afterwards.
TLDR: I would start without patching and - if the result is sufficient - stop there. Else, try the patching approach afterwards.
I want to determine if an image has been overly compressed and thus if it contains those pixelated artifacts you can see clearly, for example, in the upper right portion of the image below. In the following comparison there are two JPEG images, the left one is the original, the right one has been saved at 30% quality and then saved again with 80% quality.
The loss of details in the right one is easily detactable at naked eye. I'm looking for an algorithm which, given the final image only and not the original one, detects if it's been overly compressed or if it has this kind of "disturb" which implies those clusters of similar/identical pixels and therefore determines an average poor quality of detail.
I analyzed them through ImageMagick and they have very similar values and histograms, and pretty the same min/max values on the RGB channels. The original image quality is 71% and the compressed one is 80% just because, as I already said before, I saved it back to 80% after saving it at 30% quality in first place, which makes the "quality" factor unreliable.
Before anyone asks, I wrote no code yet. I'm doing some research just looking for some tips to eventually find a solution but I don't really know how this phenomenon is called nor the algorithm(s) to serve the purpose. The matter of image and signal analysis is huge, so I'd really appreciate if you could help me to narrow it down.
For some pictures, even great quality loss can be imperceptible to the human eye. For example, for small ones. However, for large pictures those artifacts might quickly become visible.
So, my goal is to find minimal value of quality, that produced artifacts will be "imperceptible" for human. Obviously, image size is one of the features, ratio size / weight is second, but what are another features?
My original idea was to find several features, manually create a test set and to train some machine learning tool to answer this question.
Maybe there are some researches in this area, and I'm missing some important information?
This is, in fact, a very hot computer vision research topic - image quality assessment. Obviously, it seems, that you have not done background research in this area, may be because you did not know the term for this phenomenon. I would suggest you to start reading computer vision papers related to image quality assessment.
I realise measuring image quality in software is going to be really difficult, and I'm not looking for a quick-fix. Googling this is largely showing up research papers and discussions that go a bit over my head, so I was wondering if anyone in the SO community had any experience with doing any rough image quality assessment?
I want to use this to scan a few thousand images and whittle it down to a few dozen images that are most likely of poor quality. I could then show these to a user and leave the rest to them.
Obviously there are many metrics that can be a part of whether an image is of high/low quality, I'd be happy with anything that could take an image as an input and give some reasonable metrics to any of the basic image quality metrics like sharpness, dynamic range, noise, etc., leaving it up to my software to determine what's acceptable and what isn't.
Some of the images are poor quality because they've been up-scaled drastically. If there isn't a way of getting metrics like I suggested above, is there any way to detect that an image has been up-scaled like this?
This is a very difficult question since "image quality" is not a very well defined concept.
It's probably best if you start experimenting with some basic metrics and see if you come up with a measure that suits your applications.
E.g., for dynamic range, the quantiles of the distributions of each channel can yield interesting information.
For up-scaling, on the other hand, the solution is fairly simple: just do a fourier transform on the image and see the amount of energy in the high-frequency vs lower-frequency bands.
I have some (millions) of 16-bit losslessly compressed TIFFs (about 2MB each) and after exhausting TB of disk space I think it's time I archive the older TIFFs as 8-bit JPEGs. Each individual image is a grayscale image, though there may be as many as 5 such images representing the same imaging area at different wavelengths. Now I want to preserve as much information as possible in this process, including the ability to restore the images to their approximate original values. I know there are ways to get further savings through spatial correlations across multiple channels, but the number of channels can vary, and it would be nice to be able to load channels independently.
The images themselves suggest some possible strategies to use since close to ~60% of the area in each image is dark 'background'. So one way to preserve more of the useful image range is just to threshold away anything below this 'background' before scaling and reducing the bit depth. This strategy is, of course, pretty subjective, and I'm looking for any other suggestions for strategies that are demonstrably superior and/or more general. Maybe something like trying to preserve the most image entropy?
Thanks.
Your 2MB TIFFs are already losslessly compressed, so you would be hard-pressed to find a method that allows you to "restore the images" to their original value ranges without some loss of intensity detail.
So here are some questions to narrow down your problem a bit:
What are the image dimensions and number of channels? It's a bit difficult to guess from the filesize and bit depth alone, because as you've mentioned you're using lossless compression. A sample image would be good.
What sort of images are they? E.g. are they B/W blueprints, X-ray/MRI images, color photographs. You mention that around 60% of the images is "background" -- could you tell us more about the image content?
What are they used for? Is it just for a human viewer, or are they training images for some computer algorithm?
What kind of coding efficiency are you expecting? E.g. for the current 2MB filesize, how small do you want your compressed files to be?
Based on that information, people may be able to suggest something. For example, if your images are just color photographs that people will look at, 4:2:0 chroma subsampling will give you a 50% reduction in space without any visually detectable quality loss. You may even be able to keep your 16-bit image depth, if the reduction is sufficient.
Finally, note that you've compared two fundamentally different things in your question:
"top ~40% of the pixels" -- here it sounds like you're talking about contiguous parts of the intensity spectrum (e.g. intensities from 0.6 to 1.0) -- essentially the probability density function of the image.
"close to ~60% of the area in each image" -- here you're talking about the distribution of pixels in the spatial domain.
In general, these two things are unrelated and comparing them is meaningless. There may be an exception for specific image content -- please put up a representative image to make it obvious what you're dealing with.
If you edit your question, I'll have a look and reply if I think of something.