@@ -57,17 +57,17 @@ void cv::gpu::divide(InputArray, InputArray, OutputArray, double, int, Stream&)
57
57
58
58
void cv::gpu::absdiff (InputArray, InputArray, OutputArray, Stream&) { throw_no_cuda (); }
59
59
60
- void cv::gpu::abs (const GpuMat&, GpuMat& , Stream&) { throw_no_cuda (); }
60
+ void cv::gpu::abs (InputArray, OutputArray , Stream&) { throw_no_cuda (); }
61
61
62
- void cv::gpu::sqr (const GpuMat&, GpuMat& , Stream&) { throw_no_cuda (); }
62
+ void cv::gpu::sqr (InputArray, OutputArray , Stream&) { throw_no_cuda (); }
63
63
64
- void cv::gpu::sqrt (const GpuMat&, GpuMat& , Stream&) { throw_no_cuda (); }
64
+ void cv::gpu::sqrt (InputArray, OutputArray , Stream&) { throw_no_cuda (); }
65
65
66
- void cv::gpu::exp (const GpuMat&, GpuMat& , Stream&) { throw_no_cuda (); }
66
+ void cv::gpu::exp (InputArray, OutputArray , Stream&) { throw_no_cuda (); }
67
67
68
- void cv::gpu::log (const GpuMat&, GpuMat& , Stream&) { throw_no_cuda (); }
68
+ void cv::gpu::log (InputArray, OutputArray , Stream&) { throw_no_cuda (); }
69
69
70
- void cv::gpu::pow (const GpuMat& , double , GpuMat& , Stream&) { throw_no_cuda (); }
70
+ void cv::gpu::pow (InputArray , double , OutputArray , Stream&) { throw_no_cuda (); }
71
71
72
72
void cv::gpu::compare (const GpuMat&, const GpuMat&, GpuMat&, int , Stream&) { throw_no_cuda (); }
73
73
void cv::gpu::compare (const GpuMat&, Scalar, GpuMat&, int , Stream&) { throw_no_cuda (); }
@@ -1484,7 +1484,7 @@ namespace arithm
1484
1484
void absMat (PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1485
1485
}
1486
1486
1487
- void cv::gpu::abs (const GpuMat& src, GpuMat& dst , Stream& stream)
1487
+ void cv::gpu::abs (InputArray _src, OutputArray _dst , Stream& stream)
1488
1488
{
1489
1489
using namespace arithm ;
1490
1490
@@ -1500,6 +1500,8 @@ void cv::gpu::abs(const GpuMat& src, GpuMat& dst, Stream& stream)
1500
1500
absMat<double >
1501
1501
};
1502
1502
1503
+ GpuMat src = _src.getGpuMat ();
1504
+
1503
1505
const int depth = src.depth ();
1504
1506
1505
1507
CV_Assert ( depth <= CV_64F );
@@ -1511,7 +1513,8 @@ void cv::gpu::abs(const GpuMat& src, GpuMat& dst, Stream& stream)
1511
1513
CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
1512
1514
}
1513
1515
1514
- dst.create (src.size (), src.type ());
1516
+ _dst.create (src.size (), src.type ());
1517
+ GpuMat dst = _dst.getGpuMat ();
1515
1518
1516
1519
funcs[depth](src, dst, StreamAccessor::getStream (stream));
1517
1520
}
@@ -1525,7 +1528,7 @@ namespace arithm
1525
1528
void sqrMat (PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1526
1529
}
1527
1530
1528
- void cv::gpu::sqr (const GpuMat& src, GpuMat& dst , Stream& stream)
1531
+ void cv::gpu::sqr (InputArray _src, OutputArray _dst , Stream& stream)
1529
1532
{
1530
1533
using namespace arithm ;
1531
1534
@@ -1541,6 +1544,8 @@ void cv::gpu::sqr(const GpuMat& src, GpuMat& dst, Stream& stream)
1541
1544
sqrMat<double >
1542
1545
};
1543
1546
1547
+ GpuMat src = _src.getGpuMat ();
1548
+
1544
1549
const int depth = src.depth ();
1545
1550
1546
1551
CV_Assert ( depth <= CV_64F );
@@ -1552,7 +1557,8 @@ void cv::gpu::sqr(const GpuMat& src, GpuMat& dst, Stream& stream)
1552
1557
CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
1553
1558
}
1554
1559
1555
- dst.create (src.size (), src.type ());
1560
+ _dst.create (src.size (), src.type ());
1561
+ GpuMat dst = _dst.getGpuMat ();
1556
1562
1557
1563
funcs[depth](src, dst, StreamAccessor::getStream (stream));
1558
1564
}
@@ -1566,7 +1572,7 @@ namespace arithm
1566
1572
void sqrtMat (PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1567
1573
}
1568
1574
1569
- void cv::gpu::sqrt (const GpuMat& src, GpuMat& dst , Stream& stream)
1575
+ void cv::gpu::sqrt (InputArray _src, OutputArray _dst , Stream& stream)
1570
1576
{
1571
1577
using namespace arithm ;
1572
1578
@@ -1582,6 +1588,8 @@ void cv::gpu::sqrt(const GpuMat& src, GpuMat& dst, Stream& stream)
1582
1588
sqrtMat<double >
1583
1589
};
1584
1590
1591
+ GpuMat src = _src.getGpuMat ();
1592
+
1585
1593
const int depth = src.depth ();
1586
1594
1587
1595
CV_Assert ( depth <= CV_64F );
@@ -1593,7 +1601,52 @@ void cv::gpu::sqrt(const GpuMat& src, GpuMat& dst, Stream& stream)
1593
1601
CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
1594
1602
}
1595
1603
1596
- dst.create (src.size (), src.type ());
1604
+ _dst.create (src.size (), src.type ());
1605
+ GpuMat dst = _dst.getGpuMat ();
1606
+
1607
+ funcs[depth](src, dst, StreamAccessor::getStream (stream));
1608
+ }
1609
+
1610
+ // //////////////////////////////////////////////////////////////////////
1611
+ // exp
1612
+
1613
+ namespace arithm
1614
+ {
1615
+ template <typename T>
1616
+ void expMat (PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1617
+ }
1618
+
1619
+ void cv::gpu::exp (InputArray _src, OutputArray _dst, Stream& stream)
1620
+ {
1621
+ using namespace arithm ;
1622
+
1623
+ typedef void (*func_t )(PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1624
+ static const func_t funcs[] =
1625
+ {
1626
+ expMat<unsigned char >,
1627
+ expMat<signed char >,
1628
+ expMat<unsigned short >,
1629
+ expMat<short >,
1630
+ expMat<int >,
1631
+ expMat<float >,
1632
+ expMat<double >
1633
+ };
1634
+
1635
+ GpuMat src = _src.getGpuMat ();
1636
+
1637
+ const int depth = src.depth ();
1638
+
1639
+ CV_Assert ( depth <= CV_64F );
1640
+ CV_Assert ( src.channels () == 1 );
1641
+
1642
+ if (depth == CV_64F)
1643
+ {
1644
+ if (!deviceSupports (NATIVE_DOUBLE))
1645
+ CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
1646
+ }
1647
+
1648
+ _dst.create (src.size (), src.type ());
1649
+ GpuMat dst = _dst.getGpuMat ();
1597
1650
1598
1651
funcs[depth](src, dst, StreamAccessor::getStream (stream));
1599
1652
}
@@ -1607,7 +1660,7 @@ namespace arithm
1607
1660
void logMat (PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1608
1661
}
1609
1662
1610
- void cv::gpu::log (const GpuMat& src, GpuMat& dst , Stream& stream)
1663
+ void cv::gpu::log (InputArray _src, OutputArray _dst , Stream& stream)
1611
1664
{
1612
1665
using namespace arithm ;
1613
1666
@@ -1623,6 +1676,8 @@ void cv::gpu::log(const GpuMat& src, GpuMat& dst, Stream& stream)
1623
1676
logMat<double >
1624
1677
};
1625
1678
1679
+ GpuMat src = _src.getGpuMat ();
1680
+
1626
1681
const int depth = src.depth ();
1627
1682
1628
1683
CV_Assert ( depth <= CV_64F );
@@ -1634,50 +1689,54 @@ void cv::gpu::log(const GpuMat& src, GpuMat& dst, Stream& stream)
1634
1689
CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
1635
1690
}
1636
1691
1637
- dst.create (src.size (), src.type ());
1692
+ _dst.create (src.size (), src.type ());
1693
+ GpuMat dst = _dst.getGpuMat ();
1638
1694
1639
1695
funcs[depth](src, dst, StreamAccessor::getStream (stream));
1640
1696
}
1641
1697
1642
1698
// //////////////////////////////////////////////////////////////////////
1643
- // exp
1699
+ // pow
1644
1700
1645
1701
namespace arithm
1646
1702
{
1647
- template <typename T>
1648
- void expMat (PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1703
+ template <typename T> void pow (PtrStepSzb src, double power, PtrStepSzb dst, cudaStream_t stream);
1649
1704
}
1650
1705
1651
- void cv::gpu::exp ( const GpuMat& src, GpuMat& dst , Stream& stream)
1706
+ void cv::gpu::pow (InputArray _src, double power, OutputArray _dst , Stream& stream)
1652
1707
{
1653
- using namespace arithm ;
1654
-
1655
- typedef void (*func_t )(PtrStepSzb src, PtrStepSzb dst, cudaStream_t stream);
1708
+ typedef void (*func_t )(PtrStepSzb src, double power, PtrStepSzb dst, cudaStream_t stream);
1656
1709
static const func_t funcs[] =
1657
1710
{
1658
- expMat <unsigned char >,
1659
- expMat <signed char >,
1660
- expMat <unsigned short >,
1661
- expMat <short >,
1662
- expMat <int >,
1663
- expMat <float >,
1664
- expMat <double >
1711
+ arithm:: pow <unsigned char >,
1712
+ arithm:: pow <signed char >,
1713
+ arithm:: pow <unsigned short >,
1714
+ arithm:: pow <short >,
1715
+ arithm:: pow <int >,
1716
+ arithm:: pow <float >,
1717
+ arithm:: pow <double >
1665
1718
};
1666
1719
1720
+ GpuMat src = _src.getGpuMat ();
1721
+
1667
1722
const int depth = src.depth ();
1723
+ const int cn = src.channels ();
1668
1724
1669
- CV_Assert ( depth <= CV_64F );
1670
- CV_Assert ( src.channels () == 1 );
1725
+ CV_Assert (depth <= CV_64F);
1671
1726
1672
1727
if (depth == CV_64F)
1673
1728
{
1674
1729
if (!deviceSupports (NATIVE_DOUBLE))
1675
1730
CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
1676
1731
}
1677
1732
1678
- dst.create (src.size (), src.type ());
1733
+ _dst.create (src.size (), src.type ());
1734
+ GpuMat dst = _dst.getGpuMat ();
1679
1735
1680
- funcs[depth](src, dst, StreamAccessor::getStream (stream));
1736
+ PtrStepSzb src_ (src.rows , src.cols * cn, src.data , src.step );
1737
+ PtrStepSzb dst_ (src.rows , src.cols * cn, dst.data , dst.step );
1738
+
1739
+ funcs[depth](src_, power, dst_, StreamAccessor::getStream (stream));
1681
1740
}
1682
1741
1683
1742
// ////////////////////////////////////////////////////////////////////////////
@@ -2562,47 +2621,6 @@ void cv::gpu::max(const GpuMat& src, double val, GpuMat& dst, Stream& stream)
2562
2621
funcs[depth](src, cast_func[depth](val), dst, StreamAccessor::getStream (stream));
2563
2622
}
2564
2623
2565
- // //////////////////////////////////////////////////////////////////////
2566
- // pow
2567
-
2568
- namespace arithm
2569
- {
2570
- template <typename T> void pow (PtrStepSzb src, double power, PtrStepSzb dst, cudaStream_t stream);
2571
- }
2572
-
2573
- void cv::gpu::pow (const GpuMat& src, double power, GpuMat& dst, Stream& stream)
2574
- {
2575
- typedef void (*func_t )(PtrStepSzb src, double power, PtrStepSzb dst, cudaStream_t stream);
2576
- static const func_t funcs[] =
2577
- {
2578
- arithm::pow <unsigned char >,
2579
- arithm::pow <signed char >,
2580
- arithm::pow <unsigned short >,
2581
- arithm::pow <short >,
2582
- arithm::pow <int >,
2583
- arithm::pow <float >,
2584
- arithm::pow <double >
2585
- };
2586
-
2587
- const int depth = src.depth ();
2588
- const int cn = src.channels ();
2589
-
2590
- CV_Assert (depth <= CV_64F);
2591
-
2592
- if (depth == CV_64F)
2593
- {
2594
- if (!deviceSupports (NATIVE_DOUBLE))
2595
- CV_Error (cv::Error::StsUnsupportedFormat, " The device doesn't support double" );
2596
- }
2597
-
2598
- dst.create (src.size (), src.type ());
2599
-
2600
- PtrStepSzb src_ (src.rows , src.cols * cn, src.data , src.step );
2601
- PtrStepSzb dst_ (src.rows , src.cols * cn, dst.data , dst.step );
2602
-
2603
- funcs[depth](src_, power, dst_, StreamAccessor::getStream (stream));
2604
- }
2605
-
2606
2624
// //////////////////////////////////////////////////////////////////////
2607
2625
// addWeighted
2608
2626
0 commit comments