I have an image of let say 500 X 500 px, I created tiles/chunks of size (10, 10). Now I want to find out actual chunk coordinate relative to the Original 500X500 px image.

Ex I have first chunk of size (10, 10), the coordinates in this will be liks this

[0, 0][0, 1]..........[0, 10]
[10, 0][10, 1]........[10, 10]

Now for the each coordinate(x, y), How to find out the Actual coordinates in Original Image?

  • By 'Actual coordinates' you mean coordinates in the Coordinate Reference System of your original image? How did you read your original image? Do you have a geotransform? Or an Affine transform? – Loïc Dutrieux Jan 12 '17 at 11:00
  • Yes for your first question. I didn't read my first image because actual size is really large, so here I have mention a example of 500X500. Actually image size is 100000 X 100000 and I created 5000X5000 chunks of my actual image now for each chunk (x, y) pixels i want to find out the value coorespoding to Origin 100000 image. – Anup Panwar Jan 12 '17 at 11:15
  • Is that make sense ? – Anup Panwar Jan 12 '17 at 11:17

I will structure my answer in three parts:

1) Why I am answering this : I was myself looking to find the corresponding pixel of my cropped image.... and looking for the solution I landed on your question, only to realize that it is still unsolved! Hence I am sharing my solution after some brainstorming! Hope it helps !

2) Mistake in question : In the example you stated the chunk size = (10,10) according to this the coordinates will be 0 to 9 on both x and y.. per say x=10 or y=10 will not exist.

3) Solution : Let's say the pixel in main image is X=24,Y=27 i.e. (24,27) = A

Now by simple maths or else Arithmetic Progression we know that it will be part of sub image of size (10,10) starting from X=20, Y=20 i.e. (20,20)=S and ending at X=29, Y=29 i.e. (29,29)=E.

Now in this sub image, coordinates are :

[0, 0][0, 1]..........[0, 9]

[9, 0][9, 1]........[9, 9]

Now in this sub-image we want to find the original-image pixel for x=4, y=7 i.e. (4,7)=a

Thus to go from a(x)(or a(y)) to A(X) (or A(Y)), the relation is as follows:

A(X) = S(X) + a(x) =>> A(X) = 20 + 4 =24

A(Y) = S(Y) + a(y) =>> A(Y) = 20 + 7 =27

Thus , a ---> A is (4,7) ----> (24,27)

The inverse is also true!


All the best!!!

| improve this answer | |
  • try checking out the code here in my thesis and the attached documents... check the linked data.. for me it works as i am using matplot lib and opencv in conjunction for extraction ... the two libraries read the image in opposite directions.. researchgate.net/publication/… – Akanksha Rastogi Jul 4 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.