How to update the camera image on the javafx interface in real time after using opencv to obtain the camera image for processing?

problem description

after obtaining the camera image using opencv, perform a series of processing, including equalization, binarization, and so on, to obtain the imageView object, so how to put this object on the interface of javafx? And the camera will continue to send images over for processing, which requires the interface to be constantly refreshed.

problem environment background

I look up the information on the UI of javafx and its update is not thread-safe. I have tried to click the button and open a thread to use a loop to constantly let this thread update the main thread"s UI interface, but this will cause a serious problem, that is, the interface will get stuck. Am I updating the interface in the wrong way?

related codes

public void originalImageAction(ActionEvent actionEvent) {
    System.out.println(myCamera.getMyImage().status);
    Task<Integer> task = new Task<Integer>() {
        @Override
        protected Integer call() throws Exception {

            return 1;
        }
    };
    Thread thread = new Thread() {
        @Override
        public void run() {
            while (true){
                if(!myCamera.getMyImage().isOriginal()) {
                    myCamera.getMyImage().setOriginalStatus();
                    while (myCamera.getMyImage().isOriginal()){
                        //
                        Platform.runLater(() -> {
                            Borderpane.setCenter(myCamera.getImageView());//
                        });
                    }
                }
            }
        }
    };
    thread.setName("updateUiThread");
    thread.start();

}

result

above is the button click event I added. After clicking, start the thread to update the interface. It is expected that the displayed image can be refreshed in real time, resulting in a serious stutter problem. It is estimated that it is the problem of UI update. Platform.runLater will put the update of UI to the main thread, so that the main thread will get stuck once there are other updates. Is there anything you can do?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e57f0e-45479.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e57f0e-45479.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?