I have a panoramic one shot lens from here: http://www.0-360.com/ and I wrote a script using the python image library to "unwrap" the image into a panorama. I want to automate this process though, as currently I have to specify the center of the image. Also, getting the radius of the circle would be good too. The input image looks like this:
And the "unwrapped" image looks like this:
So far I have been trying the Hough Circle detection. The issues I have is selecting the correct values to use. Also, sometimes, dark objects near the center circle seem to throw it off.
Other Ideas I had:
Hough Line detection of the unwrapped image. Basically, choose center pixel as center, then unwrap and see if the lines on the top and bottom are straight or "curvy". If not straight, then keep trying with different centers.
Moments/blob detection. Maybe I can find the center blob and find the center of that. The problem is sometimes I get a bright ring in the center of the dark disk as seen in the image above. Also, the issue with dark objects near the center.
Paint the top bevel of the mirror a distinct color like green to make circle detection easier? If I use green and only use the green channel, would the detection be easier?
Whats the best method I should try and use to get the center of this image and possibly the radius of the outer and inner rings.
As your image have multiple circle with common centre you can move that way, like
Detect circle with Hough circle and consider circle with common centre.
Now check the ratio for co-centred circle, as your image keep that ratio constant.
I guess don't make it too fancy. The black center is at the center of the image, right? Cut a square ROI close to the image center and look for 'black' region there. Store all the 'black' pixel locations and find their center. You may consider using CMYK color space for detecting the black region.
Related
I've got the following image:
I want to fill in the black hole and make it white. How can I fill in this hole?
Thank you
You could floodfill with white starting at the top-left corner, which will leave you with this - which should allow you to locate the "hole".
I have bordered artificially with red so you can see the extent of the image.
apply this method Anyone knows an algorithm for finding "shapes" in 2d arrays?
Images are basically arrays and you can apply this algorithm with little bit modification in order to find holes and set every black pixel in closed shape and set blacks to white
I want to find the exact center of these attached images. The things I've tried:
1- HoughCircles, but it didn't work because it's not a perfect circle...
2- Thresholded the picture, so it's all black and white -> contour -> center of contour. This doesn't work on both of these images. It gives a center which isn't correct.
Does one of you know another approach I can try?
EDIT: In the first image, you can see why just taking the center with the contour doesn't work. It's not perfectly in the center of the 'circle'
EDIT2: The definition of the center can be seen in the second image where the circle touches all the 'sides' at the same moment
Thanks,
Try the following:
Threshold the image using the OTSU-Method (which will leave you with a binary image, where only the middle section should be kept. Maybe you have to modify the actual threshold value a little bit)
On the thresholded image find the center using image moments (see e.g. https://docs.opencv.org/3.4/d0/d49/tutorial_moments.html)
This assumes, that the middle section will always be brighter in comparison to the area outside.
One way you could try:
Find corners
Clean up outliers
Average their locations
I expect that to be quite in the center.
If not, please define the question more precisely.
I have an image containing a bunch of circular features. I'd like to know exactly the exact location of the centre of a particular circle and its radius (preferably with sub-pixel accuracy).
Rather than using a circle detector, which will try to find all of the circles, is there a method in OpenCV for fitting a circle to the image? Like this:
Update:
I have tried using the Hough circle detection method, and it seems to get confused about whether the circle should be on the inside or outside edge of the black line. The circle jumps around between the inside and outside edges, or sometimes tries to do both.
All I can think of now is, if you know the approximate centre and radius, search for all the circles and use least fitting squares with the circle equation to find the one you are looking for.
We have a scanned white page - A4 size that contains multiple thumbnails.
The thumbnails are similar but not exactly the same.
The thumbnails can be in random order and not in a very clear rows and columns. They are not totally random but they are in rows, however these are not a very accurate rows.
A4 page background color is white.
All thumbnails have black border of 5px and border-radius of 10 px
Everyone of the thumbnails contains a green circle (Could be in the center or somewhere close to that).
1. How can we detect the Hard Edges of every thumbnail and store the coordinates so we can crop the thumbnails for later processing and analyzing colors?
2. How can we detect the circle in the center. We want to analyze and get all pixels RGB values contained into this circle and then calculate average RGB value.
Update
This is the image:
Thank you
Main idea: As there are enough blank between the regions, so just crop each region by contours. Then for each region, use houghCircle to detect the circle in it.
Your image is this:
After find external contours and calculate the bounding boxes:
For each contour, crop and find hough circle in it.
Notice: I'll not provide my code for this question.
But post some links maybe useful for you. Learn and do by yourself:
Copy shape to blank canvas (OpenCV, Python)
cv2.drawContours() - unfill circles inside characters (Python, OpenCV)
How to detect colored patches in an image using OpenCV?
Edge detection on colored background using OpenCV
How can I get the minimum enclosing circle with OPENCV?
How can I prepare circle path text image for OCR program?
Update:
To detect the circle, you should select the right parameters, depends on your source image.
Try! Try! TRY!
Here is the circle detection I tried:
circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT,
dp=1, minDist=20, circles=None,
param1=200 , param2=50,
minRadius=120, maxRadius=150
)
Its my first time to use python code to display ds9 images.I just display black and white image but I wanted to get a color image with two or more slit positioned on the image which passes at the center,plus the position angle and coordinates should not be manually typed coz I have many images.I expect something like this.As you see the slits are not at the center I need them all at the center but they are at different angle.I need your help as usual,thanks!