similie 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/ext/similie.c +5 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/ext/similie.c
CHANGED
@@ -55,15 +55,18 @@ int popcount(uint64_t x) {
|
|
55
55
|
#define DCT_SIZE 32
|
56
56
|
|
57
57
|
uint64_t image_phash(IplImage *img) {
|
58
|
-
uint64_t phash = 0;
|
59
58
|
int x, y;
|
60
59
|
double avg;
|
60
|
+
uint64_t phash = 0;
|
61
61
|
|
62
62
|
IplImage *small = cvCreateImage(cvSize(64, 64), img->depth, img->nChannels);
|
63
63
|
IplImage *mono = cvCreateImage(cvSize(64, 64), img->depth, 1);
|
64
64
|
|
65
65
|
cvResize(img, small, CV_INTER_CUBIC);
|
66
|
-
|
66
|
+
if (img->nChannels == 1)
|
67
|
+
cvCopy(small, mono, 0);
|
68
|
+
else
|
69
|
+
cvCvtColor(small, mono, CV_RGB2GRAY);
|
67
70
|
|
68
71
|
CvMat *dct = cvCreateMat(DCT_SIZE, DCT_SIZE, CV_32FC1);
|
69
72
|
for (x = 0; x < DCT_SIZE; x++) {
|