Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Find location of touch on image in view

 
Rancher
Posts: 3714
34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an WebView that loads a jpg image from a simple HTTP server on my PC.  The image is a screen capture of a section of the screen.
The WebView component loads and displays the image without any problem.  If I press on the shown image I get the x,y of the location of the press on the view.  SO far so good.  If I zoom in by outward pinches, the image is enlarged and now the x,y of the view is not the same as the x,y on the image.
If I had the size of the enlarged image and the x,y location of the view on the image, I could compute the x,y of the touch on the image.
There is the problem:  How to get the location of the view on the expanded image and the size of the expanded image?

Also posted Here:  https://stackoverflow.com/questions/61761544/find-location-of-touch-on-image-in-view
 
Norm Radder
Rancher
Posts: 3714
34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since most of you like to see code with questions and in a hope of getting a response to this question, here is what I have so far.   It works if the image size is adjusted to be the same size asthe view shown in the tablet.
 
Norm Radder
Rancher
Posts: 3714
34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the PC code that communicates with the Android.  It has a lot of Q&D code for testing and debugging.   A lot was Cut and Pasted from other programs so its a bit messy.  Currently mostly working.
 
They weren't very bright, but they were very, very big. Ad contrast:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic