-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
a.mishutin
committed
Jan 9, 2024
1 parent
c7602a8
commit 68a4b7b
Showing
13 changed files
with
686 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set(the_description "Signal processing algorithms") | ||
ocv_define_module(signal opencv_core WRAP python) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Signal Processing algorithms | ||
================================================ | ||
|
||
Signal resampling done with cubic interpolation and low-pass filtering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
#ifndef OPENCV_SIGNAL_HPP | ||
#define OPENCV_SIGNAL_HPP | ||
|
||
#include "opencv2/core.hpp" | ||
#include "opencv2/signal/signal_resample.hpp" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
#ifndef OPENCV_SIGNAL_SIGNAL_RESAMPLE_HPP | ||
#define OPENCV_SIGNAL_SIGNAL_RESAMPLE_HPP | ||
|
||
#include <opencv2/core.hpp> | ||
|
||
namespace cv { | ||
namespace signal { | ||
|
||
//! @addtogroup signal | ||
//! @{ | ||
|
||
/** @brief Signal resampling | ||
* | ||
* @param[in] inputSignal Array with input signal. | ||
* @param[out] outSignal Array with output signal | ||
* @param[in] inFreq Input signal frequency. | ||
* @param[in] outFreq Output signal frequency. | ||
* Signal resampling implemented a cubic interpolation function and a filtering function based on Kaiser window and Bessel function, used to construct a FIR filter. | ||
* Result is similar to `scipy.signal.resample`. | ||
Detail: https://en.wikipedia.org/wiki/Sample-rate_conversion | ||
*/ | ||
CV_EXPORTS_W void resampleSignal(InputArray inputSignal, OutputArray outSignal, const int inFreq, const int outFreq); | ||
|
||
//! @} | ||
|
||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html. | ||
#include "perf_precomp.hpp" | ||
|
||
CV_PERF_TEST_MAIN(signal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html. | ||
#ifndef __OPENCV_PERF_PRECOMP_HPP__ | ||
#define __OPENCV_PERF_PRECOMP_HPP__ | ||
|
||
#include "opencv2/ts.hpp" | ||
#include "opencv2/signal.hpp" | ||
|
||
namespace opencv_test { | ||
using namespace perf; | ||
using namespace cv::signal; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html. | ||
|
||
#include "perf_precomp.hpp" | ||
|
||
using namespace std; | ||
using namespace cv; | ||
using namespace perf; | ||
|
||
namespace opencv_test { namespace { | ||
|
||
typedef TestBaseWithParam< tuple<uint32_t, uint32_t, uint32_t> > TestResampleFunc; | ||
|
||
PERF_TEST_P( TestResampleFunc, resample_sin_signal, | ||
testing::Combine( | ||
testing::Values(1234U, 12345U, 123456U, 1234567U, 12345678U), | ||
testing::Values(16000U, 32000U, 44100U, 48000U), | ||
testing::Values(48000U, 44100U, 32000U, 16000U)) | ||
) | ||
{ | ||
uint32_t sample_signal_size = GET_PARAM(0); | ||
uint32_t inFreq = GET_PARAM(1); | ||
uint32_t outFreq = GET_PARAM(2); | ||
|
||
Mat1f sample_signal(Size(sample_signal_size,1U)); | ||
Mat1f outSignal(Size(1U, 1U)); | ||
for (uint32_t i = 0U; i < (uint32_t)sample_signal.cols; ++i) | ||
{ | ||
sample_signal.at<float>(0, i) = sinf(float(i)); | ||
} | ||
declare.in(sample_signal).out(outSignal); | ||
TEST_CYCLE() resampleSignal(sample_signal, outSignal, inFreq, outFreq); | ||
SANITY_CHECK_NOTHING(); | ||
} | ||
|
||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
|
||
#ifndef __OPENCV_SIGNAL_PRECOMP__ | ||
#define __OPENCV_SIGNAL_PRECOMP__ | ||
|
||
#include <opencv2/core.hpp> | ||
|
||
#endif |
Oops, something went wrong.