0

每当我尝试处理两个图像的色差时,都会出现空指针异常。代码是

MarvinImageIO.saveImage(currentFrame, "check1.jpg");
                MarvinImageIO.saveImage(template, "check2.jpg");

                currentFrame=MarvinImageIO.loadImage("check1.jpg");
                template=MarvinImageIO.loadImage("check2.jpg");
 //                 System.out.println(currentFrame.getWidth()+"        "+currentFrame.getHeight()+"      "+template.getWidth()+"   "+template.getHeight());

                scale(currentFrame, template, template.getWidth(),    template.getHeight());

                MarvinImagePlugin diff =       MarvinPluginLoader.loadImagePlugin("org.marvinproject.image.difference.differenc     eColor.jar");
                MarvinAttributes attr = new MarvinAttributes();
                attr.set("total", 0);


                System.out.println(attr.get("total"));
                diff.process(currentFrame, template,attr);

错误在 diff.process 语句上。图像不为空,attr 也是如此。

错误陈述是

Exception in thread "Thread-3" java.lang.NullPointerException
at org.marvinproject.image.difference.differenceColor.DifferenceColor.process(DifferenceColor.java:67)
at marvin.plugin.MarvinAbstractImagePlugin.process(MarvinAbstractImagePlugin.java:65)
at censor_player.player$MyThread.run(player.java:142)
4

0 回答 0