Convert local coordinates to pixel values in python - python

I have a dataset that contains local coordinates of tracking cars, and I have an image related to my dataset, I would like to plot my track on the image, but the coordinate systems are not matched. I also know the value of each pixel in the meter ( ortho pixel to the meter ), but I do not know how to convert my coordinates to the pixel value. Can anyone know how can I do it? if there are some sources or sample codes please introduce me, as I was searching and couldn't find anything. I am new in this area, so if someone explains from the scratch what should I do?
Thank you
I tried using imshow to open my image, but as I need to convert my coordinates to pixel values and don't know how to do it, I couldn't implement my figure completely.

Related

Detecting B&W Clusters of Pixels

I am relatively new to Python and would like some help with some ideas to solve this problem...
I have a black and white image as so:
black image with white dots
And essentially need to get the midpoint (or honestly any point, as long as it's consistent across all of the dots) of each of those white dots. The program could spit out a list of coordinate points for each of those dots.
I am doing this because I want to have a list of the distances of each dot from its place to the bottom of the image. I said getting the mid-point doesn't matter, it could be any point as long as it's consistent across the dots because I am comparing the values of one image to the values of another that would be measured in the same way.
I had tried to split the image into rows and then count the number of pixels in each row, but that felt like it was limiting and wouldn't really do the best job.
I was thinking to maybe make a loop that looks at one pixel and then checks to see the pixels around it until it reaches the edge or something like that, but it seems like that would take a lot of computing power even with B&W as I have to run this through hundreds of images that have approximately 10 million pixels.
Possibly a solution related to converting the coordinates of the image into a graph and performing cluster analysis?
If you have a binary image, then I think that using skimage to label then get region properties. I think that this tutorial should get you moving on the take you are hoping to accomplish:
https://scikit-image.org/docs/stable/auto_examples/segmentation/plot_regionprops.html

What does the no_auto_scale parameter mean in rawpy?

I am currently trying to work on a raw image and I would like apply very little processing. I am trying to understand what the no_auto_scale parameter in rawpy.postprocessrawpy.Params is. I don't understand what disabling pixel value scaling does. Could anyone help me please ?
My ultimate goal is to load the Bayer matrix with the colors scaled to balance out the sensitivity of each color sensor. So every pixel in the final image will correspond to a different color depending on where it is in the Bayer pattern but they will all be on a similar scale.

edge detection of an image and saving cells of a grid

picture example
I have recently started learning Python with Spyder IDE and I'm a bit lost so I ask for advice.
The thing is that I need to program an algorithm that, given a random image representing a board with black spots in it (in the picture I upload It is a 4x5 board) so It recognizes the edges properly and draw a AxB grid on it. I also need to save each cell separately so as to work with them.
I know that open CV treat images and I have even tried auto_canny but I don't really know how to solve this problem. Can anybody give me some indications please?
as I understand from your question you need to have as an output the grid of the matrix in your picture (eg. 4x3) and each cell as separate image.
This is the way I would approach this problem:
Use canny + corner detection to get the intersection of the lines
With the coordinates of the corners you can form your regions of interest, crop each individually and save it as a new image
For the grid you can check the X's and the Y's of the coordinates, for example you will have something like: ((50, 30), (50,35),(50,40)) and from this you can tell that there are 3 points on the horizontal axis. I would encourage you to set a error margin as the points might not be all on the same coordinate, but may not differ a lot.
Good luck!

Convert Latitude Longitude to IMG Pixel Values Python

I'm working on a project that involves reading colored data from an image (I'll attach somewhere). The input needs to be in longitude latitude. It is important that I find a way to convert these coordinates to pixels in the image. I have been contemplating this issue a lot and no great solutions are popping in mind. Unfortunately, the raw data used to construct the image is not released. Any ideas? :)Image I need to find color values for
Edit: A problem here is that these images curve the earth so the latitude lines are not parallel lines. They have a curve.
One way that might work depending on your image is to use something similar to http://www.lat-long.com/ ,using Google maps to find a point. You will have to scale the image from google maps and overlay it on top of your image, and get the pixel value. You should be able to request an image with the proper level of zoom. The good news is that, since your image is static, you can hardcode the zoom level.

how to count point which based on projection of a set of coordinates

I have some data about a set of coordinates, like {(x=1, y=2), (x=3, y=4), ...}. I projected these coordinates on the picture. Then I would like to count these point in different position. My idea is below
First, separate the picture from several pixel parts based on 10 pixels.
Second, count the point inside the pixel box.
I am new in these area, and I use python a lot. I think this may be computer graphic problem.
I am not asking for a code solution. I just want to know which libraries or approaches that are related.
Anyone could give me a hint would be highly appreciated. Thanks.
Sure, your approach seems fine. You simply want to count the number of pixels in different image regions that you placed, correct?
I answered a question recently (with Python) that was giving an indication if there was a black pixel inside an image region. It could be easily modified to count pixels instead of simply finding one. Check it out here and modify your question or post a new one if you have code problems working it out.

Categories