Mark Read Well-Known Member Licensed User Longtime User Jan 13, 2015 #1 Is it possible to get the pixel information, RGB values etc from the screen directly without making a screenshot and reading the bitmap? I found this java code which seems to do the job but cannot convert it to ba4. Code: public static Color getColorAt(int x, int y){ return new Robot().getPixelColor(x, y); } Can anyone help or is this possible?
Is it possible to get the pixel information, RGB values etc from the screen directly without making a screenshot and reading the bitmap? I found this java code which seems to do the job but cannot convert it to ba4. Code: public static Color getColorAt(int x, int y){ return new Robot().getPixelColor(x, y); } Can anyone help or is this possible?
Erel B4X founder Staff member Licensed User Longtime User Jan 13, 2015 #2 This Java code will not run on Android. Upvote 0
Mark Read Well-Known Member Licensed User Longtime User Jan 13, 2015 #3 Thank you for the rather short reply Erel. Is there another way? Upvote 0
DonManfred Expert Licensed User Longtime User Jan 13, 2015 #4 Make a Screenshot and geht the pixel fron this imahe Upvote 0
Mark Read Well-Known Member Licensed User Longtime User Jan 13, 2015 #5 Thanks Manfred, that is what I am doing at present and its works but slowly. I have also found that a screenshot is device dependent ie. The pixel information for the same point on my mobile is not the same as on my tablet (the RGB values are different). I am working on a way to calibrate the system but I had hoped for a more direct approach, reading the screen in the hope that this problem would be fixed. I am not even sure why there is a difference in the bitmaps. I have probably overlooked something. Upvote 0
Thanks Manfred, that is what I am doing at present and its works but slowly. I have also found that a screenshot is device dependent ie. The pixel information for the same point on my mobile is not the same as on my tablet (the RGB values are different). I am working on a way to calibrate the system but I had hoped for a more direct approach, reading the screen in the hope that this problem would be fixed. I am not even sure why there is a difference in the bitmaps. I have probably overlooked something.
DonManfred Expert Licensed User Longtime User Jan 13, 2015 #6 The speed depends on the amount of pixel which have to be processed (size of image). Sorry, i have no other suggestion Upvote 0
The speed depends on the amount of pixel which have to be processed (size of image). Sorry, i have no other suggestion
Mark Read Well-Known Member Licensed User Longtime User Jan 13, 2015 #7 How very true. At present, the App is designed for a 10" tablet with resolution 1200 x 800 (roughly) and have to process up to 500 pixels at semi-random positions. I can find no way to speed this up. I had wondered about using a class or a thread but that is beyond my knowledge at present and I am not sure if it would even help. Upvote 0
How very true. At present, the App is designed for a 10" tablet with resolution 1200 x 800 (roughly) and have to process up to 500 pixels at semi-random positions. I can find no way to speed this up. I had wondered about using a class or a thread but that is beyond my knowledge at present and I am not sure if it would even help.
Cableguy Expert Licensed User Longtime User Jan 13, 2015 #8 Would it be quicker to first establish witch pixel(s) you want to verify and then capture only that pixel instead of the hole screen? Upvote 0
Would it be quicker to first establish witch pixel(s) you want to verify and then capture only that pixel instead of the hole screen?
Mark Read Well-Known Member Licensed User Longtime User Jan 13, 2015 #9 Unfortunately not, as I am calculating a route between two pixel points (eg. top left to bottom right along a river) and they can be anywhere on the screen. Upvote 0
Unfortunately not, as I am calculating a route between two pixel points (eg. top left to bottom right along a river) and they can be anywhere on the screen.
NeoTechni Well-Known Member Licensed User Longtime User Jan 13, 2015 #10 It'd be possible if it was your app it was getting it from, not the screen itself. Then you'd just get it from the canvas Upvote 0
It'd be possible if it was your app it was getting it from, not the screen itself. Then you'd just get it from the canvas
Mark Read Well-Known Member Licensed User Longtime User Jan 14, 2015 #11 @NeoTechni: Now I am curious. It is my app. I am using OSMdroid and have a map on the screen. Using overlays and the touch event, I generate two markers. Then I calculate the route between these two markers. I know the exact position of the markers. How does a canvas help me here? Upvote 0
@NeoTechni: Now I am curious. It is my app. I am using OSMdroid and have a map on the screen. Using overlays and the touch event, I generate two markers. Then I calculate the route between these two markers. I know the exact position of the markers. How does a canvas help me here?