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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/ext/similie.c +5 -2
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
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
- cvCvtColor(small, mono, CV_RGB2GRAY);
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++) {
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bharanee Rathna