pnn 0 Posted May 11, 2017 I want to locate a particular point in the world space on an image that is saved from Arma3. I have converted the coordinates from worldspace to screenspace using worldToScreen. I also have the image saved using screenshot. How do I transform the co-ordinates from Screenspace to pixel coordinates of the image? Share this post Link to post Share on other sites
pierremgi 4736 Posted May 11, 2017 Perhaps with some commands like this one: https://community.bistudio.com/wiki/pixelGrid Share this post Link to post Share on other sites
Larrow 2779 Posted May 12, 2017 Can you explain further? Its not clear on where this picture is. Is it a picture ctrl OR just an image in say Gimp that you want to know the position? As I do not understand why you convert worldSpace to screenSpace. Picture ctrl that holds full image of say Stratis.. _h = [] spawn { disableSerialization; _display = ( call BIS_fnc_displayMission ) createDisplay "RscDisplayEmpty"; _picCtrl = _display ctrlCreate [ "RscPicture", 100 ]; _picCtrl ctrlSetPosition [ 0, 0, 1, 1 ]; _picCtrl ctrlSetText "\a3\map_stratis\data\picturemap_ca.paa"; _picCtrl ctrlCommit 0; ctrlPosition _picCtrl params[ "_picX", "_picY", "_picW", "_picH" ]; getPosATL player params[ "_posX", "_posY" ]; _picPosX = linearConversion[ 0, worldSize, _posX, _picX, _picX + _picW ]; _picPosY = _picH - linearConversion[ 0, worldSize, _posY, _picY, _picY + _picH ]; _pixelPosX = ( floor( _picPosX / pixelW )) * pixelW; _pixelPosY = ( floor( _picPosY / pixelH )) * pixelH; _ctrl = _display ctrlCreate [ "RscPicture", 101 ]; _ctrl ctrlSetPosition[ _pixelPosX - pixelW, _pixelPosY - pixelH, pixelW *3, pixelH *3 ]; _ctrl ctrlSetText "#(rgb,8,8,3)color(1,0,0,1)"; _ctrl ctrlCommit 0; }; Just run from the debug console while in a Stratis preview mission and look for the tiny red dot of where you are. If it is not a picture ctrl then the math is nearly the same, just your picture dimensions rather than the picture ctrl size, as long as your picture is an accurate representation to the dimensions of worldSize. _picDimension = [ 2048, 2048 ]; _picDimension params[ "_picX", "_picY" ]; getPosATL player params[ "_posX", "_posY" ]; _posX = floor linearConversion[ 0, worldSize, _posX, 0, _picX ]; _posY = floor ( _picY - linearConversion[ 0, worldSize, _posY, 0, _picY ] ); Share this post Link to post Share on other sites
pnn 0 Posted May 14, 2017 @Larrow, Sorry I just saw your reply This is the script I'm trying to get to work. I don't have to use screenshot (as long as I can save images) _screenPos = worldToScreen position pickup_truck; _screenX = _screenPos select 0; _screenY = _screenPos select 1; _myX = (_screenX - safeZoneXAbs) / (safeZoneWAbs); _myY = (_screenY - safeZoneY) / (safeZoneH); diag_log format [ "X: %1 Y: %2", round (_myX * (getResolution select 0)), round (_myY * (getResolution select 1)) ]; Now when I look at the Image( testFile.png) at pixel location (_myX,_myY) I dont see the truck. The truck is at around (421,612) but the output I get from the script is (619,542). https://www.dropbox.com/s/fgbdo1156k8ci3p/testFile.png?dl=0 Any leads as to why this is happening will be highly appreciated. Thanks, -P Share this post Link to post Share on other sites
pnn 0 Posted May 14, 2017 @pierremgi This is the script I'm trying to get to work. I don't have to use screenshot (as long as I can save images) _screenPos = worldToScreen position pickup_truck; _screenX = _screenPos select 0; _screenY = _screenPos select 1; _myX = (_screenX - safeZoneXAbs) / (safeZoneWAbs); _myY = (_screenY - safeZoneY) / (safeZoneH); diag_log format [ "X: %1 Y: %2", round (_myX * (getResolution select 0)), round (_myY * (getResolution select 1)) ]; Now when I look at the Image( testFile.png) at pixel location (_myX,_myY) I dont see the truck. The truck is at around (421,612) but the output I get from the script is (619,542). https://www.dropbox.com/s/fgbdo1156k8ci3p/testFile.png?dl=0 Any leads as to why this is happening will be highly appreciated. Thanks, -P Share this post Link to post Share on other sites