मैं इच्छित स्थान पर बड़ी छवि के लिए एक छवि को जोड़ने का प्रयास किया गया है। मुझे addWeighted (src, अल्फा, पानी, -, डीएसटी, -) करके ओपनसीवी में वॉटरमार्क जोड़ने का एक तरीका मिला, लेकिन समस्या यह है कि वॉटरमार्क और सतह की छवि दोनों एक ही आकार के होनी चाहिए जो मैं नहीं चाहता।ऐड वॉटरमार्क छोटे छवि opencv4android
एक और तरीका है (मुझे लगता है)
Mat srcMat = cvCanvasImage.submat(top/2, (top + height)/2, left/2, (left + width)/2);
Imgproc.cvtColor(mat, srcMat, Imgproc.COLOR_GRAY2BGR,4);
मिले लेकिन मैं ऐसा करने के तरीके समझ में नहीं आता ??
धन्यवाद ..
अद्यतन
Mat cvCanvasImage = Highgui.imread(Environment.getExternalStorageDirectory() + "/wallpapers/castle.jpg");
// Small watermark image
Mat cvWaterImage = Highgui.imread(Environment.getExternalStorageDirectory() +"/square.png");
Size canvasSize = cvWaterImage.size();
int rows = (int) canvasSize.height;
int cols = (int) canvasSize.width;
int left = 0;
int top = 0;
int width = rows;
int height = cols;
Rect ROI = new Rect(left, top, width, height);
Core.addWeighted(cvCanvasImage.submat(ROI), alpha, cvWaterImage, beta, 0, cvCanvasImage.submat(ROI));
//now it throws me this error
"error: (-209) 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 void cv::arithm_op(const cv::_InputArray&, const cv::_InputArray&, const cv::_OutputArray&, const cv::_InputArray&, int, void (**)(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, cv::Size, void*), bool, void*)"
मैंने अपना रास्ता लागू कर लिया है और मेरा प्रश्न अपडेट किया है, कृपया एक नज़र डालें। त्वरित प्रतिक्रिया के लिए वैसे भी धन्यवाद। – Khawar
इसे हल किया, धन्यवाद – Khawar