diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 23cde1aaa..09cda4e56 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -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(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); +} diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index 6f5567ae9..78f9bf517 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -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) {