diff --git a/ext/opencv/cvmat.cpp b/ext/opencv/cvmat.cpp
index 38c0131..ef189ed 100644
--- a/ext/opencv/cvmat.cpp
+++ b/ext/opencv/cvmat.cpp
@@ -3506,7 +3506,7 @@ rb_corner_harris(int argc, VALUE *argv, VALUE self)
* corners, found = gray.find_chessboard_corners(pattern_size, CV_CALIB_CB_ADAPTIVE_THRESH)
*
* if found
- * corners = gray.find_corner_sub_pix(corners, CvSize.new(3, 3), CvSize.new(-1, -1), CvTermCriteria.new(20, 0.03));
+ * corners = gray.find_corner_sub_pix(corners, CvSize.new(3, 3), CvSize.new(-1, -1), CvTermCriteria.new(20, 0.03))
* end
*
* result = mat.draw_chessboard_corners(pattern_size, corners, found)
@@ -3850,11 +3850,14 @@ rb_rotation_matrix2D(VALUE self, VALUE center, VALUE angle, VALUE scale)
}
/*
- * call-seq:
- * CvMat.get_perspective_transform(from_points,to_points) -> cvmat
- *
* Calculates a perspective transform from four pairs of the corresponding points.
- * Returns a matrix suitable for use with warp_perspective
+ *
+ * @overload get_perspective_transform(src, dst)
+ * @param src [Array] Coordinates of quadrangle vertices in the source image.
+ * @param dst [Array] Coordinates of the corresponding quadrangle vertices in the destination image.
+ * @return [CvMat] Map matrix
+ * @scope class
+ * @opencv_func cvGetPerspectiveTransform
*/
VALUE
rb_get_perspective_transform(VALUE self, VALUE source, VALUE dest)
@@ -3884,11 +3887,13 @@ rb_get_perspective_transform(VALUE self, VALUE source, VALUE dest)
}
/*
+ * Applies a perspective transformation to an image.
+ *
* @overload warp_perspective(map_matrix, flags = CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS, fillval = 0)
- * @param map_matrix [CvMat] 3x3 transformation matrix.
- * @param flags [Integer] Combination of interpolation methods (CV_INTER_LINEAR or CV_INTER_NEAREST)
- * and the optional flag CV_WARP_INVERSE_MAP, that sets map_matrix as the inverse transformation.
- * @param fillval [Number, CvScalar] Value used in case of a constant border.
+ * @param map_matrix [CvMat] 3x3 transformation matrix.
+ * @param flags [Integer] Combination of interpolation methods (CV_INTER_LINEAR or CV_INTER_NEAREST)
+ * and the optional flag CV_WARP_INVERSE_MAP, that sets map_matrix as the inverse transformation.
+ * @param fillval [Number, CvScalar] Value used in case of a constant border.
* @return [CvMat] Output image.
* @opencv_func cvWarpPerspective
*/
@@ -3916,15 +3921,14 @@ rb_warp_perspective(int argc, VALUE *argv, VALUE self)
* Applies a generic geometrical transformation to an image.
*
* @overload remap(mapx, mapy, flags = CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS, fillval = 0)
- * @param mapx [CvMat] The first map of either (x,y) points or just x values having the type
- * CV_16SC2, CV_32FC1, or CV_32FC2.
- * @param mapy [CvMat] The second map of y values having the type CV_16UC1, CV_32FC1, or none
- * (empty map if mapx is (x,y) points), respectively.
- * @param flags [Integer] Combination of interpolation methods (CV_INTER_LINEAR or CV_INTER_NEAREST)
- * and the optional flag CV_WARP_INVERSE_MAP, that sets map_matrix as the inverse transformation.
- * @param fillval [Number, CvScalar] Value used in case of a constant border.
+ * @param mapx [CvMat] The first map of either (x,y) points or just x values having the type
+ * CV_16SC2, CV_32FC1, or CV_32FC2.
+ * @param mapy [CvMat] The second map of y values having the type CV_16UC1, CV_32FC1, or none
+ * (empty map if mapx is (x,y) points), respectively.
+ * @param flags [Integer] Combination of interpolation methods (CV_INTER_LINEAR or CV_INTER_NEAREST)
+ * and the optional flag CV_WARP_INVERSE_MAP, that sets map_matrix as the inverse transformation.
+ * @param fillval [Number, CvScalar] Value used in case of a constant border.
* @return [CvMat] Output image.
- * @return [CvMat] Destination image.
* @opencv_func cvRemap
*/
VALUE
@@ -3951,13 +3955,13 @@ rb_remap(int argc, VALUE *argv, VALUE self)
* Remaps an image to log-polar space.
*
* @overload log_polar(size, center, magnitude, flags = CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS)
- * @param size [CvSize] Size of the destination image.
- * @param center [CvPoint2D32f] The transformation center; where the output precision is maximal.
- * @param magnitude [Number] Magnitude scale parameter.
- * @param flags [Integer] A combination of interpolation methods and the following optional flags:
- * * CV_WARP_FILL_OUTLIERS - fills all of the destination image pixels. If some of them
- * correspond to outliers in the source image, they are set to zero.
- * * CV_WARP_INVERSE_MAP - performs inverse transformation.
+ * @param size [CvSize] Size of the destination image.
+ * @param center [CvPoint2D32f] The transformation center; where the output precision is maximal.
+ * @param magnitude [Number] Magnitude scale parameter.
+ * @param flags [Integer] A combination of interpolation methods and the following optional flags:
+ * * CV_WARP_FILL_OUTLIERS - fills all of the destination image pixels. If some of them
+ * correspond to outliers in the source image, they are set to zero.
+ * * CV_WARP_INVERSE_MAP - performs inverse transformation.
* @return [CvMat] Destination image.
* @opencv_func cvLogPolar
*/
@@ -4390,11 +4394,42 @@ rb_threshold_internal(int threshold_type, VALUE threshold, VALUE max_value, VALU
}
/*
- * call-seq:
- * threshold(threshold, max_value, threshold_type[,use_otsu = false])
- *
- * Applies fixed-level threshold to array elements.
+ * Applies a fixed-level threshold to each array element.
*
+ * @overload threshold(threshold, max_value, threshold_type)
+ * @param threshold [Number] Threshold value.
+ * @param max_value [Number] Maximum value to use with the CV_THRESH_BINARY
+ * and CV_THRESH_BINARY_INV thresholding types.
+ * @param threshold_type [Integer] Thresholding type
+ * * CV_THRESH_BINARY
+ * * CV_THRESH_BINARY_INV
+ * * CV_THRESH_TRUNC
+ * * CV_THRESH_TOZERO
+ * * CV_THRESH_TOZERO_INV
+ * @return [CvMat] Output array of the same size and type as self.
+ * @overload threshold(threshold, max_value, threshold_type, use_otsu)
+ * @param threshold [Number] Threshold value.
+ * @param max_value [Number] Maximum value to use with the CV_THRESH_BINARY
+ * and CV_THRESH_BINARY_INV thresholding types.
+ * @param threshold_type [Integer] Thresholding type
+ * * CV_THRESH_BINARY
+ * * CV_THRESH_BINARY_INV
+ * * CV_THRESH_TRUNC
+ * * CV_THRESH_TOZERO
+ * * CV_THRESH_TOZERO_INV
+ * @param use_otsu [Boolean] Determines the optimal threshold value using the Otsu's algorithm
+ * @return [Array] Output array and Otsu's threshold.
+ * @opencv_func cvThreshold
+ * @example
+ * mat = CvMat.new(3, 3, CV_8U, 1)
+ * mat.set_data([1, 2, 3, 4, 5, 6, 7, 8, 9])
+ * mat #=> [1, 2, 3,
+ * 4, 5, 6,
+ * 7, 8, 9]
+ * result = mat.threshold(4, 7, CV_THRESH_BINARY)
+ * result #=> [0, 0, 0,
+ * 0, 7, 7,
+ * 7, 7, 7]
*/
VALUE
rb_threshold(int argc, VALUE *argv, VALUE self)
@@ -4409,21 +4444,34 @@ rb_threshold(int argc, VALUE *argv, VALUE self)
return rb_threshold_internal(type, threshold, max_value, use_otsu, self);
}
-
/*
- * call-seq:
- * adaptive_threshold(max_value[, options]) -> cvmat
- *
* Applies an adaptive threshold to an array.
*
- * ==== params:
- *
- * * max_value (Number) - Maximum value that is used with +CV_THRESH_BINARY+ and +CV_THRESH_BINARY_INV+
- * * options (Hash) - threshold option
- * * :threshold_type (Integer or Symbol) - Thresholding type; must be one of +CV_THRESH_BINARY+ or +:binary+, +CV_THRESH_BINARY_INV+ or +:binary_inv+ (default: +CV_THRESH_BINARY+)
- * * :adaptive_method (Integer or Symbol) - Adaptive thresholding algorithm to use: +CV_ADAPTIVE_THRESH_MEAN_C+ or +:mean_c+, +CV_ADAPTIVE_THRESH_GAUSSIAN_C+ or +:gaussian_c+ (default: +CV_ADAPTIVE_THRESH_MEAN_C+)
- * * :block_size (Integer) - The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on (default: 3)
- * * :param1 (Number) - The method-dependent parameter. For the methods +CV_ADAPTIVE_THRESH_MEAN_C+ and +CV_ADAPTIVE_THRESH_GAUSSIAN_C+ it is a constant subtracted from the mean or weighted mean, though it may be negative (default: 5)
+ * @overload adaptive_threshold(max_value, options)
+ * @param max_value [Number] Non-zero value assigned to the pixels for which the condition is satisfied.
+ * @param options [Hash] Threshold option
+ * @option options [Integer, Symbol] :threshold_type (CV_THRESH_BINARY) Thresholding type;
+ * must be one of CV_THRESH_BINARY or :binary, CV_THRESH_BINARY_INV or :binary_inv.
+ * @option options [Integer, Symbol] :adaptive_method (CV_ADAPTIVE_THRESH_MEAN_C) Adaptive thresholding algorithm to use:
+ * CV_ADAPTIVE_THRESH_MEAN_C or :mean_c, CV_ADAPTIVE_THRESH_GAUSSIAN_C or :gaussian_c.
+ * @option options [Integer] :block_size (3) The size of a pixel neighborhood that is used to calculate a threshold value
+ * for the pixel: 3, 5, 7, and so on.
+ * @option options :param1 [Number] (5) The method-dependent parameter. For the methods CV_ADAPTIVE_THRESH_MEAN_C
+ * and CV_ADAPTIVE_THRESH_GAUSSIAN_C it is a constant subtracted from the mean or weighted mean, though it may be negative
+ * @return [CvMat] Destination image of the same size and the same type as self.
+ * @opencv_func cvAdaptiveThreshold
+ * @example
+ * mat = CvMat.new(3, 3, CV_8U, 1)
+ * mat.set_data([1, 2, 3, 4, 5, 6, 7, 8, 9])
+ * mat #=> [1, 2, 3,
+ * 4, 5, 6,
+ * 7, 8, 9]
+ * result = mat.adaptive_threshold(7, threshold_type: CV_THRESH_BINARY,
+ * adaptive_method: CV_ADAPTIVE_THRESH_MEAN_C,
+ * block_size: 3, param1: 1)
+ * result #=> [0, 0, 0,
+ * 7, 7, 7,
+ * 7, 7, 7]
*/
VALUE
rb_adaptive_threshold(int argc, VALUE *argv, VALUE self)
@@ -4470,7 +4518,8 @@ rb_adaptive_threshold(int argc, VALUE *argv, VALUE self)
* Return downsamples image.
*
* This operation performs downsampling step of Gaussian pyramid decomposition.
- * First it convolves source image with the specified filter and then downsamples the image by rejecting even rows and columns.
+ * First it convolves source image with the specified filter and then downsamples the image
+ * by rejecting even rows and columns.
*
* note: filter - only :gaussian_5x5 is currently supported.
*/
@@ -4509,7 +4558,8 @@ rb_pyr_down(int argc, VALUE *argv, VALUE self)
* Return upsamples image.
*
* This operation performs up-sampling step of Gaussian pyramid decomposition.
- * First it upsamples the source image by injecting even zero rows and columns and then convolves result with the specified filter multiplied by 4 for interpolation.
+ * First it upsamples the source image by injecting even zero rows and columns and
+ * then convolves result with the specified filter multiplied by 4 for interpolation.
* So the destination image is four times larger than the source image.
*
* note: filter - only :gaussian_5x5 is currently supported.
@@ -4544,43 +4594,27 @@ rb_pyr_up(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * flood_fill(seed_point, new_val, lo_diff, up_diff[,flood_fill_option]) -> [cvmat, cvconnectedcomp, iplimage(mask)]
+ * Fills a connected component with the given color.
*
- * Return image filled a connnected compoment with given color.
- * This operation fills a connected component starting from the seed point with the specified color.
- * The connectivity is determined by the closeness of pixel values.
- * The pixel at (x, y) is considered to belong to the repainted domain if:
- *
- * src(x',y')-lo_diff<=src(x,y)<=src(x',y')+up_diff, grayscale image, floating range
- * src(seed.x,seed.y)-lo<=src(x,y)<=src(seed.x,seed.y)+up_diff, grayscale image, fixed range
- * src(x',y')r-lo_diffr<=src(x,y)r<=src(x',y')r+up_diffr and
- * src(x',y')g-lo_diffg<=src(x,y)g<=src(x',y')g+up_diffg and
- * src(x',y')b-lo_diffb<=src(x,y)b<=src(x',y')b+up_diffb, color image, floating range
- * src(seed.x,seed.y)r-lo_diffr<=src(x,y)r<=src(seed.x,seed.y)r+up_diffr and
- * src(seed.x,seed.y)g-lo_diffg<=src(x,y)g<=src(seed.x,seed.y)g+up_diffg and
- * src(seed.x,seed.y)b-lo_diffb<=src(x,y)b<=src(seed.x,seed.y)b+up_diffb, color image, fixed range
- *
- * where src(x',y') is value of one of pixel neighbors.
- * That is, to be added to the connected component, a pixel's color/brightness should be close enough to:
- * * color/brightness of one of its neighbors that are already referred to the connected component in case of floating range
- * * color/brightness of the seed point in case of fixed range.
- *
- * arguments
- * * seed_point -The starting point.
- * * new_val - New value of repainted domain pixels.
- * * lo_diff - Maximal lower brightness/color difference between the currently observed pixel and one of its neighbor belong to the component or seed pixel to add the pixel to component. In case of 8-bit color images it is packed value.
- * * up_diff - Maximal upper brightness/color difference between the currently observed pixel and one of its neighbor belong to the component or seed pixel to add the pixel to component. In case of 8-bit color images it is packed value.
- *
- * and flood_fill_option
- * :connectivity => 4 or 8, 4 default
- * Connectivity determines which neighbors of a pixel are considered.
- * :fixed_range => true or false, false default
- * If set the difference between the current pixel and seed pixel is considered, otherwise difference between neighbor pixels is considered (the range is floating).
- * :mask_only => true or false, false default
+ * @overload flood_fill(seed_point, new_val, lo_diff = CvScalar.new(0), up_diff = CvScalar.new(0), flood_fill_option = nil)
+ * @param seed_point [CvPoint] Starting point.
+ * @param new_val [CvScalar] New value of the repainted domain pixels.
+ * @param lo_diff [CvScalar] Maximal lower brightness/color difference between the currently observed pixel
+ * and one of its neighbor belong to the component or seed pixel to add the pixel to component.
+ * In case of 8-bit color images it is packed value.
+ * @param up_diff [CvScalar] Maximal upper brightness/color difference between the currently observed pixel and
+ * one of its neighbor belong to the component or seed pixel to add the pixel to component.
+ * In case of 8-bit color images it is packed value.
+ * @param flood_fill_option [Hash]
+ * @option flood_fill_option [Integer] :connectivity (4)
+ * Connectivity determines which neighbors of a pixel are considered (4 or 8).
+ * @option flood_fill_option [Boolean] :fixed_range (false)
+ * If set the difference between the current pixel and seed pixel is considered, otherwise difference between
+ * neighbor pixels is considered (the range is floating).
+ * @option flood_fill_option [Boolean] :mask_only (false)
* If set, the function does not fill the image(new_val is ignored), but the fills mask.
- *
- * note: flood_fill_option's default value is CvMat::FLOOD_FILL_OPTION.
+ * @return [Array] Array of output image, connected component and mask.
+ * @opencv_func cvFloodFill
*/
VALUE
rb_flood_fill(int argc, VALUE *argv, VALUE self)
@@ -4589,11 +4623,12 @@ rb_flood_fill(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * flood_fill!(seed_point, new_val, lo_diff, up_diff[,flood_fill_option]) -> [self, cvconnectedcomp, iplimage(mask)]
+ * Fills a connected component with the given color.
*
- * Fills a connected component with given color.
- * see CvMat#flood_fill
+ * @overload flood_fill!(seed_point, new_val, lo_diff = CvScalar.new(0), up_diff = CvScalar.new(0), flood_fill_option = nil)
+ * @param (see #flood_fill)
+ * @return (see #flood_fill)
+ * @opencv_func (see #flood_fill)
*/
VALUE
rb_flood_fill_bang(int argc, VALUE *argv, VALUE self)
@@ -4633,39 +4668,26 @@ rb_flood_fill_bang(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * find_contours([find_contours_options]) -> cvchain or cvcontour or nil
+ * Finds contours in binary image.
*
- * Finds contours in binary image, and return contours as CvContour or CvChain.
- * If contours not found, return nil.
- *
- * flood_fill_option should be Hash include these keys.
- * :mode - Retrieval mode.
- * :external - retrive only the extreme outer contours
- * :list - retrieve all the contours and puts them in the list.(default)
- * :ccomp - retrieve all the contours and organizes them into two-level hierarchy:
- * top level are external boundaries of the components, second level are bounda boundaries of the holes
- * :tree - retrieve all the contours and reconstructs the full hierarchy of nested contours
- * Connectivity determines which neighbors of a pixel are considered.
- * :method - Approximation method.
- * :code - output contours in the Freeman chain code. All other methods output polygons (sequences of vertices).
- * :approx_none - translate all the points from the chain code into points;
- * :approx_simple - compress horizontal, vertical, and diagonal segments, that is, the function leaves only their ending points;(default)
- * :approx_tc89_l1
- * :approx_tc89_kcos - apply one of the flavors of Teh-Chin chain approximation algorithm.
- * If set the difference between the current pixel and seed pixel is considered,
- * otherwise difference between neighbor pixels is considered (the range is floating).
- * :offset - Offset, by which every contour point is shifted.
- * This is useful if the contours are extracted from the image ROI
- * and then they should be analyzed in the whole image context. Should be CvPoint.
- *
- * note: find_contours_option's default value is CvMat::FIND_CONTOURS_OPTION.
- *
- * support single-channel 8bit unsigned image only.
- *
- * note: Non-zero pixels are treated as 1's, zero pixels remain 0's
- * that is image treated as binary. To get such a binary image from grayscale,
- * one may use threshold, adaptive_threshold or canny.
+ * @overload find_contours(find_contours_options)
+ * @param find_contours_options [Hash] Options
+ * @option find_contours_options [Symbol] :mode (:list) Retrieval mode.
+ * * :external - retrive only the extreme outer contours
+ * * :list - retrieve all the contours and puts them in the list.
+ * * :ccomp - retrieve all the contours and organizes them into two-level hierarchy:
+ * top level are external boundaries of the components, second level are bounda boundaries of the holes
+ * * :tree - retrieve all the contours and reconstructs the full hierarchy of nested contours
+ * Connectivity determines which neighbors of a pixel are considered.
+ * @option find_contours_options [Symbol] :method (:approx_simple) Approximation method.
+ * * :code - output contours in the Freeman chain code. All other methods output polygons (sequences of vertices).
+ * * :approx_none - translate all the points from the chain code into points;
+ * * :approx_simple - compress horizontal, vertical, and diagonal segments, that is, the function leaves only their ending points;
+ * * :approx_tc89_l1, :approx_tc89_kcos - apply one of the flavors of Teh-Chin chain approximation algorithm.
+ * @option find_contours_options [CvPoint] :offset (CvPoint.new(0, 0)) Offset, by which every contour point is shifted.
+ * @return [CvContour, CvChain] Detected contours. If :method is :code,
+ * returns as CvChain, otherwise CvContour.
+ * @opencv_func cvFindContours
*/
VALUE
rb_find_contours(int argc, VALUE *argv, VALUE self)
@@ -4674,16 +4696,12 @@ rb_find_contours(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * find_contours!([find_contours_options]) -> cvchain or chcontour or nil
- *
* Finds contours in binary image.
- * The function modifies the source image content.
- * (Because the copy is not made, it is slightly faster than find_contours.)
*
- * see find_contours
- *
- * support single-channel 8bit unsigned image only.
+ * @overload find_contours!(find_contours_options)
+ * @param (see #find_contours)
+ * @return (see #find_contours)
+ * @opencv_func (see #find_contours)
*/
VALUE
rb_find_contours_bang(int argc, VALUE *argv, VALUE self)
@@ -4870,10 +4888,12 @@ rb_pyr_mean_shift_filtering(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * watershed -> cvmat(mean markers:cv32s)
+ * Performs a marker-based image segmentation using the watershed algorithm.
*
- * Does watershed segmentation.
+ * @overload watershed(markers)
+ * @param markers [CvMat] Input 32-bit single-channel image of markers. It should have the same size as self
+ * @return [CvMat] Output image
+ * @opencv_func cvWatershed
*/
VALUE
rb_watershed(VALUE self, VALUE markers)
@@ -4910,31 +4930,31 @@ rb_moments(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * hough_lines(method, rho, theta, threshold, param1, param2) -> cvseq(include CvLine or CvTwoPoints)
- *
* Finds lines in binary image using a Hough transform.
- * * method –
-
- * * The Hough transform variant, one of the following:
- * * - CV_HOUGH_STANDARD - classical or standard Hough transform.
- * * - CV_HOUGH_PROBABILISTIC - probabilistic Hough transform (more efficient in case if picture contains a few long linear segments).
- * * - CV_HOUGH_MULTI_SCALE - multi-scale variant of the classical Hough transform. The lines are encoded the same way as CV_HOUGH_STANDARD.
- * * rho - Distance resolution in pixel-related units.
- * * theta - Angle resolution measured in radians.
- * * threshold - Threshold parameter. A line is returned by the function if the corresponding accumulator value is greater than threshold.
- * * param1 –
-
- * * The first method-dependent parameter:
- * * For the classical Hough transform it is not used (0).
- * * For the probabilistic Hough transform it is the minimum line length.
- * * For the multi-scale Hough transform it is the divisor for the distance resolution . (The coarse distance resolution will be rho and the accurate resolution will be (rho / param1)).
- * * param2 –
-
- * * The second method-dependent parameter:
- * * For the classical Hough transform it is not used (0).
- * * For the probabilistic Hough transform it is the maximum gap between line segments lying on the same line to treat them as a single line segment (i.e. to join them).
- * * For the multi-scale Hough transform it is the divisor for the angle resolution. (The coarse angle resolution will be theta and the accurate resolution will be (theta / param2).)
+ *
+ * @overload hough_lines(method, rho, theta, threshold, param1, param2)
+ * @param method [Integer] The Hough transform variant, one of the following:
+ * * CV_HOUGH_STANDARD - classical or standard Hough transform.
+ * * CV_HOUGH_PROBABILISTIC - probabilistic Hough transform (more efficient in case if picture contains a few long linear segments).
+ * * CV_HOUGH_MULTI_SCALE - multi-scale variant of the classical Hough transform. The lines are encoded the same way as CV_HOUGH_STANDARD.
+ * @param rho [Number] Distance resolution in pixel-related units.
+ * @param theta [Number] Angle resolution measured in radians.
+ * @param threshold [Number] Threshold parameter. A line is returned by the function if the corresponding
+ * accumulator value is greater than threshold.
+ * @param param1 [Number] The first method-dependent parameter:
+ * * For the classical Hough transform it is not used (0).
+ * * For the probabilistic Hough transform it is the minimum line length.
+ * * For the multi-scale Hough transform it is the divisor for the distance resolution.
+ * (The coarse distance resolution will be rho and the accurate resolution will be (rho / param1)).
+ * @param param2 [Number] The second method-dependent parameter:
+ * * For the classical Hough transform it is not used (0).
+ * * For the probabilistic Hough transform it is the maximum gap between line segments lying
+ * on the same line to treat them as a single line segment (i.e. to join them).
+ * * For the multi-scale Hough transform it is the divisor for the angle resolution.
+ * (The coarse angle resolution will be theta and the accurate resolution will be (theta / param2).)
+ * @return [CvSeq] Output lines. If method is CV_HOUGH_STANDARD or CV_HOUGH_MULTI_SCALE,
+ * the class of elements is CvLine, otherwise CvTwoPoints.
+ * @opencv_func cvHoughLines2
*/
VALUE
rb_hough_lines(int argc, VALUE *argv, VALUE self)
@@ -4971,10 +4991,24 @@ rb_hough_lines(int argc, VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * hough_circles(method, dp, min_dist, param1, param2, min_radius = 0, max_radius = max(width,height)) -> cvseq(include CvCircle32f)
+ * Finds circles in a grayscale image using the Hough transform.
*
- * Finds circles in grayscale image using Hough transform.
+ * @overload hough_circles(method, dp, min_dist, param1, param2, min_radius = 0, max_radius = 0)
+ * @param method [Integer] Detection method to use. Currently, the only implemented method is CV_HOUGH_GRADIENT.
+ * @param dp [Number] Inverse ratio of the accumulator resolution to the image resolution.
+ * For example, if dp=1, the accumulator has the same resolution as the input image.
+ * If dp=2, the accumulator has half as big width and height.
+ * @param min_dist [Number] Minimum distance between the centers of the detected circles.
+ * If the parameter is too small, multiple neighbor circles may be falsely detected
+ * in addition to a true one. If it is too large, some circles may be missed.
+ * @param param1 [Number] First method-specific parameter. In case of CV_HOUGH_GRADIENT,
+ * it is the higher threshold of the two passed to the #canny detector (the lower one is twice smaller).
+ * @param param2 [Number] Second method-specific parameter. In case of CV_HOUGH_GRADIENT,
+ * it is the accumulator threshold for the circle centers at the detection stage. The smaller it is,
+ * the more false circles may be detected. Circles, corresponding to the larger accumulator values,
+ * will be returned first.
+ * @return [CvSeq] Output circles.
+ * @opencv_func cvHoughCircles
*/
VALUE
rb_hough_circles(int argc, VALUE *argv, VALUE self)
@@ -5087,31 +5121,21 @@ rb_apply_color_map(VALUE self, VALUE colormap)
}
/*
- * call-seq:
- * match_template(template[,method = :sqdiff]) -> cvmat(result)
- *
* Compares template against overlapped image regions.
-
- * method is specifies the way the template must be compared with image regions.
- * method should be following symbol. (see OpenCV::MATCH_TEMPLATE_METHOD 's key and value.)
*
- * * :sqdiff
- * R(x,y)=sumx',y'[T(x',y')-I(x+x',y+y')]2
- * * :sqdiff_normed
- * R(x,y)=sumx',y'[T(x',y')-I(x+x',y+y')]2/sqrt[sumx',y'T(x',y')2*sumx',y'I(x+x',y+y')2]
- * * :ccorr
- * R(x,y)=sumx',y'[T(x',y')*I(x+x',y+y')]
- * * :ccorr_normed
- * R(x,y)=sumx',y'[T(x',y')*I(x+x',y+y')]/sqrt[sumx',y'T(x',y')2*sumx',y'I(x+x',y+y')2]
- * * :ccoeff
- * R(x,y)=sumx',y'[T'(x',y')*I'(x+x',y+y')],
- * where T'(x',y')=T(x',y') - 1/(w*h)*sumx",y"T(x",y")
- * I'(x+x',y+y')=I(x+x',y+y') - 1/(w*h)*sumx",y"I(x+x",y+y")
- * * :ccoeff_normed
- * R(x,y)=sumx',y'[T'(x',y')*I'(x+x',y+y')]/sqrt[sumx',y'T'(x',y')2*sumx',y'I'(x+x',y+y')2]
+ * @overload match_template(template, method = CV_TM_SQDIFF)
+ * @param template [CvMat] Searched template. It must be not greater than the source image and have the same data type.
+ * @param method [Integer] Parameter specifying the comparison method.
+ * * CV_TM_SQDIFF
+ * * CV_TM_SQDIFF_NORMED
+ * * CV_TM_CCORR
+ * * CV_TM_CCORR_NORMED
+ * * CV_TM_CCOEFF
+ * * CV_TM_CCOEFF_NORMED
+ * @opencv_func cvMatchTemplate
*
* After the match_template finishes comparison, the best matches can be found as global
- * minimums (:sqdiff*) or maximums(:ccorr* or :ccoeff*) using minmax function.
+ * minimums (CV_TM_SQDIFF) or maximums(CV_TM_CCORR or CV_TM_CCOEFF) using CvMat#min_max_loc.
* In case of color image and template summation in both numerator and each sum in denominator
* is done over all the channels (and separate mean values are used for each channel).
*/
@@ -5645,12 +5669,14 @@ rb_compute_correspond_epilines(VALUE klass, VALUE points, VALUE which_image, VAL
}
/*
- * call-seq:
- * extract_surf(params[,mask]) -> [cvseq(cvsurfpoint), array(float)]
* Extracts Speeded Up Robust Features from an image
*
- * params (CvSURFParams) - Various algorithm parameters put to the structure CvSURFParams.
- * mask (CvMat) - The optional input 8-bit mask. The features are only found in the areas that contain more than 50% of non-zero mask pixels.
+ * @overload extract_surf(params, mask = nil) -> [cvseq(cvsurfpoint), array(float)]
+ * @param params [CvSURFParams] Various algorithm parameters put to the structure CvSURFParams.
+ * @param mask [CvMat] The optional input 8-bit mask. The features are only found
+ * in the areas that contain more than 50% of non-zero mask pixels.
+ * @return [Array, Array>] Output vector of keypoints and descriptors.
+ * @opencv_func cvExtractSURF
*/
VALUE
rb_extract_surf(int argc, VALUE *argv, VALUE self)
diff --git a/ext/opencv/cvmemstorage.cpp b/ext/opencv/cvmemstorage.cpp
index 0d5f84e..79c0afa 100644
--- a/ext/opencv/cvmemstorage.cpp
+++ b/ext/opencv/cvmemstorage.cpp
@@ -24,20 +24,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvMemStorage", rb_cObject);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -63,6 +49,25 @@ new_object(int blocksize)
return Data_Wrap_Struct(rb_klass, 0, cvmemstorage_free, storage);
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvMemStorage", rb_cObject);
+}
__NAMESPACE_END_CVMEMSTORAGE
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvmoments.cpp b/ext/opencv/cvmoments.cpp
index c8e3564..8618bd5 100644
--- a/ext/opencv/cvmoments.cpp
+++ b/ext/opencv/cvmoments.cpp
@@ -30,50 +30,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvMoments", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "spatial", RUBY_METHOD_FUNC(rb_spatial), 2);
- rb_define_method(rb_klass, "central", RUBY_METHOD_FUNC(rb_central), 2);
- rb_define_method(rb_klass, "normalized_central", RUBY_METHOD_FUNC(rb_normalized_central), 2);
- rb_define_method(rb_klass, "hu", RUBY_METHOD_FUNC(rb_hu), 0);
- rb_define_method(rb_klass, "gravity_center", RUBY_METHOD_FUNC(rb_gravity_center), 0);
- rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
-
- DEFINE_CVMOMENTS_ACCESSOR(m00);
- DEFINE_CVMOMENTS_ACCESSOR(m10);
- DEFINE_CVMOMENTS_ACCESSOR(m01);
- DEFINE_CVMOMENTS_ACCESSOR(m20);
- DEFINE_CVMOMENTS_ACCESSOR(m11);
- DEFINE_CVMOMENTS_ACCESSOR(m02);
- DEFINE_CVMOMENTS_ACCESSOR(m30);
- DEFINE_CVMOMENTS_ACCESSOR(m21);
- DEFINE_CVMOMENTS_ACCESSOR(m12);
- DEFINE_CVMOMENTS_ACCESSOR(m03);
-
- DEFINE_CVMOMENTS_ACCESSOR(mu20);
- DEFINE_CVMOMENTS_ACCESSOR(mu11);
- DEFINE_CVMOMENTS_ACCESSOR(mu02);
- DEFINE_CVMOMENTS_ACCESSOR(mu30);
- DEFINE_CVMOMENTS_ACCESSOR(mu21);
- DEFINE_CVMOMENTS_ACCESSOR(mu12);
- DEFINE_CVMOMENTS_ACCESSOR(mu03);
-
- DEFINE_CVMOMENTS_ACCESSOR(inv_sqrt_m00);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -283,5 +239,55 @@ new_object(CvArr *arr, int is_binary = 0)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvMoments", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "spatial", RUBY_METHOD_FUNC(rb_spatial), 2);
+ rb_define_method(rb_klass, "central", RUBY_METHOD_FUNC(rb_central), 2);
+ rb_define_method(rb_klass, "normalized_central", RUBY_METHOD_FUNC(rb_normalized_central), 2);
+ rb_define_method(rb_klass, "hu", RUBY_METHOD_FUNC(rb_hu), 0);
+ rb_define_method(rb_klass, "gravity_center", RUBY_METHOD_FUNC(rb_gravity_center), 0);
+ rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
+
+ DEFINE_CVMOMENTS_ACCESSOR(m00);
+ DEFINE_CVMOMENTS_ACCESSOR(m10);
+ DEFINE_CVMOMENTS_ACCESSOR(m01);
+ DEFINE_CVMOMENTS_ACCESSOR(m20);
+ DEFINE_CVMOMENTS_ACCESSOR(m11);
+ DEFINE_CVMOMENTS_ACCESSOR(m02);
+ DEFINE_CVMOMENTS_ACCESSOR(m30);
+ DEFINE_CVMOMENTS_ACCESSOR(m21);
+ DEFINE_CVMOMENTS_ACCESSOR(m12);
+ DEFINE_CVMOMENTS_ACCESSOR(m03);
+
+ DEFINE_CVMOMENTS_ACCESSOR(mu20);
+ DEFINE_CVMOMENTS_ACCESSOR(mu11);
+ DEFINE_CVMOMENTS_ACCESSOR(mu02);
+ DEFINE_CVMOMENTS_ACCESSOR(mu30);
+ DEFINE_CVMOMENTS_ACCESSOR(mu21);
+ DEFINE_CVMOMENTS_ACCESSOR(mu12);
+ DEFINE_CVMOMENTS_ACCESSOR(mu03);
+
+ DEFINE_CVMOMENTS_ACCESSOR(inv_sqrt_m00);
+}
+
__NAMESPACE_END_CVMOMENTS
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvpoint.cpp b/ext/opencv/cvpoint.cpp
index 47f3e75..99fe431 100644
--- a/ext/opencv/cvpoint.cpp
+++ b/ext/opencv/cvpoint.cpp
@@ -201,6 +201,11 @@ new_object(CvPoint point)
void
init_ruby_class()
{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
if (rb_klass)
return;
/*
diff --git a/ext/opencv/cvpoint2d32f.cpp b/ext/opencv/cvpoint2d32f.cpp
index 8b31743..836e6ad 100644
--- a/ext/opencv/cvpoint2d32f.cpp
+++ b/ext/opencv/cvpoint2d32f.cpp
@@ -31,32 +31,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
- rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
- rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
- rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
-
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
- rb_define_alias(rb_klass, "to_a", "to_ary");
-}
-
/*
* call-seq:
* combatible?(obj)
@@ -207,5 +181,36 @@ new_object(CvPoint2D32f point)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
+
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
+ rb_define_alias(rb_klass, "to_a", "to_ary");
+}
+
__NAMESPACE_END_CVPOINT2D32F
__NAMESPACE_END_OPENCV
diff --git a/ext/opencv/cvpoint3d32f.cpp b/ext/opencv/cvpoint3d32f.cpp
index 0011be7..5a3f646 100644
--- a/ext/opencv/cvpoint3d32f.cpp
+++ b/ext/opencv/cvpoint3d32f.cpp
@@ -32,35 +32,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- * cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- VALUE cvpoint2d32f = cCvPoint2D32f::rb_class();
- rb_klass = rb_define_class_under(opencv, "CvPoint3D32f", cvpoint2d32f);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
- rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
- rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
- rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
- rb_define_method(rb_klass, "z", RUBY_METHOD_FUNC(rb_z), 0);
- rb_define_method(rb_klass, "z=", RUBY_METHOD_FUNC(rb_set_z), 1);
-
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
- rb_define_alias(rb_klass, "to_a", "to_ary");
-}
-
/*
* call-seq:
* combatible?(obj)
@@ -241,5 +212,41 @@ new_object(CvPoint3D32f point)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ * cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ VALUE cvpoint2d32f = cCvPoint2D32f::rb_class();
+ rb_klass = rb_define_class_under(opencv, "CvPoint3D32f", cvpoint2d32f);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
+ rb_define_method(rb_klass, "z", RUBY_METHOD_FUNC(rb_z), 0);
+ rb_define_method(rb_klass, "z=", RUBY_METHOD_FUNC(rb_set_z), 1);
+
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
+ rb_define_alias(rb_klass, "to_a", "to_ary");
+}
+
__NAMESPACE_END_CVPOINT3D32F
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvrect.cpp b/ext/opencv/cvrect.cpp
index c98af85..47846b0 100644
--- a/ext/opencv/cvrect.cpp
+++ b/ext/opencv/cvrect.cpp
@@ -34,39 +34,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvRect", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
- rb_define_singleton_method(rb_klass, "max_rect", RUBY_METHOD_FUNC(rb_max_rect), 2);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
-
- rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
- rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
- rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
- rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
- rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
- rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
- rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
- rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
- rb_define_method(rb_klass, "center", RUBY_METHOD_FUNC(rb_center), 0);
- rb_define_method(rb_klass, "points", RUBY_METHOD_FUNC(rb_points), 0);
- rb_define_method(rb_klass, "top_left", RUBY_METHOD_FUNC(rb_top_left), 0);
- rb_define_method(rb_klass, "top_right", RUBY_METHOD_FUNC(rb_top_right), 0);
- rb_define_method(rb_klass, "bottom_left", RUBY_METHOD_FUNC(rb_bottom_left), 0);
- rb_define_method(rb_klass, "bottom_right", RUBY_METHOD_FUNC(rb_bottom_right), 0);
-}
-
/*
* call-seq:
* combatible?(obj)
@@ -329,5 +296,43 @@ new_object(CvRect rect)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvRect", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
+ rb_define_singleton_method(rb_klass, "max_rect", RUBY_METHOD_FUNC(rb_max_rect), 2);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
+ rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
+ rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
+ rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
+ rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
+ rb_define_method(rb_klass, "center", RUBY_METHOD_FUNC(rb_center), 0);
+ rb_define_method(rb_klass, "points", RUBY_METHOD_FUNC(rb_points), 0);
+ rb_define_method(rb_klass, "top_left", RUBY_METHOD_FUNC(rb_top_left), 0);
+ rb_define_method(rb_klass, "top_right", RUBY_METHOD_FUNC(rb_top_right), 0);
+ rb_define_method(rb_klass, "bottom_left", RUBY_METHOD_FUNC(rb_bottom_left), 0);
+ rb_define_method(rb_klass, "bottom_right", RUBY_METHOD_FUNC(rb_bottom_right), 0);
+}
+
__NAMESPACE_END_CVRECT
__NAMESPACE_END_OPENCV
diff --git a/ext/opencv/cvscalar.cpp b/ext/opencv/cvscalar.cpp
index da1f9a3..d9c9e41 100644
--- a/ext/opencv/cvscalar.cpp
+++ b/ext/opencv/cvscalar.cpp
@@ -42,50 +42,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvScalar", rb_cObject);
- /* CvScalar: class */
- rb_define_const(opencv, "CvColor", rb_klass);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
- rb_define_method(rb_klass, "[]=", RUBY_METHOD_FUNC(rb_aset), 2);
- rb_define_method(rb_klass, "sub", RUBY_METHOD_FUNC(rb_sub), -1);
- rb_define_alias(rb_klass, "-", "sub");
-
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
- rb_define_alias(rb_klass, "to_a", "to_ary");
-
- rb_define_const(rb_klass, "Black", cCvScalar::new_object(cvScalar(0x0,0x0,0x0)));
- rb_define_const(rb_klass, "Silver", cCvScalar::new_object(cvScalar(0x0c,0x0c,0x0c)));
- rb_define_const(rb_klass, "Gray", cCvScalar::new_object(cvScalar(0x80,0x80,0x80)));
- rb_define_const(rb_klass, "White", cCvScalar::new_object(cvScalar(0xff,0xff,0xff)));
- rb_define_const(rb_klass, "Maroon", cCvScalar::new_object(cvScalar(0x0,0x0,0x80)));
- rb_define_const(rb_klass, "Red", cCvScalar::new_object(cvScalar(0x0,0x0,0xff)));
- rb_define_const(rb_klass, "Purple", cCvScalar::new_object(cvScalar(0x80,0x0,0x80)));
- rb_define_const(rb_klass, "Fuchsia", cCvScalar::new_object(cvScalar(0xff,0x0,0xff)));
- rb_define_const(rb_klass, "Green", cCvScalar::new_object(cvScalar(0x0,0x80,0x0)));
- rb_define_const(rb_klass, "Lime", cCvScalar::new_object(cvScalar(0x0,0xff,0x0)));
- rb_define_const(rb_klass, "Olive", cCvScalar::new_object(cvScalar(0x0,0x80,0x80)));
- rb_define_const(rb_klass, "Yellow", cCvScalar::new_object(cvScalar(0x0,0xff,0xff)));
- rb_define_const(rb_klass, "Navy", cCvScalar::new_object(cvScalar(0x80,0x0,0x0)));
- rb_define_const(rb_klass, "Blue", cCvScalar::new_object(cvScalar(0xff,0x0,0x0)));
- rb_define_const(rb_klass, "Teal", cCvScalar::new_object(cvScalar(0x80,0x80,0x0)));
- rb_define_const(rb_klass, "Aqua", cCvScalar::new_object(cvScalar(0xff,0xff,0x0)));
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -231,6 +187,55 @@ new_object(CvScalar scalar)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvScalar", rb_cObject);
+ /* CvScalar: class */
+ rb_define_const(opencv, "CvColor", rb_klass);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
+ rb_define_method(rb_klass, "[]=", RUBY_METHOD_FUNC(rb_aset), 2);
+ rb_define_method(rb_klass, "sub", RUBY_METHOD_FUNC(rb_sub), -1);
+ rb_define_alias(rb_klass, "-", "sub");
+
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
+ rb_define_alias(rb_klass, "to_a", "to_ary");
+
+ rb_define_const(rb_klass, "Black", cCvScalar::new_object(cvScalar(0x0,0x0,0x0)));
+ rb_define_const(rb_klass, "Silver", cCvScalar::new_object(cvScalar(0x0c,0x0c,0x0c)));
+ rb_define_const(rb_klass, "Gray", cCvScalar::new_object(cvScalar(0x80,0x80,0x80)));
+ rb_define_const(rb_klass, "White", cCvScalar::new_object(cvScalar(0xff,0xff,0xff)));
+ rb_define_const(rb_klass, "Maroon", cCvScalar::new_object(cvScalar(0x0,0x0,0x80)));
+ rb_define_const(rb_klass, "Red", cCvScalar::new_object(cvScalar(0x0,0x0,0xff)));
+ rb_define_const(rb_klass, "Purple", cCvScalar::new_object(cvScalar(0x80,0x0,0x80)));
+ rb_define_const(rb_klass, "Fuchsia", cCvScalar::new_object(cvScalar(0xff,0x0,0xff)));
+ rb_define_const(rb_klass, "Green", cCvScalar::new_object(cvScalar(0x0,0x80,0x0)));
+ rb_define_const(rb_klass, "Lime", cCvScalar::new_object(cvScalar(0x0,0xff,0x0)));
+ rb_define_const(rb_klass, "Olive", cCvScalar::new_object(cvScalar(0x0,0x80,0x80)));
+ rb_define_const(rb_klass, "Yellow", cCvScalar::new_object(cvScalar(0x0,0xff,0xff)));
+ rb_define_const(rb_klass, "Navy", cCvScalar::new_object(cvScalar(0x80,0x0,0x0)));
+ rb_define_const(rb_klass, "Blue", cCvScalar::new_object(cvScalar(0xff,0x0,0x0)));
+ rb_define_const(rb_klass, "Teal", cCvScalar::new_object(cvScalar(0x80,0x80,0x0)));
+ rb_define_const(rb_klass, "Aqua", cCvScalar::new_object(cvScalar(0xff,0xff,0x0)));
+}
+
__NAMESPACE_END_CVSCALAR
__NAMESPACE_END_OPENCV
diff --git a/ext/opencv/cvseq.cpp b/ext/opencv/cvseq.cpp
index 51c7891..7b2ec50 100644
--- a/ext/opencv/cvseq.cpp
+++ b/ext/opencv/cvseq.cpp
@@ -73,49 +73,6 @@ unregister_elem_class(void *ptr)
}
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvSeq", rb_cObject);
- rb_include_module(rb_klass, rb_mEnumerable);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "total", RUBY_METHOD_FUNC(rb_total), 0);
- rb_define_alias(rb_klass, "length", "total");
- rb_define_alias(rb_klass, "size", "total");
- rb_define_method(rb_klass, "empty?", RUBY_METHOD_FUNC(rb_empty_q), 0);
- rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
- rb_define_method(rb_klass, "first", RUBY_METHOD_FUNC(rb_first), 0);
- rb_define_method(rb_klass, "last", RUBY_METHOD_FUNC(rb_last), 0);
-
- rb_define_method(rb_klass, "h_prev", RUBY_METHOD_FUNC(rb_h_prev), 0);
- rb_define_method(rb_klass, "h_next", RUBY_METHOD_FUNC(rb_h_next), 0);
- rb_define_method(rb_klass, "v_prev", RUBY_METHOD_FUNC(rb_v_prev), 0);
- rb_define_method(rb_klass, "v_next", RUBY_METHOD_FUNC(rb_v_next), 0);
-
- rb_define_method(rb_klass, "push", RUBY_METHOD_FUNC(rb_push), -2);
- rb_define_alias(rb_klass, "<<", "push");
- rb_define_method(rb_klass, "pop", RUBY_METHOD_FUNC(rb_pop), 0);
- rb_define_method(rb_klass, "unshift", RUBY_METHOD_FUNC(rb_unshift), -2);
- rb_define_alias(rb_klass, "push_front", "unshift");
- rb_define_method(rb_klass, "shift", RUBY_METHOD_FUNC(rb_shift), 0);
- rb_define_alias(rb_klass, "pop_front", "shift");
- rb_define_method(rb_klass, "each", RUBY_METHOD_FUNC(rb_each), 0);
- rb_define_method(rb_klass, "each_index", RUBY_METHOD_FUNC(rb_each_index), 0);
- rb_define_method(rb_klass, "insert", RUBY_METHOD_FUNC(rb_insert), 2);
- rb_define_method(rb_klass, "remove", RUBY_METHOD_FUNC(rb_remove), 1);
- rb_define_alias(rb_klass, "delete_at", "remove");
- rb_define_method(rb_klass, "clear", RUBY_METHOD_FUNC(rb_clear), 0);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -595,5 +552,54 @@ new_sequence(VALUE klass, CvSeq *seq, VALUE element_klass, VALUE storage)
return Data_Wrap_Struct(klass, mark_root_object, unregister_elem_class, seq);
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvSeq", rb_cObject);
+ rb_include_module(rb_klass, rb_mEnumerable);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "total", RUBY_METHOD_FUNC(rb_total), 0);
+ rb_define_alias(rb_klass, "length", "total");
+ rb_define_alias(rb_klass, "size", "total");
+ rb_define_method(rb_klass, "empty?", RUBY_METHOD_FUNC(rb_empty_q), 0);
+ rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
+ rb_define_method(rb_klass, "first", RUBY_METHOD_FUNC(rb_first), 0);
+ rb_define_method(rb_klass, "last", RUBY_METHOD_FUNC(rb_last), 0);
+
+ rb_define_method(rb_klass, "h_prev", RUBY_METHOD_FUNC(rb_h_prev), 0);
+ rb_define_method(rb_klass, "h_next", RUBY_METHOD_FUNC(rb_h_next), 0);
+ rb_define_method(rb_klass, "v_prev", RUBY_METHOD_FUNC(rb_v_prev), 0);
+ rb_define_method(rb_klass, "v_next", RUBY_METHOD_FUNC(rb_v_next), 0);
+
+ rb_define_method(rb_klass, "push", RUBY_METHOD_FUNC(rb_push), -2);
+ rb_define_alias(rb_klass, "<<", "push");
+ rb_define_method(rb_klass, "pop", RUBY_METHOD_FUNC(rb_pop), 0);
+ rb_define_method(rb_klass, "unshift", RUBY_METHOD_FUNC(rb_unshift), -2);
+ rb_define_alias(rb_klass, "push_front", "unshift");
+ rb_define_method(rb_klass, "shift", RUBY_METHOD_FUNC(rb_shift), 0);
+ rb_define_alias(rb_klass, "pop_front", "shift");
+ rb_define_method(rb_klass, "each", RUBY_METHOD_FUNC(rb_each), 0);
+ rb_define_method(rb_klass, "each_index", RUBY_METHOD_FUNC(rb_each_index), 0);
+ rb_define_method(rb_klass, "insert", RUBY_METHOD_FUNC(rb_insert), 2);
+ rb_define_method(rb_klass, "remove", RUBY_METHOD_FUNC(rb_remove), 1);
+ rb_define_alias(rb_klass, "delete_at", "remove");
+ rb_define_method(rb_klass, "clear", RUBY_METHOD_FUNC(rb_clear), 0);
+}
+
__NAMESPACE_END_CVSEQ
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvsize.cpp b/ext/opencv/cvsize.cpp
index 8482335..bf88a77 100644
--- a/ext/opencv/cvsize.cpp
+++ b/ext/opencv/cvsize.cpp
@@ -31,32 +31,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvSize", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
- rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
- rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
- rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
-
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
- rb_define_alias(rb_klass, "to_a", "to_ary");
-}
-
/*
* call-seq:
* compatible?(obj)
@@ -217,5 +191,37 @@ new_object(CvSize size)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvSize", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
+ rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
+ rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
+ rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
+
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
+ rb_define_alias(rb_klass, "to_a", "to_ary");
+}
+
__NAMESPACE_END_CVSIZE
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvsize2d32f.cpp b/ext/opencv/cvsize2d32f.cpp
index c6219b7..5b7a327 100644
--- a/ext/opencv/cvsize2d32f.cpp
+++ b/ext/opencv/cvsize2d32f.cpp
@@ -31,31 +31,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvSize2D32f", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
- rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
- rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
- rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
- rb_define_alias(rb_klass, "to_a", "to_ary");
-}
-
/*
* call-seq:
* compatible?(obj)
@@ -205,5 +180,36 @@ new_object(CvSize2D32f size)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvSize2D32f", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
+ rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
+ rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
+ rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
+ rb_define_alias(rb_klass, "to_a", "to_ary");
+}
+
__NAMESPACE_END_CVSIZE2D32F
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvslice.cpp b/ext/opencv/cvslice.cpp
index 39cfc40..69d19b8 100644
--- a/ext/opencv/cvslice.cpp
+++ b/ext/opencv/cvslice.cpp
@@ -9,7 +9,7 @@
************************************************************/
#include "cvslice.h"
/*
- * Document-class: OpenCV::CvClice
+ * Document-class: OpenCV::CvSlice
*
* C structure is here, very simple.
* typdef struct CvSlice {
@@ -28,26 +28,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvSlice", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), 2);
- rb_define_method(rb_klass, "start_index", RUBY_METHOD_FUNC(rb_start_index_aref), 0);
- rb_define_method(rb_klass, "end_index", RUBY_METHOD_FUNC(rb_end_index_aref), 0);
- rb_define_method(rb_klass, "start_index=", RUBY_METHOD_FUNC(rb_start_index_aset), 1);
- rb_define_method(rb_klass, "end_index=", RUBY_METHOD_FUNC(rb_end_index_aset), 1);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -116,5 +96,31 @@ rb_end_index_aset(VALUE self, VALUE index)
return self;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvSlice", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), 2);
+ rb_define_method(rb_klass, "start_index", RUBY_METHOD_FUNC(rb_start_index_aref), 0);
+ rb_define_method(rb_klass, "end_index", RUBY_METHOD_FUNC(rb_end_index_aref), 0);
+ rb_define_method(rb_klass, "start_index=", RUBY_METHOD_FUNC(rb_start_index_aset), 1);
+ rb_define_method(rb_klass, "end_index=", RUBY_METHOD_FUNC(rb_end_index_aset), 1);
+}
+
__NAMESPACE_END_CVSLICE
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvsurfparams.cpp b/ext/opencv/cvsurfparams.cpp
index 9635127..3101789 100644
--- a/ext/opencv/cvsurfparams.cpp
+++ b/ext/opencv/cvsurfparams.cpp
@@ -30,30 +30,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvSURFParams", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "hessian_threshold", RUBY_METHOD_FUNC(rb_get_hessian_threshold), 0);
- rb_define_method(rb_klass, "hessian_threshold=", RUBY_METHOD_FUNC(rb_set_hessian_threshold), 1);
- rb_define_method(rb_klass, "extended", RUBY_METHOD_FUNC(rb_get_extended), 0);
- rb_define_method(rb_klass, "extended=", RUBY_METHOD_FUNC(rb_set_extended), 1);
- rb_define_method(rb_klass, "n_octaves", RUBY_METHOD_FUNC(rb_get_n_octaves), 0);
- rb_define_method(rb_klass, "n_octaves=", RUBY_METHOD_FUNC(rb_set_n_octaves), 1);
- rb_define_method(rb_klass, "n_octave_layers", RUBY_METHOD_FUNC(rb_get_n_octave_layers), 0);
- rb_define_method(rb_klass, "n_octave_layers=", RUBY_METHOD_FUNC(rb_set_n_octave_layers), 1);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -61,11 +37,15 @@ rb_allocate(VALUE klass)
return Data_Make_Struct(klass, CvSURFParams, 0, -1, ptr);
}
-/*
- * call-seq:
- * CvSURFParams.new(hessian_threshold[,extended=false,n_octaves=3,n_octave_layers=4]) -> cvsurfparams
- *
+/*
* Create a CvSURFParams
+ *
+ * @overload CvSURFParams.new(hessian_threshold, extended = false, n_octaves = 3, n_octave_layers = 4)
+ * @param hessian_threshold [Number]
+ * @param extended [Boolean] If true, exteneded descriptors (128 elements each),
+ * otherwise basic descriptors (64 elements each)
+ * @param n_octaves [Integer] Number of octaves to be used for extraction
+ * @param n_octave_layers [Integer] Number of layers within each octave
*/
VALUE
rb_initialize(int argc, VALUE *argv, VALUE self)
@@ -194,6 +174,35 @@ new_object(CvSURFParams* cvsurfparams)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvSURFParams", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "hessian_threshold", RUBY_METHOD_FUNC(rb_get_hessian_threshold), 0);
+ rb_define_method(rb_klass, "hessian_threshold=", RUBY_METHOD_FUNC(rb_set_hessian_threshold), 1);
+ rb_define_method(rb_klass, "extended", RUBY_METHOD_FUNC(rb_get_extended), 0);
+ rb_define_method(rb_klass, "extended=", RUBY_METHOD_FUNC(rb_set_extended), 1);
+ rb_define_method(rb_klass, "n_octaves", RUBY_METHOD_FUNC(rb_get_n_octaves), 0);
+ rb_define_method(rb_klass, "n_octaves=", RUBY_METHOD_FUNC(rb_set_n_octaves), 1);
+ rb_define_method(rb_klass, "n_octave_layers", RUBY_METHOD_FUNC(rb_get_n_octave_layers), 0);
+ rb_define_method(rb_klass, "n_octave_layers=", RUBY_METHOD_FUNC(rb_set_n_octave_layers), 1);
+}
+
__NAMESPACE_END_CVSURFPARAMS
__NAMESPACE_END_OPENCV
diff --git a/ext/opencv/cvsurfpoint.cpp b/ext/opencv/cvsurfpoint.cpp
index 88ffa37..63eb842 100644
--- a/ext/opencv/cvsurfpoint.cpp
+++ b/ext/opencv/cvsurfpoint.cpp
@@ -35,32 +35,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvSURFPoint", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), 5);
- rb_define_method(rb_klass, "pt", RUBY_METHOD_FUNC(rb_get_pt), 0);
- rb_define_method(rb_klass, "pt=", RUBY_METHOD_FUNC(rb_set_pt), 1);
- rb_define_method(rb_klass, "laplacian", RUBY_METHOD_FUNC(rb_get_laplacian), 0);
- rb_define_method(rb_klass, "laplacian=", RUBY_METHOD_FUNC(rb_set_laplacian), 1);
- rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_get_size), 0);
- rb_define_method(rb_klass, "size=", RUBY_METHOD_FUNC(rb_set_size), 1);
- rb_define_method(rb_klass, "dir", RUBY_METHOD_FUNC(rb_get_dir), 0);
- rb_define_method(rb_klass, "dir=", RUBY_METHOD_FUNC(rb_set_dir), 1);
- rb_define_method(rb_klass, "hessian", RUBY_METHOD_FUNC(rb_get_hessian), 0);
- rb_define_method(rb_klass, "hessian=", RUBY_METHOD_FUNC(rb_set_hessian), 1);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -69,10 +43,18 @@ rb_allocate(VALUE klass)
}
/*
- * call-seq:
- * CvSURFPoint.new(pt,laplacian,size,dir,hessian) -> cvsurfpoint
- *
* Create a CvSURFPoint
+ *
+ * @overload new(pt, laplacian, size, dir, hessian)
+ * @param pt [CvPoint2D32f] Position of the feature within the image
+ * @param laplacian [Integer] -1, 0 or +1. sign of the laplacian at the point.
+ * Can be used to speedup feature comparison
+ * (normally features with laplacians of different signs can not match)
+ * @param size [Integer] Size of the feature
+ * @param dir [Number] Orientation of the feature: 0..360 degrees
+ * @param hessian [Number] Value of the hessian (can be used to
+ * approximately estimate the feature strengths)
+ * @return [CvSURFPoint] self
*/
VALUE
rb_initialize(VALUE self, VALUE pt, VALUE laplacian, VALUE size, VALUE dir, VALUE hessian)
@@ -88,9 +70,10 @@ rb_initialize(VALUE self, VALUE pt, VALUE laplacian, VALUE size, VALUE dir, VALU
}
/*
- * call-seq:
- * pt -> cvpoint2d32f
* Return position of the feature as CvPoint2D32f.
+ *
+ * @overload pt
+ * @return [CvPoint2D32f] Position of the feature.
*/
VALUE
rb_get_pt(VALUE self)
@@ -99,10 +82,10 @@ rb_get_pt(VALUE self)
}
/*
- * call-seq:
- * pt = value
- *
- * Set position of the feature to value
+ * Set position of the feature.
+ *
+ * @overload pt=(value)
+ * @param value [CvPoint2D32f] Valuet to set.
*/
VALUE
rb_set_pt(VALUE self, VALUE value)
@@ -112,9 +95,10 @@ rb_set_pt(VALUE self, VALUE value)
}
/*
- * call-seq:
- * laplacian -> number
* Return sign of the laplacian at the point (-1, 0 or +1)
+ *
+ * @overload laplacian
+ * @return [Integer] Sign of the laplacian at the point.
*/
VALUE
rb_get_laplacian(VALUE self)
@@ -123,9 +107,10 @@ rb_get_laplacian(VALUE self)
}
/*
- * call-seq:
- * laplacian = value (-1, 0 or +1)
* Set sign of the laplacian at the point
+ *
+ * @overload laplacian=(value)
+ * @param value [Integer] Value to set.
*/
VALUE
rb_set_laplacian(VALUE self, VALUE value)
@@ -136,9 +121,10 @@ rb_set_laplacian(VALUE self, VALUE value)
}
/*
- * call-seq:
- * size -> number
- * Return size of feature
+ * Returns size of feature.
+ *
+ * @overload size
+ * @return [Integer] Size of feature.
*/
VALUE
rb_get_size(VALUE self)
@@ -147,9 +133,10 @@ rb_get_size(VALUE self)
}
/*
- * call-seq:
- * size = value
* Return size of feature
+ *
+ * @overload size=(value)
+ * @param [Integer] Value to set.
*/
VALUE
rb_set_size(VALUE self, VALUE value)
@@ -159,9 +146,10 @@ rb_set_size(VALUE self, VALUE value)
}
/*
- * call-seq:
- * dir -> number
* Return orientation of the feature: 0..360 degrees
+ *
+ * @overload dir
+ * @return [Number] Orientation of the feature.
*/
VALUE
rb_get_dir(VALUE self)
@@ -170,9 +158,10 @@ rb_get_dir(VALUE self)
}
/*
- * call-seq:
- * dir = value
- * Set orientation of the feature: 0..360 degrees
+ * Set orientation of the feature: 0..360 degrees.
+ *
+ * @overloda dir=(value)
+ * @param [Number] Value to set.
*/
VALUE
rb_set_dir(VALUE self, VALUE value)
@@ -182,9 +171,10 @@ rb_set_dir(VALUE self, VALUE value)
}
/*
- * call-seq:
- * hessian -> number
* Return value of the hessian
+ *
+ * @overload hessian
+ * @reutrn [Number] Hessian
*/
VALUE
rb_get_hessian(VALUE self)
@@ -193,9 +183,10 @@ rb_get_hessian(VALUE self)
}
/*
- * call-seq:
- * hessian = value
* Set value of the hessian
+ *
+ * @overload hessian=(value)
+ * @param [Number] Value to set.
*/
VALUE
rb_set_hessian(VALUE self, VALUE value)
@@ -219,5 +210,37 @@ new_object(CvSURFPoint* cvsurfpoint)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvSURFPoint", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), 5);
+ rb_define_method(rb_klass, "pt", RUBY_METHOD_FUNC(rb_get_pt), 0);
+ rb_define_method(rb_klass, "pt=", RUBY_METHOD_FUNC(rb_set_pt), 1);
+ rb_define_method(rb_klass, "laplacian", RUBY_METHOD_FUNC(rb_get_laplacian), 0);
+ rb_define_method(rb_klass, "laplacian=", RUBY_METHOD_FUNC(rb_set_laplacian), 1);
+ rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_get_size), 0);
+ rb_define_method(rb_klass, "size=", RUBY_METHOD_FUNC(rb_set_size), 1);
+ rb_define_method(rb_klass, "dir", RUBY_METHOD_FUNC(rb_get_dir), 0);
+ rb_define_method(rb_klass, "dir=", RUBY_METHOD_FUNC(rb_set_dir), 1);
+ rb_define_method(rb_klass, "hessian", RUBY_METHOD_FUNC(rb_get_hessian), 0);
+ rb_define_method(rb_klass, "hessian=", RUBY_METHOD_FUNC(rb_set_hessian), 1);
+}
+
__NAMESPACE_END_CVSURFPOINT
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvtermcriteria.cpp b/ext/opencv/cvtermcriteria.cpp
index f460ed2..ef2e02a 100644
--- a/ext/opencv/cvtermcriteria.cpp
+++ b/ext/opencv/cvtermcriteria.cpp
@@ -29,32 +29,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvTermCriteria", rb_cObject);
- /* CvTermCriteria: class */
- rb_define_const(opencv, "CvTerm", rb_klass);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "type", RUBY_METHOD_FUNC(rb_type), 0);
- rb_define_method(rb_klass, "max", RUBY_METHOD_FUNC(rb_max), 0);
- rb_define_method(rb_klass, "max=", RUBY_METHOD_FUNC(rb_set_max), 1);
- rb_define_method(rb_klass, "eps", RUBY_METHOD_FUNC(rb_eps), 0);
- rb_define_method(rb_klass, "eps=", RUBY_METHOD_FUNC(rb_set_eps), 1);
- rb_define_alias(rb_klass, "epsilon", "eps");
- rb_define_alias(rb_klass, "epsilon=", "eps=");
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -188,5 +162,37 @@ new_object(CvTermCriteria criteria)
return object;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvTermCriteria", rb_cObject);
+ /* CvTermCriteria: class */
+ rb_define_const(opencv, "CvTerm", rb_klass);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "type", RUBY_METHOD_FUNC(rb_type), 0);
+ rb_define_method(rb_klass, "max", RUBY_METHOD_FUNC(rb_max), 0);
+ rb_define_method(rb_klass, "max=", RUBY_METHOD_FUNC(rb_set_max), 1);
+ rb_define_method(rb_klass, "eps", RUBY_METHOD_FUNC(rb_eps), 0);
+ rb_define_method(rb_klass, "eps=", RUBY_METHOD_FUNC(rb_set_eps), 1);
+ rb_define_alias(rb_klass, "epsilon", "eps");
+ rb_define_alias(rb_klass, "epsilon=", "eps=");
+}
+
__NAMESPACE_END_CVTERMCRITERIA
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvtwopoints.cpp b/ext/opencv/cvtwopoints.cpp
index ad3e3cc..cc70201 100644
--- a/ext/opencv/cvtwopoints.cpp
+++ b/ext/opencv/cvtwopoints.cpp
@@ -9,7 +9,7 @@
************************************************************/
#include "cvtwopoints.h"
/*
- * Document-class: OpenCV::CvTwopoints
+ * Document-class: OpenCV::CvTwoPoints
*
* This class means one twopoints on X axis Y axis.
* X and Y takes the value of the Fixnum. see also CvTwopoints2D32F
@@ -31,27 +31,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
-
- rb_klass = rb_define_class_under(opencv, "CvTwoPoints", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "point1", RUBY_METHOD_FUNC(rb_point1), 0);
- rb_define_method(rb_klass, "point2", RUBY_METHOD_FUNC(rb_point2), 0);
- rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
- rb_define_alias(rb_klass, "to_a", "to_ary");
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -112,5 +91,32 @@ rb_to_ary(VALUE self)
return rb_ary_new3(2, rb_point1(self), rb_point2(self));
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+
+ rb_klass = rb_define_class_under(opencv, "CvTwoPoints", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "point1", RUBY_METHOD_FUNC(rb_point1), 0);
+ rb_define_method(rb_klass, "point2", RUBY_METHOD_FUNC(rb_point2), 0);
+ rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
+ rb_define_alias(rb_klass, "to_a", "to_ary");
+}
+
__NAMESPACE_END_CVTWOPOINTS
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/cvvideowriter.cpp b/ext/opencv/cvvideowriter.cpp
index 4ced524..4c7877d 100644
--- a/ext/opencv/cvvideowriter.cpp
+++ b/ext/opencv/cvvideowriter.cpp
@@ -26,23 +26,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "CvVideoWriter", rb_cObject);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "write", RUBY_METHOD_FUNC(rb_write), 1);
- rb_define_method(rb_klass, "close", RUBY_METHOD_FUNC(rb_close), 0);
-}
-
/*
* call-seq:
* CvVideoWriter.new(filname, fourcc, fps, size[, is_color]) -> cvvideowriter
@@ -132,6 +115,28 @@ rb_close(VALUE self)
return Qnil;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "CvVideoWriter", rb_cObject);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "write", RUBY_METHOD_FUNC(rb_write), 1);
+ rb_define_method(rb_klass, "close", RUBY_METHOD_FUNC(rb_close), 0);
+}
__NAMESPACE_END_CVVIDEOWRITER
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/eigenfaces.cpp b/ext/opencv/eigenfaces.cpp
index 0b6f929..69beb79 100644
--- a/ext/opencv/eigenfaces.cpp
+++ b/ext/opencv/eigenfaces.cpp
@@ -49,6 +49,13 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
void
init_ruby_class()
{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
+ VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
+#endif
+
if (rb_klass)
return;
/*
@@ -57,7 +64,8 @@ init_ruby_class()
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "EigenFaces", cFaceRecognizer::rb_class());
+ VALUE face_recognizer = cFaceRecognizer::rb_class();
+ rb_klass = rb_define_class_under(opencv, "EigenFaces", face_recognizer);
rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
}
diff --git a/ext/opencv/facerecognizer.cpp b/ext/opencv/facerecognizer.cpp
index bb97f80..a6ae7f1 100644
--- a/ext/opencv/facerecognizer.cpp
+++ b/ext/opencv/facerecognizer.cpp
@@ -154,6 +154,12 @@ rb_load(VALUE self, VALUE filename)
void
init_ruby_class()
{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
+#endif
+
if (rb_klass)
return;
/*
@@ -162,7 +168,8 @@ init_ruby_class()
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "FaceRecognizer", cAlgorithm::rb_class());
+ VALUE alghorithm = cAlgorithm::rb_class();
+ rb_klass = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
rb_define_method(rb_klass, "train", RUBY_METHOD_FUNC(rb_train), 2);
rb_define_method(rb_klass, "predict", RUBY_METHOD_FUNC(rb_predict), 1);
rb_define_method(rb_klass, "save", RUBY_METHOD_FUNC(rb_save), 1);
@@ -171,3 +178,4 @@ init_ruby_class()
__NAMESPACE_END_FACERECOGNIZER
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/fisherfaces.cpp b/ext/opencv/fisherfaces.cpp
index 3aa81f6..503afe4 100644
--- a/ext/opencv/fisherfaces.cpp
+++ b/ext/opencv/fisherfaces.cpp
@@ -49,6 +49,13 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
void
init_ruby_class()
{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
+ VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
+#endif
+
if (rb_klass)
return;
/*
@@ -57,7 +64,8 @@ init_ruby_class()
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "FisherFaces", cFaceRecognizer::rb_class());
+ VALUE face_recognizer = cFaceRecognizer::rb_class();
+ rb_klass = rb_define_class_under(opencv, "FisherFaces", face_recognizer);
rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
}
diff --git a/ext/opencv/gui.cpp b/ext/opencv/gui.cpp
index 26564ab..90b2749 100644
--- a/ext/opencv/gui.cpp
+++ b/ext/opencv/gui.cpp
@@ -25,21 +25,6 @@ rb_module_GUI()
return rb_module;
}
-void
-init_ruby_module()
-{
- if (rb_module)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_module = rb_define_module_under(opencv, "GUI");
- rb_define_singleton_method(rb_module, "wait_key", RUBY_METHOD_FUNC(rb_wait_key), -1);
-}
-
/*
* call-seq:
* wait_key([delay]) -> int or nil
@@ -63,6 +48,26 @@ rb_wait_key(int argc, VALUE *argv, VALUE self)
return (keycode < 0) ? Qnil : INT2NUM(keycode);
}
+void
+init_ruby_module()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_module)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_module = rb_define_module_under(opencv, "GUI");
+ rb_define_singleton_method(rb_module, "wait_key", RUBY_METHOD_FUNC(rb_wait_key), -1);
+}
+
__NAMESPACE_END_GUI
__NAMESPACE_END_OPENCV
diff --git a/ext/opencv/iplconvkernel.cpp b/ext/opencv/iplconvkernel.cpp
index 1367175..8438728 100644
--- a/ext/opencv/iplconvkernel.cpp
+++ b/ext/opencv/iplconvkernel.cpp
@@ -29,30 +29,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "IplConvKernel", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
-
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
- rb_define_method(rb_klass, "cols", RUBY_METHOD_FUNC(rb_cols), 0);
- rb_define_alias(rb_klass, "columns", "cols");
- rb_define_method(rb_klass, "rows", RUBY_METHOD_FUNC(rb_rows), 0);
- rb_define_method(rb_klass, "anchor", RUBY_METHOD_FUNC(rb_anchor), 0);
- rb_define_method(rb_klass, "anchor_x", RUBY_METHOD_FUNC(rb_anchor_x), 0);
- rb_define_method(rb_klass, "anchor_y", RUBY_METHOD_FUNC(rb_anchor_y), 0);
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -188,5 +164,35 @@ rb_anchor_y(VALUE self)
return INT2NUM(IPLCONVKERNEL(self)->anchorY);
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ rb_klass = rb_define_class_under(opencv, "IplConvKernel", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
+ rb_define_method(rb_klass, "cols", RUBY_METHOD_FUNC(rb_cols), 0);
+ rb_define_alias(rb_klass, "columns", "cols");
+ rb_define_method(rb_klass, "rows", RUBY_METHOD_FUNC(rb_rows), 0);
+ rb_define_method(rb_klass, "anchor", RUBY_METHOD_FUNC(rb_anchor), 0);
+ rb_define_method(rb_klass, "anchor_x", RUBY_METHOD_FUNC(rb_anchor_x), 0);
+ rb_define_method(rb_klass, "anchor_y", RUBY_METHOD_FUNC(rb_anchor_y), 0);
+}
+
__NAMESPACE_END_IPLCONVKERNEL
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/lbph.cpp b/ext/opencv/lbph.cpp
index 4b10929..895fe32 100644
--- a/ext/opencv/lbph.cpp
+++ b/ext/opencv/lbph.cpp
@@ -52,6 +52,13 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
void
init_ruby_class()
{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
+ VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
+#endif
+
if (rb_klass)
return;
/*
@@ -60,7 +67,8 @@ init_ruby_class()
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
- rb_klass = rb_define_class_under(opencv, "LBPH", cFaceRecognizer::rb_class());
+ VALUE face_recognizer = cFaceRecognizer::rb_class();
+ rb_klass = rb_define_class_under(opencv, "LBPH", face_recognizer);
rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
}
diff --git a/ext/opencv/pointset.cpp b/ext/opencv/pointset.cpp
index 559e889..f8b980d 100644
--- a/ext/opencv/pointset.cpp
+++ b/ext/opencv/pointset.cpp
@@ -23,29 +23,6 @@ rb_module()
return module;
}
-void
-init_ruby_module()
-{
- if (module)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- *
- * note: this comment is used by rdoc.
- */
- VALUE opencv = rb_module_opencv();
- module = rb_define_module_under(opencv, "PointSet");
- rb_define_method(module, "contour_area", RUBY_METHOD_FUNC(rb_contour_area), -1);
- rb_define_method(module, "fit_ellipse2", RUBY_METHOD_FUNC(rb_fit_ellipse2), 0);
-
- rb_define_method(module, "convex_hull2", RUBY_METHOD_FUNC(rb_convex_hull2), -1);
- rb_define_method(module, "check_contour_convexity", RUBY_METHOD_FUNC(rb_check_contour_convexity), 0);
- rb_define_alias(module, "convexity?", "check_contour_convexity");
- rb_define_method(module, "convexity_defects", RUBY_METHOD_FUNC(rb_convexity_defects), 1);
- rb_define_method(module, "min_area_rect2", RUBY_METHOD_FUNC(rb_min_area_rect2), 0);
- rb_define_method(module, "min_enclosing_circle", RUBY_METHOD_FUNC(rb_min_enclosing_circle), 0);
-}
-
/*
* call-seq:
* contour_area -> float
@@ -197,6 +174,34 @@ rb_min_enclosing_circle(VALUE self)
return success ? circle : Qnil;
}
+void
+init_ruby_module()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+#endif
+
+ if (module)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE opencv = rb_module_opencv();
+ module = rb_define_module_under(opencv, "PointSet");
+ rb_define_method(module, "contour_area", RUBY_METHOD_FUNC(rb_contour_area), -1);
+ rb_define_method(module, "fit_ellipse2", RUBY_METHOD_FUNC(rb_fit_ellipse2), 0);
+
+ rb_define_method(module, "convex_hull2", RUBY_METHOD_FUNC(rb_convex_hull2), -1);
+ rb_define_method(module, "check_contour_convexity", RUBY_METHOD_FUNC(rb_check_contour_convexity), 0);
+ rb_define_alias(module, "convexity?", "check_contour_convexity");
+ rb_define_method(module, "convexity_defects", RUBY_METHOD_FUNC(rb_convexity_defects), 1);
+ rb_define_method(module, "min_area_rect2", RUBY_METHOD_FUNC(rb_min_area_rect2), 0);
+ rb_define_method(module, "min_enclosing_circle", RUBY_METHOD_FUNC(rb_min_enclosing_circle), 0);
+}
+
__NAMESPACE_END_POINT_SET
int
@@ -272,3 +277,4 @@ VALUE_TO_POINT_SET(VALUE object)
}
__NAMESPACE_END_OPENCV
+
diff --git a/ext/opencv/trackbar.cpp b/ext/opencv/trackbar.cpp
index 4f17a9e..bd7b5e8 100644
--- a/ext/opencv/trackbar.cpp
+++ b/ext/opencv/trackbar.cpp
@@ -25,25 +25,6 @@ VALUE rb_class() {
return rb_klass;
}
-void init_ruby_class() {
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- * GUI = rb_define_module_under(opencv, "GUI");
- *
- * note: this comment is used by rdoc.
- */
- VALUE GUI = rb_module_GUI();
- rb_klass = rb_define_class_under(GUI, "Trackbar", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "name", RUBY_METHOD_FUNC(rb_name), 0);
- rb_define_method(rb_klass, "max", RUBY_METHOD_FUNC(rb_max), 0);
- rb_define_method(rb_klass, "value", RUBY_METHOD_FUNC(rb_value), 0);
- rb_define_method(rb_klass, "value=", RUBY_METHOD_FUNC(rb_set_value), 1);
-}
-
VALUE rb_allocate(VALUE klass) {
Trackbar *ptr;
return Data_Make_Struct(klass, Trackbar, trackbar_mark, trackbar_free, ptr);
@@ -114,6 +95,31 @@ VALUE rb_set_value(VALUE self, VALUE val) {
TRACKBAR(self)->val = NUM2INT(val);
return self;
}
+
+void init_ruby_class() {
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE GUI = rb_define_module_under(opencv, "GUI");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ * GUI = rb_define_module_under(opencv, "GUI");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE GUI = rb_module_GUI();
+ rb_klass = rb_define_class_under(GUI, "Trackbar", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "name", RUBY_METHOD_FUNC(rb_name), 0);
+ rb_define_method(rb_klass, "max", RUBY_METHOD_FUNC(rb_max), 0);
+ rb_define_method(rb_klass, "value", RUBY_METHOD_FUNC(rb_value), 0);
+ rb_define_method(rb_klass, "value=", RUBY_METHOD_FUNC(rb_set_value), 1);
+}
__NAMESPACE_END_TRACKBAR
__NAMESPACE_END_GUI
diff --git a/ext/opencv/window.cpp b/ext/opencv/window.cpp
index 5f1c01d..b1b8d37 100644
--- a/ext/opencv/window.cpp
+++ b/ext/opencv/window.cpp
@@ -32,33 +32,6 @@ rb_class()
return rb_klass;
}
-void
-init_ruby_class()
-{
- if (rb_klass)
- return;
- /*
- * opencv = rb_define_module("OpenCV");
- * GUI = rb_define_module_under(opencv, "GUI");
- *
- * note: this comment is used by rdoc.
- */
- VALUE GUI = rb_module_GUI();
- rb_klass = rb_define_class_under(GUI, "Window", rb_cObject);
- rb_define_alloc_func(rb_klass, rb_allocate);
- rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
- rb_define_method(rb_klass, "alive?", RUBY_METHOD_FUNC(rb_alive_q), 0);
- rb_define_method(rb_klass, "destroy", RUBY_METHOD_FUNC(rb_destroy), 0);
- rb_define_singleton_method(rb_klass, "destroy_all", RUBY_METHOD_FUNC(rb_destroy_all), 0);
- rb_define_method(rb_klass, "resize", RUBY_METHOD_FUNC(rb_resize), -1);
- rb_define_method(rb_klass, "move", RUBY_METHOD_FUNC(rb_move), -1);
- rb_define_method(rb_klass, "show_image", RUBY_METHOD_FUNC(rb_show_image), 1);
- rb_define_alias(rb_klass, "show", "show_image");
- rb_define_method(rb_klass, "set_trackbar", RUBY_METHOD_FUNC(rb_set_trackbar), -1);
- rb_define_method(rb_klass, "set_mouse_callback", RUBY_METHOD_FUNC(rb_set_mouse_callback), -1);
- rb_define_alias(rb_klass, "on_mouse", "set_mouse_callback");
-}
-
VALUE
rb_allocate(VALUE klass)
{
@@ -351,6 +324,39 @@ rb_set_mouse_callback(int argc, VALUE* argv, VALUE self)
return block;
}
+void
+init_ruby_class()
+{
+#if 0
+ // For documentation using YARD
+ VALUE opencv = rb_define_module("OpenCV");
+ VALUE GUI = rb_define_module_under(opencv, "GUI");
+#endif
+
+ if (rb_klass)
+ return;
+ /*
+ * opencv = rb_define_module("OpenCV");
+ * GUI = rb_define_module_under(opencv, "GUI");
+ *
+ * note: this comment is used by rdoc.
+ */
+ VALUE GUI = rb_module_GUI();
+ rb_klass = rb_define_class_under(GUI, "Window", rb_cObject);
+ rb_define_alloc_func(rb_klass, rb_allocate);
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
+ rb_define_method(rb_klass, "alive?", RUBY_METHOD_FUNC(rb_alive_q), 0);
+ rb_define_method(rb_klass, "destroy", RUBY_METHOD_FUNC(rb_destroy), 0);
+ rb_define_singleton_method(rb_klass, "destroy_all", RUBY_METHOD_FUNC(rb_destroy_all), 0);
+ rb_define_method(rb_klass, "resize", RUBY_METHOD_FUNC(rb_resize), -1);
+ rb_define_method(rb_klass, "move", RUBY_METHOD_FUNC(rb_move), -1);
+ rb_define_method(rb_klass, "show_image", RUBY_METHOD_FUNC(rb_show_image), 1);
+ rb_define_alias(rb_klass, "show", "show_image");
+ rb_define_method(rb_klass, "set_trackbar", RUBY_METHOD_FUNC(rb_set_trackbar), -1);
+ rb_define_method(rb_klass, "set_mouse_callback", RUBY_METHOD_FUNC(rb_set_mouse_callback), -1);
+ rb_define_alias(rb_klass, "on_mouse", "set_mouse_callback");
+}
+
__NAMESPACE_END_WINDOW
__NAMESPACE_END_GUI
__NAMESPACE_END_OPENCV