"I compared the images of Kantai Collection with the index of Hu Moment."
The Hu moment invariant was used as the index to compare the images. Image moment - Wikipedia(en)
The Hu moment takes an invariant value with respect to image rotation and scaling. The implementation is included in OpenCV, so you can use it as is.
Also, the Python implementation is based on the following. Image reading is cv2.IMREAD_GRAYSCALE. Reference: Search for similar images by Hu moment invariant
The image set was borrowed from @kiguchiyura's KanColle Icon Summary [Free Icon].
Snowstorm | Kumano | Thunder | Den | Shigure | Shigure改二 | Oi Kai | Oi Kai二 | Z1 | Z3 | |
---|---|---|---|---|---|---|---|---|---|---|
Snowstorm | 0.00 | 12.45 | 5.78 | 5.02 | 12.63 | 12.94 | 9.07 | 9.02 | 3.94 | 4.04 |
Kumano | 12.45 | 0.00 | 8.08 | 9.76 | 0.73 | 0.94 | 3.71 | 3.72 | 9.02 | 9.29 |
Thunder | 5.78 | 8.08 | 0.00 | 9.32 | 8.14 | 8.08 | 4.82 | 4.76 | 9.67 | 9.66 |
Den | 5.02 | 9.76 | 9.32 | 0.00 | 10.03 | 10.07 | 6.40 | 6.33 | 1.73 | 8.47 |
Shigure | 12.63 | 0.73 | 8.14 | 10.03 | 0.00 | 0.46 | 4.15 | 4.16 | 9.13 | 9.13 |
Shigure Kaiji | 12.94 | 0.94 | 8.08 | 10.07 | 0.46 | 0.00 | 4.54 | 4.55 | 9.53 | 9.53 |
Oi Kai | 9.07 | 3.71 | 4.82 | 6.40 | 4.15 | 4.54 | 0.00 | 0.08 | 5.53 | 12.41 |
Kaiji Oi | 9.02 | 3.72 | 4.76 | 6.33 | 4.16 | 4.55 | 0.08 | 0.00 | 5.46 | 12.40 |
Z1 | 3.94 | 9.02 | 9.67 | 1.73 | 9.13 | 9.53 | 5.53 | 5.46 | 0.00 | 7.23 |
Z3 | 4.04 | 9.29 | 9.66 | 8.47 | 9.13 | 9.53 | 12.41 | 12.40 | 7.23 | 0.00 |
The two reformers such as Shigure and Oi look exactly the same before and after the remodeling, so it makes sense. On the other hand, the reason why thunder and electricity look very similar but there is a big difference is probably because of the difference in hair color. The reason why the biggest difference between Shigure Kaiji and Snowstorm may be the same. Since I am reading the image in grayscale this time, it may be a little closer if RGB etc. are taken into consideration.
Thunder(original) | Thunder(rotation) | Thunder(Dialogue change) | Thunder(Reduction / transparency of margins) | Thunder(Reduction / margin filling) | |
---|---|---|---|---|---|
Thunder(original) | 0.00 | 0.16 | 0.29 | 0.03 | 5.88 |
Thunder(rotation) | 0.16 | 0.00 | 0.39 | 0.13 | 5.96 |
Thunder(Dialogue change) | 0.29 | 0.39 | 0.00 | 0.31 | 5.71 |
Thunder(Reduction / transparency of margins) | 0.03 | 0.13 | 0.31 | 0.00 | 5.90 |
Thunder(Reduction / margin filling) | 5.88 | 5.96 | 5.71 | 5.90 | 0.00 |
Only the sample with the reduced margins filled with white is judged as a different image. I wonder why.
Image Source: Using Waifu2x to Upscale Japanese Prints
img1.png | img2.png | |
---|---|---|
img1.png | 0.00 | 0.05 |
img2.png | 0.05 | 0.00 |
A comparison of images converted by waifu2x. Since the original image is the same, it is almost the same value. As an aside, it is John Resig (the developer of jQuery) who reports this ukiyo-e transformation. ([Wikipedia](http://en.wikipedia.org/wiki/%E3%82%B8%E3%83%A7%E3%83%B3%E3%83%BB%E3%83%AC%E3% 82% B7% E3% 82% B0)))
I think that more interesting results will be obtained depending on the sample, so I will summarize the execution procedure for Windows. You can make the same comparison by introducing Python2, numpy, and OpenCV.
I used Chocolatey as a package management tool. It's like the Windows version of apt-get or yum. Software with Nuget packages registered can be entered with a single chocolatey command and managed collectively.
Simply download and unzip the installer from the Official Distribution Page. It's very easy. This time I have installed 3.0.0-rc1.
Use chocolatey. There are two Python2 packages (python2 and python2-x86_32), but Python, which automatically works with numpy distributed by chocolatey, can be installed from the following command.
$ chocolatey install python2-x86_32
$ chocolatey install numpy
Cv2.pyd located in OPENCV_FILE_PATH \ opencv \ build \ python \ 2.7 \ x64 Copy to C: \ Python27 \ Lib \ site-packages.
sample.py
import cv2
#code
print "hoge"
You should now be able to use cv2 on Python. Easy. Please try various things.
Depending on the installation procedure and environment, PATH may not be set properly.
In that case,
C:\OPENCV_FILE_PATH\opencv-3.0.0\build\x64\vc11\bin
C:\python2-x86_32
Try through the path to.
Recommended Posts