简体   繁体   English

如何从Oracle VM获取像素颜色

[英]How to get pixel color from oracle VM

I have a script written in Java that takes a pixelcolor with the getPixelColor method from the Java Robot class and compares it with another color to see if they are the same. 我有一个用Java编写的脚本,该脚本使用Java Robot类中的getPixelColor方法获取pixelcolor,并将其与另一种颜色进行比较以查看它们是否相同。 It works fine on my pc, but when i use it in the Oracle VM VirtualBox with a windows 10 installed the pixels always give a white Color. 它在我的电脑上可以正常工作,但是当我在安装了Windows 10的Oracle VM VirtualBox中使用它时,像素始终显示白色。 (HSB 0,0,1). (HSB 0,0,1)。 Is there a way to get the pixel colors from within the vm? 有没有办法从虚拟机内部获取像素颜色? Am i missing a setting or should i change my code? 我是否缺少设置还是应该更改代码?

Here are pictures of the code and results: this is the code that checks if the colors match, with a certain tolerance, it returns a boolean These are the printed results: if all ToCompare values lie between targetplus and targetmin it will return a true 这是代码和结果的图片: 这是检查颜色是否匹配且具有一定公差的代码,它返回布尔值。 这些是打印结果:如果所有ToCompare值都位于targetplus和targetmin之间,则它将返回true。

This is my first question so be gentle :). 这是我的第一个问题,所以请保持温柔:)。

经过更多搜索后,我发现Robot类可以从vm内部获取颜色,我在代码的其他部分犯了一个错误,并且由于多线程(在vm运行在1个线程上的情况),我的功能有些中断)(通过更改虚拟机设置解决)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM