Home From an imageview touch point can you resize a MAT to get that points color?
Reply: 0

From an imageview touch point can you resize a MAT to get that points color?

user1324
1#
user1324 Published in April 24, 2018, 6:28 am

In landscape orientation, I using myImageView.setImageBitmap(myBitmap) and using an ontouch listener to getX and getY and adjust for location of myImageView (same as getRawX and getRawY). I then use bitmapToMat to build a MAT to process the image more with OpenCV. I found two resizing scenarios where the onTouch location will draw a circle exactly where I touched but at times the location will be outside the Mat and cause a NPE and fail during processing.

Scenario 1: resize(myImageView.getWidth(), myImageView.getHeight())

Scenario 2: resize(myImageView.getHeight(), myImageView.getWidth()) and

x = x(myImage.getHeight()/myImageView.getWidth())

y = y(myImage.getWidth()/myImageView.getHeight())

If I dont change the x,y I can click everywhere in image w/o the NPE but the circle drawn is nowhere near where I touched.

After processing I matToBitmap(myMAT, newBitmap) and myImageView.setImageBitmap(newBitmap) .

I am obviously missing something but is there there a simple way to get the touch location and use that location in a MAT? Any help would be awesome!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.312353 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO