/** * create a sub image from this image * * @param x pixel column * @param y pixel row * @param w width * @param h height * @return the new image */ public Picture getSub(int x, int y, int w, int h) { Picture img = new Picture(); if (isValid()) { img = new Picture(getContent().submat(new Rect(x, y, w, h))); } return img; }
public Mat getContent(Element elem) { if (SX.isNull(elem)) { return makeContent(); } else { return makeContent().submat(new Rect(elem.x, elem.y, elem.w, elem.h)); } }
Math.min(target.h + 2 * margin, mBase.height())); rSub = new Rectangle(0, 0, mBase.cols(), mBase.rows()).intersection(rSub); Rect rectSub = new Rect(rSub.x, rSub.y, rSub.width, rSub.height); mResult = doFindMatch(target, mBase.submat(rectSub), null); mMinMax = Core.minMaxLoc(mResult);
public Rect getROI1() { Rect retVal = new Rect(getROI1_0(nativeObj)); return retVal; }
public Rect boundingRect() { Point pt[] = new Point[4]; points(pt); Rect r = new Rect((int) Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)), (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y))); r.width -= r.x - 1; r.height -= r.y - 1; return r; }
public static Rect boundingRect(MatOfPoint points) { Mat points_mat = points; Rect retVal = new Rect(boundingRect_0(points_mat.nativeObj)); return retVal; }
public static Rect getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize) { Rect retVal = new Rect(getValidDisparityROI_0(roi1.x, roi1.y, roi1.width, roi1.height, roi2.x, roi2.y, roi2.width, roi2.height, minDisparity, numberOfDisparities, SADWindowSize)); return retVal; }
public Rect getROI1() { Rect retVal = new Rect(getROI1_0(nativeObj)); return retVal; }
public Rect getROI2() { Rect retVal = new Rect(getROI2_0(nativeObj)); return retVal; }
public static Rect getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize) { Rect retVal = new Rect(getValidDisparityROI_0(roi1.x, roi1.y, roi1.width, roi1.height, roi2.x, roi2.y, roi2.width, roi2.height, minDisparity, numberOfDisparities, SADWindowSize)); return retVal; }
public static Rect boundingRect(MatOfPoint points) { Mat points_mat = points; Rect retVal = new Rect(boundingRect_0(points_mat.nativeObj)); return retVal; }
public Rect getROI2() { Rect retVal = new Rect(getROI2_0(nativeObj)); return retVal; }
public static Rect getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize) { Rect retVal = new Rect(getValidDisparityROI_0(roi1.x, roi1.y, roi1.width, roi1.height, roi2.x, roi2.y, roi2.width, roi2.height, minDisparity, numberOfDisparities, SADWindowSize)); return retVal; }
public Rect getROI1() { Rect retVal = new Rect(getROI1_0(nativeObj)); return retVal; }
public Rect boundingRect() { Point pt[] = new Point[4]; points(pt); Rect r = new Rect((int) Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)), (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y))); r.width -= r.x - 1; r.height -= r.y - 1; return r; }
public Rect[] toArray() { int num = (int) total(); Rect[] a = new Rect[num]; if(num == 0) return a; int buff[] = new int[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) a[i] = new Rect(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]); return a; } public void fromList(List<Rect> lr) {
public ObjectTracker() { hist = new Mat(); trackRect = new Rect(); rotatedRect = new RotatedRect(); hsvList = new Vector<>(); hueList = new Vector<>(); ranges = new MatOfFloat(0f, 256f); }
public Rect[] toArray() { int num = (int) total(); Rect[] a = new Rect[num]; if(num == 0) return a; int buff[] = new int[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) a[i] = new Rect(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]); return a; } public void fromList(List<Rect> lr) {
public Rect[] toArray() { int num = (int) total(); Rect[] a = new Rect[num]; if(num == 0) return a; int buff[] = new int[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) a[i] = new Rect(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]); return a; } public void fromList(List<Rect> lr) {
public Rect[] toArray() { int num = (int) total(); Rect[] a = new Rect[num]; if(num == 0) return a; int buff[] = new int[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) a[i] = new Rect(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]); return a; } public void fromList(List<Rect> lr) {