Change of coordinates under resampling operation in itk [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
If i have a large image and i resample it to a smaller size. How can i apply the same transformation to the coordinates in the larger image. Specifically, if I resample an image to a smaller size, what are the new coordinates of the points in the larger image and how can i get them in the new coordinate system. It seems that multiple coordinates in the larger image should get mapped to the same coordinates in the smaller image. But i have no idea how to go about getting the transformed coordinates

It depends on the library you are using. ITK and SimpleITK have two sets of coordinates: physical coordinates which are independent of image details, and index coordinates which depend on image's size and buffered region. Physical coordinates will be the same in both the high-resolution ("big") and low-resolution ("small") image. To get index coordinates from a physical coordinate point p you use imageBig->TransformPhysicalPointToIndex(p) or imageSmall->TransformPhysicalPointToIndex(p).

Related

Finding the top edge of a disk [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 days ago.
Improve this question
I have a stock of photos, of a spinning disk of varying angles. I wish to find the edge of the top of the disk. The top is colored in a distinct black color in comparison to the rest of the photo.
A
B
I first tried using canny edge detection which does a decent job, but also identifies the bottom half of the disk, which I wish to avoid.
Next idea was to use the distinct black color- perhaps by dividing the photo into domains characterized by colors\intensities- and by choosing the largest domain\most black domain or some other parameter, perhaps to isolate that black circle, and only then to use canny edge detector.
Is there any existing function that can divide a greyscale image into domains? Transferring from matlab to python, so I'm new to it's syntax and functions.
Thanks
The Canny disaster goes on !
People playing with image processing keep willing to rely on edge detection when they have beautifully segmenting scenes. With a careful selection of a binarization threshold, you can extract the ellipse as a single piece.

Is there a way to find the speed from analog speedometer? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have an analog speedometer image, with the needle pointing to the current speed. I am trying to find a way to get the speed that the needle is pointing out to. I tried using HoughCircles() from OpenCV, but it is throwing an error as the image contains only speedometer and which is a semi-circle. Any resources to help me move forward will be appreciated.
Assuming the needle will have a different colour to the rest of the speedometer OR its size is distinctly larger than the rest of the elements on the speedometer (which is often the case), I'll do something like below.
Convert the image to grayscale.
Apply colour thresholding (or size-based thresholding) to detect the pixel area representing the needle.
Use HoughLines() or HoughLinesP() functions in OpenCV to fit a line to the shape you detected in Step 2.
Now it's a matter of measuring the angle of the line you generated in Step 3 (example provided here: How can I determine the angle a line found by HoughLines function using OpenCV?)
You can then map the angle of the line to the speed through a simple equation (Will need to see an image of the speedometer to generate this).
let me know how it went.

Removing lower pixel valued connected components from image [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Is there any way to remove the lower pixel valued connected components from the below picture? Like I want the horizontal and vertical lines and small already printed texts removed except the handwritten text.
I want the handwritten text to be extracted like in this image.
Is there any specific library I can use for this purpose?
I was trying Python OpenCV's library to threshold the noise pixels out of the image but that is not giving perfect result.
The image I'm getting after using threshold is this.
If I increase the threshold then it is removing pixels from the handwritten text itself.
Combine the OpenCV methods erode and dilate. They are able to first (erode) get rid of noise and then amplify the main signale (dilate).
You can develop an algorithm based "connected component analysis" to remove undesired connected components. You just need to detect connected components and remove the small ones to extract the desired ones. A case study about it can be found in here and can be helpful for you to develop the solution for your case.

Coordinates of cropped ROI [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have an image and some ROIs (in form of seperate files) cropped from it. I want to find the coordinates of corner points of these ROI in the original image.
Is there a simple way to do this besides checking for all pixel values in the original image ?
Example -
Entire Image
Cropped ROI
I need to find the coordinates of the car in the original image.
If the cropped image isn't rotated or scaled then you can do template matching. Your ROI image will be your template. Check this, This will draw a rectangle over your original image from where you can get the coordinates.
If the crops are exact (i.e. no changes from the original pixels were introduced after cropping, for example as a result of JPG compression when saving), then you could use integral images to speed up the search.
Compute the sum of the pixel values of the cropped images, then the integral image of the original ones, then use the integral image to search for a window of equal size of the crop that has equal sum. This algorithm is, of course, linear time in the size of the original image.
Note that the sum is a "weak" signature, and you may find multiple matches, but you can then verify these candidate matches directly at the pixel level.

How to visualize Image gradient in Python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How to visualize the image gradient of this picture in Python, like the pic above?
Use the Pyton Imaging Library PIL (http://www.pythonware.com/products/pil/)
Load the image using Image.open and read the colors of each pixel into a 2D list using Image.getpixel (http://effbot.org/imagingbook/image.htm). One of the three RGB values will do because the image is grayscale thus the R, B, and G values of each pixel are equal to each other.
Calculate the gradient for each pixel except of those at the edge:
grad[x][y] = [(list[x+1][y]-list[x-1][y])/2.0, (list[x][y+1]-list[x][y-1])/2.0]
(Note that the gradient is a 2D vector. It has an x and a y value.)
Create a quiver plot e.g. with MatPlotLib's PyPlot (https://www.getdatajoy.com/examples/python-plots/vector-fields)
Also check this document where a gradient function from numpy is used: http://elektromagnetisme.no/2011/09/12/calculating-the-gradient-in-python/

Categories

Resources