mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -577,7 +577,7 @@ CV_EXPORTS_W void ensureSizeIsEnough(int rows, int cols, int type, OutputArray a
|
||||
*/
|
||||
CV_EXPORTS_W GpuMat inline createGpuMatFromCudaMemory(int rows, int cols, int type, size_t cudaMemoryAddress, size_t step = Mat::AUTO_STEP) {
|
||||
return GpuMat(rows, cols, type, reinterpret_cast<void*>(cudaMemoryAddress), step);
|
||||
};
|
||||
}
|
||||
|
||||
/** @overload
|
||||
@param size 2D array size: Size(cols, rows). In the Size() constructor, the number of rows and the number of columns go in the reverse order.
|
||||
@@ -588,7 +588,7 @@ CV_EXPORTS_W GpuMat inline createGpuMatFromCudaMemory(int rows, int cols, int ty
|
||||
*/
|
||||
CV_EXPORTS_W inline GpuMat createGpuMatFromCudaMemory(Size size, int type, size_t cudaMemoryAddress, size_t step = Mat::AUTO_STEP) {
|
||||
return GpuMat(size, type, reinterpret_cast<void*>(cudaMemoryAddress), step);
|
||||
};
|
||||
}
|
||||
|
||||
/** @brief BufferPool for use with CUDA streams
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ cvRound( double value )
|
||||
{
|
||||
#if defined CV_INLINE_ROUND_DBL
|
||||
CV_INLINE_ROUND_DBL(value);
|
||||
#elif (defined _MSC_VER && defined _M_X64) && !defined(__CUDACC__)
|
||||
#elif ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __SSE2__)) && !defined(__CUDACC__)
|
||||
__m128d t = _mm_set_sd( value );
|
||||
return _mm_cvtsd_si32(t);
|
||||
#elif defined _MSC_VER && defined _M_IX86
|
||||
@@ -323,7 +323,7 @@ CV_INLINE int cvRound(float value)
|
||||
{
|
||||
#if defined CV_INLINE_ROUND_FLT
|
||||
CV_INLINE_ROUND_FLT(value);
|
||||
#elif (defined _MSC_VER && defined _M_X64) && !defined(__CUDACC__)
|
||||
#elif ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __SSE2__)) && !defined(__CUDACC__)
|
||||
__m128 t = _mm_set_ss( value );
|
||||
return _mm_cvtss_si32(t);
|
||||
#elif defined _MSC_VER && defined _M_IX86
|
||||
@@ -354,7 +354,7 @@ CV_INLINE int cvFloor( float value )
|
||||
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
|
||||
defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
|
||||
return (int)__builtin_floorf(value);
|
||||
#elif defined __loongarch
|
||||
#elif defined __loongarch__
|
||||
int i;
|
||||
float tmp;
|
||||
__asm__ ("ftintrm.w.s %[tmp], %[in] \n\t"
|
||||
@@ -381,7 +381,7 @@ CV_INLINE int cvCeil( float value )
|
||||
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
|
||||
defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
|
||||
return (int)__builtin_ceilf(value);
|
||||
#elif defined __loongarch
|
||||
#elif defined __loongarch__
|
||||
int i;
|
||||
float tmp;
|
||||
__asm__ ("ftintrp.w.s %[tmp], %[in] \n\t"
|
||||
|
||||
@@ -1651,6 +1651,10 @@ inline v_uint32 v_popcount(const v_uint32& a)
|
||||
{
|
||||
return v_hadd(v_hadd(v_popcount(vreinterpret_u8m1(a))));
|
||||
}
|
||||
inline v_uint64 v_popcount(const v_uint64& a)
|
||||
{
|
||||
return v_hadd(v_hadd(v_hadd(v_popcount(vreinterpret_u8m1(a)))));
|
||||
}
|
||||
|
||||
inline v_uint8 v_popcount(const v_int8& a)
|
||||
{
|
||||
@@ -1664,6 +1668,11 @@ inline v_uint32 v_popcount(const v_int32& a)
|
||||
{
|
||||
return v_popcount(v_abs(a));\
|
||||
}
|
||||
inline v_uint64 v_popcount(const v_int64& a)
|
||||
{
|
||||
// max(0 - a) is used, since v_abs does not support 64-bit integers.
|
||||
return v_popcount(v_reinterpret_as_u64(vmax(a, v_sub(v_setzero_s64(), a), VTraits<v_int64>::vlanes())));
|
||||
}
|
||||
|
||||
|
||||
//////////// SignMask ////////////
|
||||
|
||||
@@ -1288,15 +1288,36 @@ public:
|
||||
t(); // finally, transpose the Nx3 matrix.
|
||||
// This involves copying all the elements
|
||||
@endcode
|
||||
3-channel 2x2 matrix reshaped to 1-channel 4x3 matrix, each column has values from one of original channels:
|
||||
@code
|
||||
Mat m(Size(2, 2), CV_8UC3, Scalar(1, 2, 3));
|
||||
vector<int> new_shape {4, 3};
|
||||
m = m.reshape(1, new_shape);
|
||||
@endcode
|
||||
or:
|
||||
@code
|
||||
Mat m(Size(2, 2), CV_8UC3, Scalar(1, 2, 3));
|
||||
const int new_shape[] = {4, 3};
|
||||
m = m.reshape(1, 2, new_shape);
|
||||
@endcode
|
||||
@param cn New number of channels. If the parameter is 0, the number of channels remains the same.
|
||||
@param rows New number of rows. If the parameter is 0, the number of rows remains the same.
|
||||
*/
|
||||
Mat reshape(int cn, int rows=0) const;
|
||||
|
||||
/** @overload */
|
||||
/** @overload
|
||||
* @param cn New number of channels. If the parameter is 0, the number of channels remains the same.
|
||||
* @param newndims New number of dimentions.
|
||||
* @param newsz Array with new matrix size by all dimentions. If some sizes are zero,
|
||||
* the original sizes in those dimensions are presumed.
|
||||
*/
|
||||
Mat reshape(int cn, int newndims, const int* newsz) const;
|
||||
|
||||
/** @overload */
|
||||
/** @overload
|
||||
* @param cn New number of channels. If the parameter is 0, the number of channels remains the same.
|
||||
* @param newshape Vector with new matrix size by all dimentions. If some sizes are zero,
|
||||
* the original sizes in those dimensions are presumed.
|
||||
*/
|
||||
Mat reshape(int cn, const std::vector<int>& newshape) const;
|
||||
|
||||
/** @brief Transposes a matrix.
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4127 )
|
||||
#pragma warning( disable: 4127 5054 )
|
||||
#endif
|
||||
|
||||
#if defined(CV_SKIP_DISABLE_CLANG_ENUM_WARNINGS)
|
||||
|
||||
@@ -256,6 +256,7 @@ public:
|
||||
//! return codes for cv::solveLP() function
|
||||
enum SolveLPResult
|
||||
{
|
||||
SOLVELP_LOST = -3, //!< problem is feasible, but solver lost solution due to floating-point arithmetic errors
|
||||
SOLVELP_UNBOUNDED = -2, //!< problem is unbounded (target function can achieve arbitrary high values)
|
||||
SOLVELP_UNFEASIBLE = -1, //!< problem is unfeasible (there are no points that satisfy all the constraints imposed)
|
||||
SOLVELP_SINGLE = 0, //!< there is only one maximum for target function
|
||||
@@ -291,8 +292,12 @@ in the latter case it is understood to correspond to \f$c^T\f$.
|
||||
and the remaining to \f$A\f$. It should contain 32- or 64-bit floating point numbers.
|
||||
@param z The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the
|
||||
formulation above. It will contain 64-bit floating point numbers.
|
||||
@param constr_eps allowed numeric disparity for constraints
|
||||
@return One of cv::SolveLPResult
|
||||
*/
|
||||
CV_EXPORTS_W int solveLP(InputArray Func, InputArray Constr, OutputArray z, double constr_eps);
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS_W int solveLP(InputArray Func, InputArray Constr, OutputArray z);
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -527,23 +527,23 @@ The sample below demonstrates how to use RotatedRect:
|
||||
|
||||
@sa CamShift, fitEllipse, minAreaRect, CvBox2D
|
||||
*/
|
||||
class CV_EXPORTS RotatedRect
|
||||
class CV_EXPORTS_W_SIMPLE RotatedRect
|
||||
{
|
||||
public:
|
||||
//! default constructor
|
||||
RotatedRect();
|
||||
CV_WRAP RotatedRect();
|
||||
/** full constructor
|
||||
@param center The rectangle mass center.
|
||||
@param size Width and height of the rectangle.
|
||||
@param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc.,
|
||||
the rectangle becomes an up-right rectangle.
|
||||
*/
|
||||
RotatedRect(const Point2f& center, const Size2f& size, float angle);
|
||||
CV_WRAP RotatedRect(const Point2f& center, const Size2f& size, float angle);
|
||||
/**
|
||||
Any 3 end points of the RotatedRect. They must be given in order (either clockwise or
|
||||
anticlockwise).
|
||||
*/
|
||||
RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
|
||||
CV_WRAP RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
|
||||
|
||||
/** returns 4 vertices of the rotated rectangle
|
||||
@param pts The points array for storing rectangle vertices. The order is _bottomLeft_, _topLeft_, topRight, bottomRight.
|
||||
@@ -552,16 +552,19 @@ public:
|
||||
rectangle.
|
||||
*/
|
||||
void points(Point2f pts[]) const;
|
||||
|
||||
CV_WRAP void points(CV_OUT std::vector<Point2f>& pts) const;
|
||||
|
||||
//! returns the minimal up-right integer rectangle containing the rotated rectangle
|
||||
Rect boundingRect() const;
|
||||
CV_WRAP Rect boundingRect() const;
|
||||
//! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images
|
||||
Rect_<float> boundingRect2f() const;
|
||||
//! returns the rectangle mass center
|
||||
Point2f center;
|
||||
CV_PROP_RW Point2f center;
|
||||
//! returns width and height of the rectangle
|
||||
Size2f size;
|
||||
CV_PROP_RW Size2f size;
|
||||
//! returns the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
|
||||
float angle;
|
||||
CV_PROP_RW float angle;
|
||||
};
|
||||
|
||||
template<> class DataType< RotatedRect >
|
||||
|
||||
Reference in New Issue
Block a user