Why does my PNG image look different in OpenCV? - opencv

The image is downloaded from a slide captcha and I'm trying to find the gap in this image with OpenCV.
But the gap is missing in the image opened with cv2.imshow() .
I am not familiar with PNG nor OpenCV so I'm so confused right now.
I searched a lot but found nothing useful maybe caused by using wrong keywords.
image opened with Windows Viewer:
image opened with cv2.imshow() :
I'm wondering why the same image in image viewer and OpenCV looks different and is there an easy way to locate the difference?

Related

OpenCV reads invisible image

I edited a simple png image with gimp, but it made transparent background black. So I tried undo'ing it, but nothing changed. Then I completely deleted all pixels (ctrl+A and delete) - this made image completely blank (white). But then I read it with OpenCV (python, ubuntu 16.04) and I still could see that old picture!
This is simple code I used to read image. As you can see it is completely blank (white).
But then I run the code and I can still see the old picture!
Here you can see - it is completely empty. I opened it with Firefox, Gimp, default ubuntu image viewer, windows photo viewer - same blank image.
So I decided to try something and I drawed with Gimp on that picture:
And I ran same code again:
After undo'ing question mark image returned to same. I figured - it could be some software error - I rebooted - same. Then I copied 'nothing.png' to Win10. Same code - same result. Image is about 449kB size. Here it is:
What the hell is going on here?
GIMP didn't erase the RGB data, it just sets the alpha channel to 0.
That's enough... unless you ignore the alpha channel.
OpenCV ignores the alpha channel... it's just another channel, not special at all. OpenCV can read and write RGBA data, and you can use the alpha channel like any other channel. It's just that display with imshow ignores the alpha channel and shows you the RGB data.

iOS 11 heic format adds artifacts to masked image

I'm using the new HEIC format to save a masked image to documents directory.
When comparing to the PNG version of the same masked image I see that some new articafts have been added.
Here is a screenshot of the effected image:
Here's a link to working repository showcasing this issue (please view the generated image through the new ios 11 Files app).
https://github.com/vondiplo/heic_wrong_encode
The mask provided in the git is an 100x98 px, try to use a bigger resolution image as mask that's the reason why there are artifacts, also keep in mind that PNG is uncompressed while hevc/heif is compressed so you can't really compare them.
Edit
Since a better mask won't resolve your problem you'll have to stick with png, artefacts are an known block compression problem as this article describes
http://blog.biamp.com/understanding-video-compression-artifacts/
There is a posible solution to that, but i didn't see documentation from apple how it could be implemented, more details in this link http://www.uta.edu/faculty/krrao/dip/Courses/EE5359/Proposal%20HarshalShah-Interim-deblockingfilter.pdf

Issues with reading tif file in Octave

I am trying to read a medical imaging data which is in .tif format using Octave . It so happens that only software from https://fiji.sc/ has the ability to read the medical images I have. A sample of the image that I am referring is this one. This image is readable in.tif format only in fiji. The image can also be converted to jpg image. Only after data points is visible to other image editing software. Now the issue is , I want to load it into octave and read it - at the moment it is not possible. The imshow() function in octave is not allowing me to visualize the given .tif file.
So, if anybody has experience in reading such file formats please let me know. Thanks.
Your linked image is a 16bit grayscale image, see $ gm identify -verbose hello.tif. So lets load it into GNU Octave:
img = imread ("hello.tif");
hist (img(:), 200); # show histogram
Ah!, the main information of your image is in the range 0-600 (probably the image aquisition system used had 11 or 12bit resolution), so lets scale and print this part as color encoded (viridis) image:
imagesc (img, [0 600])
colorbar
Is this what you want? Of course we can also use a gray colormap, try: colormap gray
If this still doesn't fit your need you should really explain what you expect to see....
imread() relies on image magic to do the conversion, some versions of which can only read TIFF in 8-bit mode (giving a warning message), but when and how this happens I do not know.
It works for me using a .raw ṕicture converted to .tif in Fiji. I am specifically interested in several spectral analysis from my pictures which are taken illuminating with 660 and 850nm.

GeoTIFF files in ImageJ

I am trying to open GeoTIFF file in ImageJ. It is opened as blank black image. But I want the view as its JPEG converted image. Please If anyone can help me. I want to process that image for Oil Spill Detection.
I would recommend using the Fiji distribution of ImageJ. It includes the Bio-Formats importer which supports a huge number of image formats. It looks like it has support for GeoTIFF tags, as well.
Also, sometimes images "look" black but aren't truly. See this FAQ entry.

Get text from image with ImageMagick and Tesseract

I wanted to know if anyone has ever used Tesseract with ImageMagick to get precise text from image. My main concern is with the small font texts present in an image (or some text that are not clearly visible). The only way I am able to retrieve those unclear texts are by modifying the image by ImageMagick like - by scaling the image, sometimes cropping the image....
I wanted to know if someone has integrated ImageMagick and Tesseract to create even powerful tool?
Till now, I have come up with a script that can search the text in the image... The script uses imagemagick and tesseract. The script is still under development, but you can look at it here

Resources