Thank you Samuel for Your answer
I'm getting this error while creating an Indexer to the GrayScale mat
OpenCV(4.5.5) D:\a\javacpp-presets\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-4.5.5\modules\core\src\arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
my code is this please let me know what I'm wrong and what is the best way to do it
Mat mask = new Mat(diffImage.rows(),diffImage.cols(),CV_8UC1, maskscalar);
Mat maskDiff = new Mat(diffImage.rows(),diffImage.cols(),img0.type(), img0.data());
Mat m3=img0;
opencv_imgproc.cvtColor(m3, m3,opencv_imgproc.COLOR_RGB2GRAY);
final UByteIndexer resizeIdx = diffImage.createIndexer();
final UByteIndexer maskIdx = mask.createIndexer();
final UByteIndexer maskDiffIdx = maskDiff.createIndexer();
final UByteIndexer maskDiffIdx2 = maskDiff2.createIndexer();
final UByteRawIndexer maskDiffIdx3 = m3.createIndexer();
for (long hh = 0; hh < diffImage.rows(); hh++) {
for (long ww = 0; ww < diffImage.cols(); ww++) {
// int a=maskDiffIdx3.get(hh,ww);
if (resizeIdx.get(hh, ww) > 30) {
maskIdx.put(hh, ww,255);
//maskDiffIdx2.put(hh, ww,0);
for (int i = 0; i <maskDiff.channels()-1; i++) {
maskDiffIdx.put(hh, ww,i,0);
maskDiffIdx2.put(hh, ww,i,100);
}
}
else{
maskDiffIdx2.put(hh, ww, maskDiffIdx3.get(hh, ww));
}
}
:
I really need any one's help,
thanks in advance!!
ב-יום שני, 21 בנובמבר 2022 בשעה 15:03:05 UTC+2, Samuel Audet כתב/ה: