Android Question Image manipulation advise/help needed

tsteward

Well-Known Member
Licensed User
Longtime User
I have knocked up a quick app to see if I can do it at all first and in principal it works but I need help as I am sure there are far better ways.
Panel 1 is loaded with an image of a key.
Panel 2 is overlayed with lines showing this keys original space and depth.
The idea is for a Locksmith or key cutter to visually decode the key.
Each horizonal line represents a depth from 1 to 4
Each vertical line is a cut position on the key
Scaling the two of them you can eventually get a good match and decode the key.

Is there a better way than resizing the panels. I'm sure there is but haven't played with imaged until now.
Would there be a way to detect the depths I.e count the lines above the key programmatically. I suspect not.

Download demo here

Anyway thoughts or suggestions would be amazing

Thank you
 

Attachments

  • Screenshot_20221008-234703.jpg
    Screenshot_20221008-234703.jpg
    479.8 KB · Views: 150

tsteward

Well-Known Member
Licensed User
Longtime User
I would do it similar to the xResizeAndCrop class.
1. Resize and crop the key background image.
2. Show the resized background image.
3. Resize the overlay with anchors.
Thanks Klaus
I have tried loading xResizeandcrop (which I love by the way thank you)
I created two cropped image panels the second with a transparent background but it seems xResizeandcrop doesn't support transparency

Am I missing something?

download here
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
This is close to a workable example
Grid uses pinch to zoom but will zoom in from original loaded size but not zoom out (make it smaller)

I'm not smart enough to rewrite or write something like xResizeandcrop to have anchors etc so am trying to use your smarts with existing libraries.


download here if interested
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Interesting.

I suppose that the key dimensions are the same.
If yes, I would suggest to use a given width / height ratio for the xResizeAndCrop, pnlCoppedImage.
I replaced the ZoomImageView by an ImageView with same ratio and the same dimensions as pnlCoppedImage, both remain always the same.
And resize and crop the original image to make it fit correctly into the pnlCoppedImage.
I have removed the key.jpg file to make the zip smaller for the forum, you need to add it.

1665314672013.png
 

Attachments

  • keydecode3.zip
    21 KB · Views: 134
Upvote 0
Top