折线绘制
在OpenCV中折线的绘制依赖于polylines() 该函数。其解释如下:
- mat
表示要在其上绘制矩形的图像的Mat对象。 - pts
包含MatOfPoint类型的对象的List对象。 - isClosed
指定折线的布尔型类型的参数是否为关闭的。 - color
表示矩形颜色的标量对象(BGR),Scalar类型。 - thickness
表示矩形厚度的整数。
其中pts包含的类型解释如下:
pts接受一个List对象,该对象只可放入MatOfPoint类型的对象;而MatOfPoint是一组Point类型的数据。
Java代码(JavaFX Controller层)
public class Controller{
@FXML private Text fxText;
@FXML private ImageView imageView;
@FXML public void handleButtonEvent(ActionEvent actionEvent) throws IOException {
Node source = (Node) actionEvent.getSource();
Window theStage = source.getScene().getWindow();
FileChooser fileChooser = new FileChooser();
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter