Deleting unwanted area of image using python - python

I am trying to do iris segmentation using python. After doing some thresholding, in this process I want to get the black circle area (which is pupil) in the image that I attached, is there any process or method that I can get only the black circle area from the image? Eyes Image that already thresholded
This is the original image
Original Image

Related

Crop an image around an object in Python

I have for example Example image where the object of interest is white and the rest of the image is black.
Is there any way to crop the image in python so that all that is left is a rectangle that has the white mask in it?
The end result should look something like this: Cropped image

How to convert white background pixels into black in an image using OpenCV, Python?

I have some cropped images and i also applied otsu thresholding on it. Now, i want to convert white pixels that are in the background into black pixels
Need solution to solve this problem.

creating a transparent overlay using OpenCV in python

So I have two images, one is a white image with a blurred spot and other is a image of a street(taken from KITTI dataset). I want to blend both the white image with blurred spot and street image such that the whiteness doesnt appear while blending.\
In the first image below, you can see a translucent gray spot. This I achieved by making a copy of the street image and then drawing a circle on it using cv2.circle function. This i blended it back with the original image and controlled the transparency of the circle.
In place of the circular spot, I want the blurred spot in the white image to appear with transparency. How can this be achieved?
When i do normal blending the white shade also appears. I tried converting into RGBA image and then blending but didnt work. Any idea how this could be achieved?

Python - How to detect hard edges of multiple thumbnails and save the coordinates?

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
)

Copying a non rectangular ROI from an image and use the ROI in other image in same points

I have been trying to crop a non rectangular ROI from an image and use that ROI in the other image.
Case: I am using perspective transformation to an image and writing it in the file. And now I want to copy the certain non rectangular ROI of transformed image and paste it on the other image with same ROI. As of now both the images are of similar sizes.
Images are manually updated.

Categories

Resources