opencv-ffi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Gemfile +15 -0
- data/README.md +126 -0
- data/Rakefile +52 -0
- data/docs/DocsIndex.md +1 -0
- data/docs/examples/load_image.rb +25 -0
- data/ext/Rakefile +13 -0
- data/ext/aishack-sift/.gitignore +4 -0
- data/ext/aishack-sift/Descriptor.h +34 -0
- data/ext/aishack-sift/KeyPoint.h +38 -0
- data/ext/aishack-sift/README +20 -0
- data/ext/aishack-sift/SIFT.cpp +1036 -0
- data/ext/aishack-sift/SIFT.h +84 -0
- data/ext/aishack-sift/example/.gitignore +2 -0
- data/ext/aishack-sift/example/Makefile +24 -0
- data/ext/aishack-sift/example/MySIFT.cpp +29 -0
- data/ext/aishack-sift/mkrf_conf.rb +13 -0
- data/ext/aishack-sift/siftlib.cpp +85 -0
- data/ext/eigen/.gitignore +4 -0
- data/ext/eigen/eigen_polynomial.cpp +41 -0
- data/ext/eigen/eigen_svd.cpp +100 -0
- data/ext/eigen/mkrf_conf.rb +14 -0
- data/ext/mkrf-monkey.rb +85 -0
- data/ext/mkrf-rakehelper-monkey.rb +52 -0
- data/ext/mkrf_conf.rb +3 -0
- data/ext/opencv-ffi/.gitignore +4 -0
- data/ext/opencv-ffi/matcher_helper.cpp +56 -0
- data/ext/opencv-ffi/mkrf_conf.rb +12 -0
- data/ext/opencv-ffi/vector_math.cpp +39 -0
- data/ext/opensurf/.gitignore +4 -0
- data/ext/opensurf/README +38 -0
- data/ext/opensurf/fasthessian.cpp +376 -0
- data/ext/opensurf/fasthessian.h +108 -0
- data/ext/opensurf/integral.cpp +58 -0
- data/ext/opensurf/integral.h +55 -0
- data/ext/opensurf/ipoint.cpp +108 -0
- data/ext/opensurf/ipoint.h +76 -0
- data/ext/opensurf/kmeans.h +172 -0
- data/ext/opensurf/mkrf_conf.rb +10 -0
- data/ext/opensurf/responselayer.h +92 -0
- data/ext/opensurf/surf.cpp +317 -0
- data/ext/opensurf/surf.h +66 -0
- data/ext/opensurf/surflib.cpp +98 -0
- data/ext/opensurf/surflib.h +96 -0
- data/ext/opensurf/utils.cpp +357 -0
- data/ext/opensurf/utils.h +63 -0
- data/lib/.gitignore +1 -0
- data/lib/opencv-ffi-ext/eigen.rb +84 -0
- data/lib/opencv-ffi-ext/features2d.rb +4 -0
- data/lib/opencv-ffi-ext/matcher_helper.rb +24 -0
- data/lib/opencv-ffi-ext/opensurf.rb +217 -0
- data/lib/opencv-ffi-ext/sift.rb +118 -0
- data/lib/opencv-ffi-ext/vector_math.rb +115 -0
- data/lib/opencv-ffi-wrappers.rb +7 -0
- data/lib/opencv-ffi-wrappers/core.rb +24 -0
- data/lib/opencv-ffi-wrappers/core/iplimage.rb +50 -0
- data/lib/opencv-ffi-wrappers/core/mat.rb +268 -0
- data/lib/opencv-ffi-wrappers/core/misc_draw.rb +44 -0
- data/lib/opencv-ffi-wrappers/core/point.rb +286 -0
- data/lib/opencv-ffi-wrappers/core/rect.rb +40 -0
- data/lib/opencv-ffi-wrappers/core/scalar.rb +104 -0
- data/lib/opencv-ffi-wrappers/core/size.rb +88 -0
- data/lib/opencv-ffi-wrappers/enumerable.rb +10 -0
- data/lib/opencv-ffi-wrappers/features2d.rb +17 -0
- data/lib/opencv-ffi-wrappers/features2d/image_patch.rb +322 -0
- data/lib/opencv-ffi-wrappers/features2d/star.rb +111 -0
- data/lib/opencv-ffi-wrappers/features2d/surf.rb +115 -0
- data/lib/opencv-ffi-wrappers/highgui.rb +10 -0
- data/lib/opencv-ffi-wrappers/imgproc.rb +4 -0
- data/lib/opencv-ffi-wrappers/imgproc/features.rb +35 -0
- data/lib/opencv-ffi-wrappers/imgproc/geometric.rb +39 -0
- data/lib/opencv-ffi-wrappers/matcher.rb +297 -0
- data/lib/opencv-ffi-wrappers/matrix.rb +37 -0
- data/lib/opencv-ffi-wrappers/misc.rb +41 -0
- data/lib/opencv-ffi-wrappers/misc/params.rb +34 -0
- data/lib/opencv-ffi-wrappers/sequence.rb +37 -0
- data/lib/opencv-ffi-wrappers/vectors.rb +38 -0
- data/lib/opencv-ffi.rb +12 -0
- data/lib/opencv-ffi/calib3d.rb +26 -0
- data/lib/opencv-ffi/core.rb +15 -0
- data/lib/opencv-ffi/core/draw.rb +68 -0
- data/lib/opencv-ffi/core/dynamic.rb +13 -0
- data/lib/opencv-ffi/core/library.rb +5 -0
- data/lib/opencv-ffi/core/operations.rb +122 -0
- data/lib/opencv-ffi/core/point.rb +22 -0
- data/lib/opencv-ffi/core/types.rb +172 -0
- data/lib/opencv-ffi/cvffi.rb +8 -0
- data/lib/opencv-ffi/features2d.rb +7 -0
- data/lib/opencv-ffi/features2d/library.rb +6 -0
- data/lib/opencv-ffi/features2d/star.rb +30 -0
- data/lib/opencv-ffi/features2d/surf.rb +38 -0
- data/lib/opencv-ffi/highgui.rb +31 -0
- data/lib/opencv-ffi/imgproc.rb +9 -0
- data/lib/opencv-ffi/imgproc/features.rb +37 -0
- data/lib/opencv-ffi/imgproc/geometric.rb +42 -0
- data/lib/opencv-ffi/imgproc/library.rb +6 -0
- data/lib/opencv-ffi/imgproc/misc.rb +39 -0
- data/lib/opencv-ffi/version.rb +3 -0
- data/opencv-ffi.gemspec +26 -0
- data/test/core/test_draw.rb +46 -0
- data/test/core/test_operations.rb +135 -0
- data/test/core/test_size.rb +14 -0
- data/test/core/test_text.rb +52 -0
- data/test/ext/test_eigen.rb +105 -0
- data/test/ext/test_opensurf.rb +35 -0
- data/test/ext/test_sift.rb +26 -0
- data/test/ext/test_vector_math.rb +85 -0
- data/test/features2d/test_surf.rb +63 -0
- data/test/imgproc/test_goodfeatures.rb +18 -0
- data/test/setup.rb +65 -0
- data/test/test_calib3d.rb +38 -0
- data/test/test_core.rb +26 -0
- data/test/test_ext.rb +8 -0
- data/test/test_features2d.rb +9 -0
- data/test/test_files/images/IMG_7088.JPG +0 -0
- data/test/test_files/images/IMG_7088_small.JPG +0 -0
- data/test/test_files/images/IMG_7089.JPG +0 -0
- data/test/test_highgui.rb +26 -0
- data/test/test_imgproc.rb +35 -0
- data/test/test_wrappers.rb +8 -0
- data/test/wrappers/core/test_draw.rb +41 -0
- data/test/wrappers/core/test_mat.rb +40 -0
- data/test/wrappers/core/test_operations.rb +35 -0
- data/test/wrappers/core/test_types.rb +235 -0
- data/test/wrappers/features2d/test_image_patch.rb +108 -0
- data/test/wrappers/test_imgproc.rb +87 -0
- data/test/wrappers/test_matcher.rb +96 -0
- data/test/wrappers/test_star.rb +28 -0
- data/test/wrappers/test_surf.rb +36 -0
- metadata +234 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
## An omnibus file which brings in all the core/* sub-files
|
2
|
+
|
3
|
+
require 'core'
|
4
|
+
|
5
|
+
module CVFFI
|
6
|
+
|
7
|
+
class CvPoint < NiceFFI::Struct
|
8
|
+
layout :x, :int,
|
9
|
+
:y, :int
|
10
|
+
end
|
11
|
+
|
12
|
+
class CvPoint2D32f < NiceFFI::Struct
|
13
|
+
layout :x, :float,
|
14
|
+
:y, :float
|
15
|
+
end
|
16
|
+
|
17
|
+
class CvPoint2D64f < NiceFFI::Struct
|
18
|
+
layout :x, :double,
|
19
|
+
:y, :double
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'opencv-ffi/core/library'
|
2
|
+
|
3
|
+
module CVFFI
|
4
|
+
|
5
|
+
class CvRect < NiceFFI::Struct
|
6
|
+
layout :x, :int,
|
7
|
+
:y, :int,
|
8
|
+
:width, :int,
|
9
|
+
:height, :int
|
10
|
+
end
|
11
|
+
|
12
|
+
class CvSizeBase < NiceFFI::Struct
|
13
|
+
end
|
14
|
+
|
15
|
+
class CvSize < CvSizeBase
|
16
|
+
layout :width, :int,
|
17
|
+
:height, :int
|
18
|
+
end
|
19
|
+
|
20
|
+
class CvSize2D32f < CvSizeBase
|
21
|
+
layout :width, :float,
|
22
|
+
:height, :float
|
23
|
+
end
|
24
|
+
|
25
|
+
class CvSize2D64f < CvSizeBase
|
26
|
+
layout :width, :double,
|
27
|
+
:height, :double
|
28
|
+
end
|
29
|
+
|
30
|
+
class CvPointBase < NiceFFI::Struct
|
31
|
+
end
|
32
|
+
|
33
|
+
class CvPoint < CvPointBase
|
34
|
+
layout :x, :int,
|
35
|
+
:y, :int
|
36
|
+
end
|
37
|
+
|
38
|
+
class CvPoint2D32f < CvPointBase
|
39
|
+
layout :x, :float,
|
40
|
+
:y, :float
|
41
|
+
end
|
42
|
+
|
43
|
+
class CvPoint2D64f < CvPointBase
|
44
|
+
layout :x, :double,
|
45
|
+
:y, :double
|
46
|
+
end
|
47
|
+
|
48
|
+
class CvPoint3DBase < NiceFFI::Struct
|
49
|
+
end
|
50
|
+
|
51
|
+
class CvPoint3D32f < CvPoint3DBase
|
52
|
+
layout :x, :float,
|
53
|
+
:y, :float,
|
54
|
+
:z, :float
|
55
|
+
end
|
56
|
+
|
57
|
+
class CvPoint3D64f < CvPoint3DBase
|
58
|
+
layout :x, :double,
|
59
|
+
:y, :double,
|
60
|
+
:z, :double
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
#
|
66
|
+
# CvScalar
|
67
|
+
#
|
68
|
+
class CvScalar < NiceFFI::Struct
|
69
|
+
# layout :val, [:double, 4 ]
|
70
|
+
layout :w, :double,
|
71
|
+
:x, :double,
|
72
|
+
:y, :double,
|
73
|
+
:z, :double
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# CvMat
|
78
|
+
#
|
79
|
+
class CvMat < NiceFFI::Struct
|
80
|
+
layout :type, :int,
|
81
|
+
:step, :int,
|
82
|
+
:refcount, :pointer,
|
83
|
+
:hdr_refcount, :int,
|
84
|
+
:data, :pointer,
|
85
|
+
:height, :int,
|
86
|
+
:width, :int
|
87
|
+
|
88
|
+
hidden :refcount, :hdr_refcount
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# IplImage
|
93
|
+
#
|
94
|
+
enum :IplDepth, [ :IPL_DEPTH_1U, 1,
|
95
|
+
:IPL_DEPTH_8U, 8,
|
96
|
+
:IPL_DEPTH_16U, 16,
|
97
|
+
:IPL_DEPTH_32F, 32 ]
|
98
|
+
|
99
|
+
class IplImage < NiceFFI::Struct
|
100
|
+
layout :nSize, :int,
|
101
|
+
:ID, :int,
|
102
|
+
:nChannels, :int,
|
103
|
+
:alphaChannel, :int,
|
104
|
+
:depth, :int,
|
105
|
+
:colorModel, [:char, 4],
|
106
|
+
:channelSeq, [:char, 4],
|
107
|
+
:dataOrder, :int,
|
108
|
+
:origin, :int,
|
109
|
+
:align, :int,
|
110
|
+
:width, :int,
|
111
|
+
:height, :int,
|
112
|
+
:roi, :pointer,
|
113
|
+
:maskROI, :pointer,
|
114
|
+
:imageId, :pointer,
|
115
|
+
:tileInfo, :pointer,
|
116
|
+
:imageSize, :int,
|
117
|
+
:imageData, :pointer,
|
118
|
+
:widthStep, :int,
|
119
|
+
:BorderMode, [:int, 4],
|
120
|
+
:imageDataOrigin, :pointer
|
121
|
+
|
122
|
+
# def self.release(ptr)
|
123
|
+
# p ptr
|
124
|
+
# CVFFI::cvReleaseData( ptr )
|
125
|
+
# end
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
#
|
130
|
+
# CvSeq and assoc
|
131
|
+
#
|
132
|
+
class CvSeqBlock < NiceFFI::Struct
|
133
|
+
layout :prev, NiceFFI::TypedPointer( CvSeqBlock ),
|
134
|
+
:next, NiceFFI::TypedPointer( CvSeqBlock ),
|
135
|
+
:start_index, :int,
|
136
|
+
:count, :int,
|
137
|
+
:data, :pointer
|
138
|
+
end
|
139
|
+
|
140
|
+
class CvMemBlock < NiceFFI::Struct
|
141
|
+
layout :prev, NiceFFI::TypedPointer( CvMemBlock ),
|
142
|
+
:next, NiceFFI::TypedPointer( CvMemBlock )
|
143
|
+
end
|
144
|
+
|
145
|
+
class CvMemStorage < NiceFFI::Struct
|
146
|
+
layout :signature, :int,
|
147
|
+
:bottom, NiceFFI::TypedPointer( CvMemBlock ),
|
148
|
+
:top, NiceFFI::TypedPointer( CvMemBlock ),
|
149
|
+
:parent, NiceFFI::TypedPointer( CvMemStorage ),
|
150
|
+
:block_size, :int,
|
151
|
+
:free_space, :int
|
152
|
+
end
|
153
|
+
|
154
|
+
class CvSeq < NiceFFI::Struct
|
155
|
+
layout :flags, :int,
|
156
|
+
:header_size, :int,
|
157
|
+
:h_prev, NiceFFI::TypedPointer( CvSeq ),
|
158
|
+
:h_next, NiceFFI::TypedPointer( CvSeq ),
|
159
|
+
:v_prev, NiceFFI::TypedPointer( CvSeq ),
|
160
|
+
:v_prev, NiceFFI::TypedPointer( CvSeq ),
|
161
|
+
:total, :int,
|
162
|
+
:elem_size, :int,
|
163
|
+
:block_max, :pointer,
|
164
|
+
:ptr, :pointer,
|
165
|
+
:delta_elems, :int,
|
166
|
+
:storage, NiceFFI::TypedPointer( CvMemStorage ),
|
167
|
+
:free_blocks, NiceFFI::TypedPointer( CvSeqBlock ),
|
168
|
+
:first, NiceFFI::TypedPointer( CvSeqBlock )
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'opencv-ffi/cvffi'
|
2
|
+
require 'opencv-ffi/core'
|
3
|
+
require 'opencv-ffi/features2d/library'
|
4
|
+
|
5
|
+
module CVFFI
|
6
|
+
|
7
|
+
class CvStarDetectorParams < NiceFFI::Struct
|
8
|
+
layout :maxSize, :int, # maximal size of the features
|
9
|
+
# detected. The following
|
10
|
+
# values of the parameter are supported:
|
11
|
+
# 4, 6, 8, 11, 12, 16, 22, 23, 32, 45, 46, 64, 90, 128
|
12
|
+
:responseThreshold, :int, # threshold for the approximatd laplacian,
|
13
|
+
# used to eliminate weak features
|
14
|
+
:lineThresholdProjected, :int, # another threshold for laplacian to
|
15
|
+
# eliminate edges
|
16
|
+
:lineThresholdBinarized, :int, # another threshold for the feature
|
17
|
+
# scale to eliminate edges
|
18
|
+
:suppressNonmaxSize, :int # linear size of a pixel neighborhood
|
19
|
+
# for non-maxima suppression
|
20
|
+
end
|
21
|
+
|
22
|
+
class CvStarKeypoint < NiceFFI::Struct
|
23
|
+
layout :pt, CvPoint,
|
24
|
+
:size, :int,
|
25
|
+
:response, :float
|
26
|
+
end
|
27
|
+
|
28
|
+
attach_function :cvGetStarKeypoints, [ :pointer, :pointer, CvStarDetectorParams.by_value ], CvSeq.typed_pointer
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
require 'opencv-ffi/cvffi'
|
3
|
+
require 'opencv-ffi/core'
|
4
|
+
require 'opencv-ffi/features2d/library'
|
5
|
+
|
6
|
+
module CVFFI
|
7
|
+
|
8
|
+
|
9
|
+
class CvSURFParams < NiceFFI::Struct
|
10
|
+
layout :extended, :int,
|
11
|
+
:upright, :int,
|
12
|
+
:hessianThreshold, :double,
|
13
|
+
:nOctaves, :int,
|
14
|
+
:nOctaveLayers, :int
|
15
|
+
end
|
16
|
+
|
17
|
+
class CvSURFPoint < NiceFFI::Struct
|
18
|
+
layout :pt, CvPoint2D32f,
|
19
|
+
:laplacian, :int,
|
20
|
+
:size, :int,
|
21
|
+
:dir, :float,
|
22
|
+
:hessian, :float
|
23
|
+
end
|
24
|
+
|
25
|
+
# CVAPI(void) cvExtractSURF( const CvArr* img,
|
26
|
+
# const CvArr* mask,
|
27
|
+
# CvSeq** keypoints,
|
28
|
+
# CvSeq** descriptors,
|
29
|
+
# CvMemStorage* storage,
|
30
|
+
# CvSURFParams params,
|
31
|
+
# int useProvidedKeyPts CV_DEFAULT(0) );
|
32
|
+
|
33
|
+
attach_function :cvExtractSURF, [ :pointer, :pointer,
|
34
|
+
:pointer, :pointer,
|
35
|
+
:pointer,
|
36
|
+
CvSURFParams.by_value, :cvBoolean ], :void
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
require 'nice-ffi'
|
3
|
+
require 'opencv-ffi/core'
|
4
|
+
|
5
|
+
module CVFFI
|
6
|
+
extend NiceFFI::Library
|
7
|
+
|
8
|
+
load_library("opencv_highgui", @pathset)
|
9
|
+
|
10
|
+
CV_LOAD_IMAGE_UNCHANGED =-1
|
11
|
+
CV_LOAD_IMAGE_GRAYSCALE = 0
|
12
|
+
CV_LOAD_IMAGE_COLOR = 1
|
13
|
+
|
14
|
+
attach_function :cvLoadImageMFull, :cvLoadImageM, [ :string, :int ], CvMat.typed_pointer
|
15
|
+
attach_function :cvLoadImageFull, :cvLoadImage, [ :string, :int ], IplImage.typed_pointer
|
16
|
+
|
17
|
+
def self.cvLoadImageM( fname, color = CV_LOAD_IMAGE_COLOR )
|
18
|
+
cvLoadImageMFull( fname, color )
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.cvLoadImage( fname, color = CV_LOAD_IMAGE_COLOR )
|
22
|
+
cvLoadImageFull( fname, color )
|
23
|
+
end
|
24
|
+
|
25
|
+
attach_function :cvSaveImageFull, :cvSaveImage, [ :string, :pointer, :pointer ], :int
|
26
|
+
|
27
|
+
def self.cvSaveImage( name, ptr, params = nil )
|
28
|
+
cvSaveImageFull( name, ptr, params )
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require 'opencv-ffi/imgproc/library'
|
3
|
+
|
4
|
+
module CVFFI
|
5
|
+
|
6
|
+
# CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
|
7
|
+
# CvArr* temp_image, CvPoint2D32f* corners,
|
8
|
+
# int* corner_count, double quality_level,
|
9
|
+
# double min_distance,
|
10
|
+
# const CvArr* mask CV_DEFAULT(NULL),
|
11
|
+
# int block_size CV_DEFAULT(3),
|
12
|
+
# int use_harris CV_DEFAULT(0),
|
13
|
+
# double k CV_DEFAULT(0.04) );
|
14
|
+
attach_function :real_cvGoodFeaturesToTrack, :cvGoodFeaturesToTrack,
|
15
|
+
[:pointer, :pointer, :pointer, :pointer, :pointer, :double, :double, :pointer, :int, :int, :double], :void
|
16
|
+
|
17
|
+
# This version diverges from the OpenCV API because the original returns
|
18
|
+
# an array of Point2D32f in corners ... this functions will provide
|
19
|
+
# is as a return value.
|
20
|
+
#
|
21
|
+
# @param max_corners The maximum number of corners to return
|
22
|
+
# @return An array of CvPoint2D32f giving the detected corners.
|
23
|
+
def self.cvGoodFeaturesToTrack( image, eig_image, temp_image, max_corners, quality_level, min_distance,
|
24
|
+
mask = nil, block_size = 3, use_harris = false, k = 0.04 )
|
25
|
+
|
26
|
+
corner_count_ptr = FFI::MemoryPointer.new :int
|
27
|
+
corner_count_ptr.write_int max_corners
|
28
|
+
corner_ptr = FFI::MemoryPointer.new CvPoint2D32f, max_corners
|
29
|
+
CVFFI::real_cvGoodFeaturesToTrack( image, eig_image, temp_image, corner_ptr, corner_count_ptr, quality_level, min_distance, mask, block_size, use_harris ? 1 : 0, k )
|
30
|
+
|
31
|
+
corner_count = corner_count_ptr.read_int
|
32
|
+
corners = Array.new( corner_count ) { |i|
|
33
|
+
CvPoint2D32f.new( corner_ptr[i] )
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'opencv-ffi/core/types'
|
4
|
+
require 'opencv-ffi/imgproc/library'
|
5
|
+
|
6
|
+
module CVFFI
|
7
|
+
|
8
|
+
attach_function :cvGetAffineTransform, [ :pointer, :pointer, :pointer ], CvMat.typed_pointer
|
9
|
+
|
10
|
+
@cvWarpFlags = enum :cvWarpFlags, [ :CV_INTER_LINEAR, 1,
|
11
|
+
:CV_WARP_FILL_OUTLIERS, 8,
|
12
|
+
:CV_WARP_INVERSE_MAP, 16 ]
|
13
|
+
|
14
|
+
def self.cv_warp_flags_to_i( a )
|
15
|
+
if @cvWarpFlags.symbols.include? a
|
16
|
+
@cvWarpFlags[a]
|
17
|
+
else
|
18
|
+
raise ::RuntimeError, "Undefined cvWarpFlags value #{a.inspect}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# CVAPI(void) cvWarpAffine( const CvArr* src,
|
23
|
+
# CvArr* dst,
|
24
|
+
# const CvMat* map_matrix,
|
25
|
+
# int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
26
|
+
# CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
|
27
|
+
attach_function :cvWarpAffineReal, :cvWarpAffine, [ :pointer, :pointer, :pointer, :int, CvScalar.by_value ], :void
|
28
|
+
|
29
|
+
def self.cvWarpAffine( src, dst, map_matrix, flags = nil, fillval = nil )
|
30
|
+
flags ||= @cvWarpFlags[:CV_INTER_LINEAR]+@cvWarpFlags[:CV_WARP_FILL_OUTLIERS]
|
31
|
+
fillval ||= CVFFI::CvScalar.new( [0,0,0,0] )
|
32
|
+
|
33
|
+
cvWarpAffineReal( src,dst,map_matrix,flags,fillval )
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
# CVAPI(CvMat*) cv2DRotationMatrix( CvPoint2D32f center,
|
38
|
+
# double angle,
|
39
|
+
# double scale,
|
40
|
+
# CvMat* map_matrix );
|
41
|
+
attach_function :cv2DRotationMatrix, [ CvPoint2D32f.by_value, :double, :double, :pointer ], :void
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
require 'opencv-ffi/imgproc/library'
|
3
|
+
|
4
|
+
module CVFFI
|
5
|
+
|
6
|
+
enum :cvCvtCodes, [ :CV_RGB2RGB, 0,
|
7
|
+
:CV_BGR2BGRA, 0,
|
8
|
+
:CV_RGBA2RGB,
|
9
|
+
:CV_BGRA2BGR, 1,
|
10
|
+
:CV_RGB2BGRA,
|
11
|
+
:CV_BGR2RGBA, 2,
|
12
|
+
:CV_RGBA2BGR,
|
13
|
+
:CV_BGRA2RGB, 3,
|
14
|
+
:CV_BGR2RGB,
|
15
|
+
:CV_RGB2BGR, 4,
|
16
|
+
:CV_BGRA2RGBA,
|
17
|
+
:CV_RGBA2BGRA, 5,
|
18
|
+
:CV_BGR2GRAY,
|
19
|
+
:CV_RGB2GRAY,
|
20
|
+
:CV_GRAY2BGR,
|
21
|
+
:CV_GRAY2RGB, 8,
|
22
|
+
:CV_GRAY2BGRA,
|
23
|
+
:CV_GRAY2RGBA, 9,
|
24
|
+
:CV_BGRA2GRAY,
|
25
|
+
:CV_RGBA2GRAYa ]
|
26
|
+
|
27
|
+
attach_function :cvCvtColor, [ :pointer, :pointer, :cvCvtCodes ], :void
|
28
|
+
|
29
|
+
|
30
|
+
enum :cvInterpolation, [ :CV_INTER_NN, 0,
|
31
|
+
:CV_INTER_LINEAR,
|
32
|
+
:CV_INTER_CUBIC,
|
33
|
+
:CV_INTER_AREA,
|
34
|
+
:CV_INTER_LANCZOS4 ]
|
35
|
+
|
36
|
+
attach_function :cvResize, [ :pointer, :pointer, :cvInterpolation ], :void
|
37
|
+
|
38
|
+
|
39
|
+
end
|