0

Currently faced with this challenge of mapping the pixel data I have gotten from an image to the actual X,Y coordinate in a WGS84 system

Currently using Python script to do this - but I am relatively new with it so I may be missing some stuff here >.<

I have a black-white image created using Canny edge detection till it's only white lines outlining the image.

Now I need to convert this black-white 'outline' image

into a txt file and convert those pixels into the equivalent WGS84 of the actual outdoors.

The original image is a snapshot of the top down view of point cloud data in X,Y,Z

I am able to get the original mincoord(X1,Y2) and maxcoord (X2,Y2) of the WGS84 of the original image.

Before:

InitialGreyImage

After:

EdgeDetection

Save pixel data in txt format in PIL

from PIL import Image  

im = Image.open("outdoor.jpg")
fil = open('file', 'w')
pixel = im.load()
row, column = im.size
for y in range(column):
    for x in range(row):
        pixel = pix[x, y]
        fil.write(str(pixel) + '\n')
fil.close()
  

How could I do this mapping from the 'local' pixel data to the 'global' WGS84 coordinate equivalent and write it to a txt file with the X Y coordinates?

Thank you and all help is always appreciated :)

Megan Darcy
  • 530
  • 5
  • 15
  • You say you were "able to get the original mincoord(X1,Y2) and maxcoord (X2,Y2)" — what does that mean exactly? What are these values? – martineau May 30 '21 at 16:45
  • @martineau So using cloud compare, I can get the points in the cloud using the point picking function. So eg the extreme right uppermost point (edge of first Point cloud) is X = 210.5,Y = 143.9 – Megan Darcy May 31 '21 at 07:47
  • It sounds like you simply have to linearly interpolate pixel locations to positions within the image into correspond one within the cloud boundaries. i.e. so pixel (0, 0) maps to cloud (min x, min y) and pixel (width-1, height-1) to cloud (max x, max y). – martineau May 31 '21 at 08:59

0 Answers0