I'd like to know whether having different variables for the src (source) and dst (destination) of an OpenCV function will have an effect on the processing time. I have two functions below that does the same thing.
public static Mat getY(Mat m){
Mat mMattemp = new Mat();
Imgproc.cvtColor(m,mMattemp,Imgproc.COLOR_YUV420sp2RGB);
Imgproc.cvtColor(mMattemp,mMattemp, Imgproc.COLOR_RGB2HSV);
Core.inRange(mMattemp, new Scalar(20, 100, 100), new Scalar(30, 255, 255), mMattemp);
return mMattemp;
}
VERSUS
public static Mat getY(Mat m){
Mat mMattemp_rgb = new Mat();
Mat mMattemp_hsv = new Mat();
Mat mMattemp_ir = new Mat();
Imgproc.cvtColor(m,mMattemp_rgb,Imgproc.COLOR_YUV420sp2RGB);
Imgproc.cvtColor(mMattemp_rgb,mMattemp_hsv, Imgproc.COLOR_RGB2HSV);
Core.inRange(mMattemp_hsv, new Scalar(20, 100, 100), new Scalar(30, 255, 255), mMattemp_ir);
return mMattemp_ir;
}
Which of the two is considered best-practice? What is the advantage of one over the other?