1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

ATV Modulator: transmit still images resize with standard change

This commit is contained in:
f4exb 2017-03-09 01:00:46 +01:00
parent f20d522aa7
commit a35b5e2f9b
2 changed files with 19 additions and 8 deletions

View File

@ -365,19 +365,28 @@ void ATVMod::applyStandard()
m_hBarIncrement = m_spanLevel / (float) m_nbBars;
m_vBarIncrement = m_spanLevel / (float) m_nbBars;
}
if (m_imageOK)
{
resizeImage();
}
}
void ATVMod::openImage(const QString& fileName)
{
cv::Mat tmpImage = cv::imread(qPrintable(fileName), CV_LOAD_IMAGE_GRAYSCALE);
m_imageOK = tmpImage.data != 0;
m_imageOriginal = cv::imread(qPrintable(fileName), CV_LOAD_IMAGE_GRAYSCALE);
m_imageOK = m_imageOriginal.data != 0;
if (m_imageOK)
{
float fy = (m_nbImageLines - 2*m_nbBlankLines) / (float) tmpImage.rows;
float fx = m_pointsPerImgLine / (float) tmpImage.cols;
cv::resize(tmpImage, m_image, cv::Size(), fx, fy);
qDebug("ATVMod::openImage: %d x %d -> %d x %d", tmpImage.cols, tmpImage.rows, m_image.cols, m_image.rows);
// later: image.at<char>(49,39);
resizeImage();
}
}
void ATVMod::resizeImage()
{
float fy = (m_nbImageLines - 2*m_nbBlankLines) / (float) m_imageOriginal.rows;
float fx = m_pointsPerImgLine / (float) m_imageOriginal.cols;
cv::resize(m_imageOriginal, m_image, cv::Size(), fx, fy);
qDebug("ATVMod::resizeImage: %d x %d -> %d x %d", m_imageOriginal.cols, m_imageOriginal.rows, m_image.cols, m_image.rows);
}

View File

@ -213,7 +213,8 @@ private:
Real m_peakLevel;
Real m_levelSum;
cv::Mat m_image;
cv::Mat m_imageOriginal; //!< original non resized image
cv::Mat m_image; //!< resized image for transmission at given rate
bool m_imageOK;
static const float m_blackLevel;
@ -228,6 +229,7 @@ private:
void modulateSample();
void applyStandard();
void openImage(const QString& fileName);
void resizeImage();
inline void pullImageLine(Real& sample)
{