I have images that need to be cropped to perfect passport size photos. I have thousands of images that need to be cropped and straightened automatically like this. If the image is too blur and not able to crop I need it to be copied to the rejected folder. I tried to do using haar cascade but this approach is
Tag: image-processing
How to read image from S3 using OpenCV (cv2.imread)?
I am having trouble reading images from the S3 bucket. I can read images locally like that. But I have no idea why S3 said error Answer You need to first establish a connection to S3, then download the image data, and finally decode the data with OpenCV. For the first bit (connecting to S3), Boto3 is a good a…
1 px thick line cv2
I need to draw a line in an image where no pixel is thicker than 1 pixel in the horizontal dimension. Despite I use thickness=1 in poly lines, in the resulting plot there may be 2 pixels horizontally adjacent set to 255, like in this pic: How can I prevent to have adjacent pixels set to 255? Or equivalently: …
How do I create a checker board pattern?
I am trying to write a code that can generate an checker board pattern. The final image size should be 100 x 100, the checker board size 5 x 5, such that each box has dimensions h/5 and w/5. The code I have is wrong: Answer I know it’s already been answered, here’s a way to loop over it differentl…
Hough Transform for equilateral triangles detection
I have a homework where I have to implement hough transform for equilateral triangles detection: The trianlges edges are of length L, so this means all the trianlges in the image are the same. What did I do? first i used canny edge detector to get the edges in the image. now i have to find a way to parameteri…
How do I merge several 2D arrays into a single 2D array (list) in a box-like manner in python?
Say I have 9 2D arrays in the following format: and I want to concatenate them to get a 2D array like this: where I will have N arrays in my case and I calculate the value of N like so: So essentially, I had an image that was broken down into N tiles and after some processing, I have
cropping an image in a circular way ang paste on another image, using python
I am trying to crop an image in python in circular shape. And I also want to paste that image on the top of another image, and then then then save the image in a desired format. This is the image that I want to crop in circular way This is how the image should be looked like after cropping
How to apply an operation to every PIXEL (not every rgb component!) of a python image (either using numpy, opencv or PIL)?
I’m trying to apply a function over all pixels of an image (in my specific case I want to do some colour approximation per pixel, but I don’t think this is relevant for the problem) in an efficient way. The thing is that I’ve found different approaches to do so, but all of them apply a funct…
Detect rectangles in an image with Python
I have a large collection of binary images like these ones: On each image I need to detect the white rectangle. The rectangles have different dimensions and orientations and sometimes they are interrupted by a black line (see image 2). I think the problem is easy to solve if one could remove the noisy backgro…
How to overlay two non-transparent images in Pillow
I’m trying to make a simple image manipulation function that applies a soviet flag filter to a profile picture. Both pictures are non-transparent. I have some code That would work if either of the images were transparent. However, because my images are not transparent, it just shows the background. Also…