Java Code Examples for org.opencv.imgproc.Imgproc.RETR_EXTERNAL

The following are Jave code examples for showing how to use RETR_EXTERNAL of the org.opencv.imgproc.Imgproc class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: 2017   File: GripPipeline.java   Source Code and License Vote up 8 votes
/**
 * Sets the values of pixels in a binary image to their distance to the nearest
 * black pixel.
 * 
 * @param input
 *            The image on which to perform the Distance Transform.
 * @param type
 *            The Transform.
 * @param maskSize
 *            the size of the mask.
 * @param output
 *            The image in which to store the output.
 */
private void findContours (Mat input, boolean externalOnly,
        List<MatOfPoint> contours)
{
    Mat hierarchy = new Mat();
    contours.clear();
    int mode;
    if (externalOnly)
        {
        mode = Imgproc.RETR_EXTERNAL;
        }
    else
        {
        mode = Imgproc.RETR_LIST;
        }
    int method = Imgproc.CHAIN_APPROX_SIMPLE;
    Imgproc.findContours(input, contours, hierarchy, mode, method);
}
 
Example 2
Project: frc-2017   File: Vision.java   Source Code and License Vote up 6 votes
/**
 * Sets the values of pixels in a binary image to their distance to the nearest black pixel.
 * 
 * @param input
 *            The image on which to perform the Distance Transform.
 * @param type
 *            The Transform.
 * @param maskSize
 *            the size of the mask.
 * @param output
 *            The image in which to store the output.
 */
private void findContours(Mat input, boolean externalOnly, List<MatOfPoint> contours) {
	Mat hierarchy = new Mat();
	contours.clear();
	int mode;
	if (externalOnly) {
		mode = Imgproc.RETR_EXTERNAL;
	} else {
		mode = Imgproc.RETR_LIST;
	}
	int method = Imgproc.CHAIN_APPROX_SIMPLE;
	Imgproc.findContours(input, contours, hierarchy, mode, method);
}
 
Example 3
Project: 2017   File: KilroyVision.java   Source Code and License Vote up 6 votes
/**
 * Sets the values of pixels in a binary image to their distance to the nearest
 * black pixel.
 * 
 * @param input
 *            The image on which to perform the Distance Transform.
 * @param type
 *            The Transform.
 * @param maskSize
 *            the size of the mask.
 * @param output
 *            The image in which to store the output.
 */
private void findContours (Mat input, boolean externalOnly,
        List<MatOfPoint> contours)
{
    Mat hierarchy = new Mat();
    contours.clear();
    int mode;
    if (externalOnly)
        {
        mode = Imgproc.RETR_EXTERNAL;
        }
    else
        {
        mode = Imgproc.RETR_LIST;
        }
    int method = Imgproc.CHAIN_APPROX_SIMPLE;
    Imgproc.findContours(input, contours, hierarchy, mode, method);
}
 
Example 4
Project: FRC-6416-frc2017   File: GripPipeline.java   Source Code and License Vote up 5 votes
/**
 * Sets the values of pixels in a binary image to their distance to the nearest black pixel.
 * @param input The image on which to perform the Distance Transform.
 * @param type The Transform.
 * @param maskSize the size of the mask.
 * @param output The image in which to store the output.
 */
private void findContours(Mat input, boolean externalOnly,
	List<MatOfPoint> contours) {
	Mat hierarchy = new Mat();
	contours.clear();
	int mode;
	if (externalOnly) {
		mode = Imgproc.RETR_EXTERNAL;
	}
	else {
		mode = Imgproc.RETR_LIST;
	}
	int method = Imgproc.CHAIN_APPROX_SIMPLE;
	Imgproc.findContours(input, contours, hierarchy, mode, method);
}
 
Example 5
Project: DemonVision   File: DefaultPipeline.java   Source Code and License Vote up 5 votes
/**
 * Sets the values of pixels in a binary image to their distance to the nearest black pixel.
 * @param input The image on which to perform the Distance Transform.
 * @param type The Transform.
 * @param maskSize the size of the mask.
 * @param output The image in which to store the output.
 */
private void findContours(Mat input, boolean externalOnly,
	List<MatOfPoint> contours) {
	Mat hierarchy = new Mat();
	contours.clear();
	int mode;
	if (externalOnly) {
		mode = Imgproc.RETR_EXTERNAL;
	}
	else {
		mode = Imgproc.RETR_LIST;
	}
	int method = Imgproc.CHAIN_APPROX_SIMPLE;
	Imgproc.findContours(input, contours, hierarchy, mode, method);
}
 
Example 6
Project: Robot-Vision-API   File: StandardContourFinder.java   Source Code and License Vote up 5 votes
@Override
public List<MatOfPoint> findContours(Mat image) {
    List<MatOfPoint> contours = new ArrayList<>();
    Mat hierarchy = new Mat();
    int mode = Imgproc.RETR_EXTERNAL;
    int method = Imgproc.CHAIN_APPROX_SIMPLE;
    Imgproc.findContours(image, contours, hierarchy, mode, method);
    return contours;
}
 
Example 7
Project: STEAMworks   File: GripPipelineWithBlur.java   Source Code and License Vote up 3 votes
/**
 * Sets the values of pixels in a binary image to their distance to the
 * nearest black pixel.
 *
 * @param input
 *          The image on which to perform the Distance Transform.
 * @param type
 *          The Transform.
 * @param maskSize
 *          the size of the mask.
 * @param output
 *          The image in which to store the output.
 */
private void findContours(Mat input, boolean externalOnly, List<MatOfPoint> contours) {
  Mat hierarchy = new Mat();
  contours.clear();
  int mode;
  if (externalOnly) {
    mode = Imgproc.RETR_EXTERNAL;
  } else {
    mode = Imgproc.RETR_LIST;
  }
  int method = Imgproc.CHAIN_APPROX_SIMPLE;
  Imgproc.findContours(input, contours, hierarchy, mode, method);
}