Skip to content
Snippets Groups Projects
Commit 42403357 authored by Tanguy Raufflet's avatar Tanguy Raufflet
Browse files

Some fixes

- Ajout warning split color RGB d'une image en ndg (comme pour le split HSV)
- Ajout warning Apply mask différence de taille d'image
- (Detic-t): Reset de la sélection de l'image lorsque l'on quitte le mode
parent efb8d7f9
No related branches found
No related tags found
No related merge requests found
......@@ -80,6 +80,10 @@ void BinaryMaskOp::operator()(const ImageWindow *currentWnd,
const Image_t<double>* dblImg = imgBox->getDblImage(imgBox->currentText().toStdString());
if(dblImg == nullptr) return;
mask = new Image_t<double>(*dblImg);
if(mask->getHeight() != dblImg->getHeight() || mask->getWidth() != dblImg->getWidth())
QMessageBox::information(nullptr, qApp->translate("BinaryMaskOp", "warning Apply Mask"),
qApp->translate("BinaryMaskOp",
"you have performed a mask operation between two images of different sizes"));
}
else return;
......@@ -100,6 +104,11 @@ void BinaryMaskOp::operator()(const ImageWindow *currentWnd,
*it = *it / max;
}
if(mask->getHeight() != img->getHeight() || mask->getWidth() != img->getWidth())
QMessageBox::information(nullptr, qApp->translate("BinaryMaskOp", "warning Apply Mask"),
qApp->translate("BinaryMaskOp",
"you have performed a mask operation between two images of different sizes"));
const unsigned int width = min(mask->getWidth(), img->getWidth());
const unsigned int height = min(mask->getHeight(), img->getHeight());
auto* resImg = new Image_t<double>(width, height, img->getNbChannels());
......
......@@ -17,6 +17,7 @@
* along with ImageINSA. If not, see <http://www.gnu.org/licenses/>.
*/
#include <GrayscaleImage.h>
#include <QMessageBox>
#include "SplitColorOp.h"
#include "../Tools.h"
......@@ -33,9 +34,14 @@ SplitColorOp::SplitColorOp() : Operation(qApp->translate("Operations", "Split co
}
void SplitColorOp:: operator()(const imagein::Image* image, const std::map<const imagein::Image*, std::string>&) {
if(image->getNbChannels()==1){
QMessageBox::warning(nullptr, qApp->translate("Operations", "The operation cannot be applied on this image"),
qApp->translate("Operations", "The image is not in color."));
return;
}
for(unsigned int c = 0; c < image->getNbChannels(); ++c) {
GrayscaleImage* resImg = new GrayscaleImage(image->getWidth(), image->getHeight());
auto* resImg = new GrayscaleImage(image->getWidth(), image->getHeight());
for(unsigned int j = 0; j < resImg->getHeight(); ++j) {
for(unsigned int i = 0; i < resImg->getWidth(); ++i) {
resImg->setPixel(i, j, image->getPixel(i, j, c));
......
Subproject commit 2a63e6517079b78bff5d9ae1fb48d30e32dca653
Subproject commit 4e8b354dbc606f52edfabe5370010acdc011c5f4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment