mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -112,7 +112,7 @@ bool parseDLPackTensor(DLManagedTensor* tensor, cv::cuda::GpuMat& obj, bool copy
|
||||
static_cast<int>(tensor->dl_tensor.shape[1]),
|
||||
type,
|
||||
tensor->dl_tensor.data,
|
||||
tensor->dl_tensor.strides[0] * tensor->dl_tensor.dtype.bits / 8
|
||||
static_cast<size_t>(tensor->dl_tensor.strides[0] * tensor->dl_tensor.dtype.bits / 8)
|
||||
);
|
||||
if (copy)
|
||||
obj = obj.clone();
|
||||
@@ -140,7 +140,7 @@ bool parseDLPackTensor(DLManagedTensor* tensor, cv::cuda::GpuMatND& obj, bool co
|
||||
std::vector<int> sizes(tensor->dl_tensor.ndim);
|
||||
for (int i = 0; i < tensor->dl_tensor.ndim - 1; ++i)
|
||||
{
|
||||
steps[i] = tensor->dl_tensor.strides[i] * tensor->dl_tensor.dtype.bits / 8;
|
||||
steps[i] = static_cast<size_t>(tensor->dl_tensor.strides[i] * tensor->dl_tensor.dtype.bits / 8);
|
||||
sizes[i] = static_cast<int>(tensor->dl_tensor.shape[i]);
|
||||
}
|
||||
sizes.back() = static_cast<int>(tensor->dl_tensor.shape[tensor->dl_tensor.ndim - 1]);
|
||||
|
||||
@@ -2286,6 +2286,18 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
|
||||
|
||||
convertAndUnrollScalar( lb, src.type(), lbuf, blocksize );
|
||||
convertAndUnrollScalar( ub, src.type(), ubuf, blocksize );
|
||||
|
||||
if (depth == CV_8U && src.dims <= 2) {
|
||||
uint8_t lb_scalar = lbuf[0];
|
||||
uint8_t ub_scalar = ubuf[0];
|
||||
CALL_HAL(inRange_u8, cv_hal_inRange8u, src.data, src.step, dst.data, dst.step, dst.depth(), src.cols, src.rows, src.channels(),
|
||||
lb_scalar, ub_scalar);
|
||||
} else if (depth == CV_32F && src.dims <= 2) {
|
||||
double lb_scalar = lb.ptr<double>(0)[0];
|
||||
double ub_scalar = ub.ptr<double>(0)[0];
|
||||
CALL_HAL(inRange_f32, cv_hal_inRange32f, src.data, src.step, dst.data, dst.step, dst.depth(), src.cols, src.rows, src.channels(),
|
||||
lb_scalar, ub_scalar);
|
||||
}
|
||||
}
|
||||
|
||||
for( size_t i = 0; i < it.nplanes; i++, ++it )
|
||||
|
||||
@@ -1238,6 +1238,44 @@ inline int hal_ni_sum(const uchar *src_data, size_t src_step, int src_type, int
|
||||
#define cv_hal_sum hal_ni_sum
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief inRange (lower_bound <= src_value) && (src_value <= upper_bound) ? 255 : 0
|
||||
@param src_data Source image data
|
||||
@param src_step Source image step
|
||||
@param dst_data Destination image data
|
||||
@param dst_step Destination image step
|
||||
@param dst_depth Destination image depth
|
||||
@param width Image width
|
||||
@param height Image height
|
||||
@param cn number of channels
|
||||
@param lower_bound Range lower bound
|
||||
@param upper_bound Range upper bound
|
||||
*/
|
||||
inline int hal_ni_inRange8u(const uchar *src_data, size_t src_step,
|
||||
uchar *dst_data, size_t dst_step, int dst_depth, int width,
|
||||
int height, int cn, uchar lower_bound, uchar upper_bound) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
/**
|
||||
@brief inRange (lower_bound <= src_value) && (src_value <= upper_bound) ? 255 : 0
|
||||
@param src_data Source image data
|
||||
@param src_step Source image step
|
||||
@param dst_data Destination image data
|
||||
@param dst_step Destination image step
|
||||
@param dst_depth Destination image depth
|
||||
@param width Image width
|
||||
@param height Image height
|
||||
@param cn number of channels
|
||||
@param lower_bound Range lower bound
|
||||
@param upper_bound Range upper bound
|
||||
*/
|
||||
inline int hal_ni_inRange32f(const uchar *src_data, size_t src_step,
|
||||
uchar *dst_data, size_t dst_step, int dst_depth, int width,
|
||||
int height, int cn, double lower_bound, double upper_bound) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_inRange8u hal_ni_inRange8u
|
||||
#define cv_hal_inRange32f hal_ni_inRange32f
|
||||
//! @endcond
|
||||
|
||||
//! @}
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
Reference in New Issue
Block a user