Fitting a 2d Gaussian with data points on python - image-processing

I have an 2048x2048 image/array with some blobs and I try to fit a 2D gaussian on each blob to find its width. Image with blob
I know the position of the blobs, their intensity and an approximation of the blob rays.
What can I do?
All the codes that I found need the gaussin width...
thanks

Related

PCA for ellipse fitting

I have a depth video stream (grayscale) of a pen and pen-like objects. Since they are mostly of an ellipse shape, I want to fit an ellipse using PCA and get real-time output of ellipse angles.
The final goal is to estimate object(ellipse) orientation with respect x-y coordinate system.
Here are the image samples:
Depth Image
I have read this paper on using PCA for ellipse fitting but I am not sure how to apply it.

Calibration for cropped stereo pairs

I have a stereo image pair of say 100x100 resolution. I did calibration and I am able to rectify it properly and calculate disparity for the same. Now I have the cropped image of size 50x50 with ROI based on center. If I have to use the same calibration matrices, what should I do? Rescaling the principle point in camera matrix is enough or do we need to do anything else?

Get Bounding Polygon from contour images

I have a dataset of contour images.
In my dataset, each image contain SINGLE object (on black background) which corresponds to a contour-image (i.e. image corresponding to a particular detected contour earlier), retrieved earlier.
I just have these images, and no other contour information.
I need to get contour polygon (height, width, polygon coordinates) for each image so that I can use this dataset for training in Tensorflow models.
Will running cv2.findContours() make sense (as each image is already a single contour) or is there another faster way to extract the bounding polygon from the contour images ?
Thank you so much in advance.

Get (inner edge) contour pixel with opencv

I'm searching for a way to extract the "inner" contours of a binary image with opencv. I know that findContours extracts contours but I need the silhouette pixel which belong to the thresholded object in my binary image and not the outer contours.
Here is a fictive image which describes better what I'm searching for. I am searching for a method to extract the red contour.
I already tried a naive approach in copying the original binary image and shrinking the copy by 2 pixels each side and filling up the edges with black pixels and used findContoursbut the outcome is not satisfying.
You could just run findContours() on the negative image.
Little update:
I solved it with opencv erosion and dilatation.

Creating contour and then perform pixel analysis (OpenCV)

If I have an RGB image and a binary mask (1 channel), and I want to create contours for the RGB image based on the connected pixels of the binary mask. After that I want to compare the pixel values (e.g. check if each pixel in the contours is having a blue value > 150), then how can I implement the above by using OpenCV?
Thanks a lot!
Assuming the images are the same size and shape then simply scan over the pixels in the binary image looking for the contours and check the pixel values at the same row/col in the color image
See Fastest way to extract individual pixel data? for details

Resources