目标跟踪技术

简介: Boofcv研究:动态目标追踪public class RemovalMoving { public static void main(String[] args) { String fileName = UtilIO.

Boofcv研究:动态目标追踪

public class RemovalMoving {
    public static void main(String[] args) {
        String fileName = UtilIO.pathExample("D:\\JavaProject\\Boofcv\\example\\tracking\\chipmunk.mjpeg");
        ImageType imageType = ImageType.single(GrayF32.class);      
        //ImageType imageType = ImageType.il(3, InterleavedF32.class);
        //ImageType imageType = ImageType.il(3, InterleavedU8.class);

        ConfigGeneralDetector confDetector = new ConfigGeneralDetector();
        confDetector.threshold = 10;
        confDetector.maxFeatures = 300;
        confDetector.radius = 6;

        //  KLT tracker
        PointTracker tracker = FactoryPointTracker.klt(new int[]{1, 2, 4, 8}, confDetector, 3,
                GrayF32.class, null);

        // This estimates the 2D image motion
        ImageMotion2D<GrayF32,Homography2D_F64> motion2D =
                FactoryMotion2D.createMotion2D(500, 0.5, 3, 100, 0.6, 0.5, false, tracker, new Homography2D_F64());

        ConfigBackgroundBasic configBasic = new ConfigBackgroundBasic(30, 0.005f);

        // Configuration for Gaussian model.  Note that the threshold changes depending on the number of image bands
        // 12 = gray scale and 40 = color
        ConfigBackgroundGaussian configGaussian = new ConfigBackgroundGaussian(12,0.001f);
        configGaussian.initialVariance = 64;
        configGaussian.minimumDifference = 5;

        // Comment/Uncomment to switch background mode
        BackgroundModelMoving background =
                FactoryBackgroundModel.movingBasic(configBasic, new PointTransformHomography_F32(), imageType);
//              FactoryBackgroundModel.movingGaussian(configGaussian, new PointTransformHomography_F32(), imageType);


        MediaManager media = DefaultMediaManager.INSTANCE;
        SimpleImageSequence video =
                media.openVideo(fileName, background.getImageType());
                media.openCamera(null,640,480,background.getImageType());


        // storage for segmented image.  Background = 0, Foreground = 1
        GrayU8 segmented = new GrayU8(video.getNextWidth(),video.getNextHeight());
        // Grey scale image that's the input for motion estimation
        GrayF32 grey = new GrayF32(segmented.width,segmented.height);

        // coordinate frames
        Homography2D_F32 firstToCurrent32 = new Homography2D_F32();
        Homography2D_F32 homeToWorld = new Homography2D_F32();
        homeToWorld.a13 = grey.width/2;
        homeToWorld.a23 = grey.height/2;

        // Create a background image twice the size of the input image.  Tell it that the home is in the center
        background.initialize(grey.width * 2, grey.height * 2, homeToWorld);

        BufferedImage visualized = new BufferedImage(segmented.width,segmented.height,BufferedImage.TYPE_INT_RGB);
        ImageGridPanel gui = new ImageGridPanel(1,2);
        gui.setImages(visualized, visualized);

        ShowImages.showWindow(gui, "Detections", true);

        double fps = 0;
        double alpha = 0.01; // smoothing factor for FPS

        while( video.hasNext() ) {
            ImageBase input = video.next();

            long before = System.nanoTime();
            GConvertImage.convert(input, grey);

            if( !motion2D.process(grey) ) {
                throw new RuntimeException("Should handle this scenario");
            }

            Homography2D_F64 firstToCurrent64 = motion2D.getFirstToCurrent();
            UtilHomography.convert(firstToCurrent64, firstToCurrent32);

            background.segment(firstToCurrent32, input, segmented);
            background.updateBackground(firstToCurrent32,input);
            long after = System.nanoTime();

            fps = (1.0-alpha)*fps + alpha*(1.0/((after-before)/1e9));

            VisualizeBinaryData.renderBinary(segmented,false,visualized);
            gui.setImage(0, 0, (BufferedImage)video.getGuiImage());
            gui.setImage(0, 1, visualized);
            gui.repaint();

            System.out.println("FPS = "+fps);

            try {Thread.sleep(5);} catch (InterruptedException e) {}
        }
    }
}

这里写图片描述

这里写图片描述

这里写图片描述

目录
相关文章
|
1月前
|
机器学习/深度学习 监控 算法
计算机视觉实战项目(图像分类+目标检测+目标跟踪+姿态识别+车道线识别+车牌识别)
计算机视觉实战项目(图像分类+目标检测+目标跟踪+姿态识别+车道线识别+车牌识别)
68 1
|
1月前
|
机器学习/深度学习 算法 决策智能
微美全息开发RPSSC技术在高光谱图像分类领域取得重要突破
随着高光谱遥感技术的发展,对于高光谱图像的更加精准的处理需求逐渐增加。在农业、环境监测、资源管理等领域,对高光谱图像进行准确分类是实现智能决策和资源优化利用的基础。
|
9月前
|
传感器 机器学习/深度学习 算法
【姿态解算】基于扩展卡尔曼滤波九轴传感器姿态解算研究附代码
【姿态解算】基于扩展卡尔曼滤波九轴传感器姿态解算研究附代码
|
机器学习/深度学习 传感器 SQL
领域最全 | 计算机视觉算法在路面坑洼检测中的应用综述(基于2D图像/3D LiDAR/深度学习)(下)
本文首先介绍了用于2D和3D道路数据采集的传感系统,包括摄像机、激光扫描仪和微软Kinect。随后,对 SoTA 计算机视觉算法进行了全面深入的综述,包括: (1)经典的2D图像处理,(2)3D点云建模与分割,(3)机器/深度学习。本文还讨论了基于计算机视觉的路面坑洼检测方法目前面临的挑战和未来的发展趋势: 经典的基于2D图像处理和基于3D点云建模和分割的方法已经成为历史; 卷积神经网络(CNN)已经展示了引人注目的路面坑洼检测结果,并有望在未来的进展中打破瓶颈的自/无监督学习多模态语义分割。作者相信本研究可为下一代道路状况评估系统的发展提供实用的指导。
领域最全 | 计算机视觉算法在路面坑洼检测中的应用综述(基于2D图像/3D LiDAR/深度学习)(下)
|
机器学习/深度学习 传感器 数据采集
领域最全 | 计算机视觉算法在路面坑洼检测中的应用综述(基于2D图像/3D LiDAR/深度学习)(上)
本文首先介绍了用于2D和3D道路数据采集的传感系统,包括摄像机、激光扫描仪和微软Kinect。随后,对 SoTA 计算机视觉算法进行了全面深入的综述,包括: (1)经典的2D图像处理,(2)3D点云建模与分割,(3)机器/深度学习。本文还讨论了基于计算机视觉的路面坑洼检测方法目前面临的挑战和未来的发展趋势: 经典的基于2D图像处理和基于3D点云建模和分割的方法已经成为历史; 卷积神经网络(CNN)已经展示了引人注目的路面坑洼检测结果,并有望在未来的进展中打破瓶颈的自/无监督学习多模态语义分割。作者相信本研究可为下一代道路状况评估系统的发展提供实用的指导。
领域最全 | 计算机视觉算法在路面坑洼检测中的应用综述(基于2D图像/3D LiDAR/深度学习)(上)
|
传感器 人工智能 自动驾驶
一文尽览 | 计算机视觉中的鱼眼相机模型及环视感知任务汇总!(上)
环视鱼眼摄像机通常用于自动驾驶中的近距离感知,车辆四面的四个鱼眼摄像头足以覆盖车辆周围的360°范围,捕捉整个近距离区域。一些应用场景包括自动泊车、交通拥堵辅助等
一文尽览 | 计算机视觉中的鱼眼相机模型及环视感知任务汇总!(上)
|
机器学习/深度学习 编解码 人工智能
一文尽览 | 计算机视觉中的鱼眼相机模型及环视感知任务汇总!(下)
环视鱼眼摄像机通常用于自动驾驶中的近距离感知,车辆四面的四个鱼眼摄像头足以覆盖车辆周围的360°范围,捕捉整个近距离区域。一些应用场景包括自动泊车、交通拥堵辅助等
一文尽览 | 计算机视觉中的鱼眼相机模型及环视感知任务汇总!(下)
|
传感器 机器学习/深度学习 资源调度
【目标跟踪】基于拓展卡尔曼滤波实现海上多目标跟踪滤波附matlab代码
【目标跟踪】基于拓展卡尔曼滤波实现海上多目标跟踪滤波附matlab代码
|
机器学习/深度学习 传感器 算法
【目标跟踪】基于扩展卡尔曼滤波器的多机器人定位算法研究附matlab代码
【目标跟踪】基于扩展卡尔曼滤波器的多机器人定位算法研究附matlab代码
|
机器学习/深度学习 传感器 监控
【视频检测】基于计算机视觉实现目标检测附matlab代码
【视频检测】基于计算机视觉实现目标检测附matlab代码

热门文章

最新文章