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 8 years ago.
Improve this question
I'm looking for a algorithm (pseudocode is ok, or any readable sourcecode, implementation is prob. in Python) to recognise a partial beam/perspective rectangle on a low res image, and give the angle from horizontal. The algoritm should be realtime 30hz fast so pref analytic or convex optimization. And most importantly robust. The beam can be in any orientation and the width can vary, but the angle should be able to be estmated sub degree. Robustness is the priority.
For now lets assume there is at least some beam visible. But in application the beam could be partially occluded.
Here is a sample of some example data with true angle 78.8253 degree (its binary data with noise)
I've tried a gaussian blur, than a treshold, and than OLS in u-v image coordinates. This is a beginning, but not the way to go. The cut-off corners and edges biasses the angle.
Does anyone know of a good robust and fast way to do this? Thanks
edit 1. Hough Transform
Applying a Hough Transform after gausian blur+treshold and averaging the top 5 peaks in the transform. This is a big improvement! but still it seems biassed by the assymetry in the cutoff. Are there any candidates that take this cut-away into account?
Related
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 last year.
Improve this question
Hi I am a student doing research in my university. This is my first time using computer vision (openCV) and I am fairly new to image preprocessing. I have these images of License Plates and I would like to use easyOCR/pytesseract to read the plates. Currently all I have done is convert the image to grayscale, rotate it by a few degrees, but the reading results are very inconsistent. How do I improve that?
I have tried using kernels to sharpen the images but they seem to be fairly inconsistent too.
Here are some images I have to give you a general idea of what the images are like:
I would start with image enhancement. It's hard to tell what exactly is applicable but here are some possible manuevers:
As usual recognition algorithms are not invariant to rotation. And every image seems to be geometically distorted similarly. You can try to normalize the geometry by warpPerspective function from Opencv with appropriate transformation matrix. Rotation is a subset of all possible transformations covered by perspective transform.
You can try to use advanced deblurring techniques like wiener filter or deeplearning. It seems like point spread function is different from image to image that complecates the recovery.
There is some periodic signal in your images (vertical blue-white-blue stripes). That can possibly can be enhanced by doing FFT -> removing components of the specific wavelength -> iFFT.
Anyway looking on your images, I am not sure if it will be easy to achieve the desired result without diving into the OCR pipeline.
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
How can I programmatically dilate the contour of a given shape? Currently, I'm able to find and draw the contour of a shape using python+openCV, but I want to draw an offset to the contour of the shape in a raster image (like in the image below).
By offset, meaning expanding or minimizing the original shape, not just scaling it. The following is an example of that result:
Based on your sketch you don't seem to be interested in just scaling up the original contour. So I guess the simplest way to approach this is morphological region growing. With the help of dilation you can expand the region of your original contour in the image domain and then recover the newly created contour.
Have a look at this implementation
Scale contours up/grow outward
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
I want to detect the color of the tractors (in trucks). I trained a model to detect the tractor part as ROI(Regio of interest). I detect ROI by drawing a rectangle around the tractor.
my question is how can I detect the color of cab/tractor? I need the method to be robust to lighting conditions and weather differential.
example of the truck can be found here
the perspective view makes the problem challenging since the ROI is a rectangle, part of the background gets into the ROI.
Edited: I use kmeans and put the number of clusters= 2, for the following image
[![enter image description here][1]][1]
it outputs this color
It seems as if conventional image processing techniques are not robust enough.
Could you please tell me what method would be more accurate?
You could try Color Quantization on the rectangle. This will try to reduce the number of colors to a palette that could still accurately represent the image. The usual algorithms return them sorted by most dominant color.
Hopefully there is more truck than background in the rectangle. You could also crop in a margin of the rectangle if you think truck is usually centered in the rectangle.
Here's an example using python and scikit: https://scikit-learn.org/stable/auto_examples/cluster/plot_color_quantization.html
You should use a very small number (4?) of colors in the expected palette.
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 4 years ago.
Improve this question
I have a set of images. I have to use them for training a network. I want to simulate a lens flare effect and chromatic aberration on the images. I have tried to find some function in OpenCV, scikit and other python image library but no help from there. How can i simulate these effect on my image? Rough idea or code will be useful. Images are in jpg format.
Depends on what kind of lens flare you are trying to achieve. Create e.g. hexagon mask and overlay multiple instances of it partially transparently between start and end point of the flare axis? Hexagons should be at least slightly bigger "in sun's direction" and spaced more or less in equal distance compared to each others. User should be able to click start and end points of said axis from the pic and use e.g. mouse to rotate, zoom in/out the axis and define number of flare elements to be added.
For chromatic aberration, I would split the RGB components, apply slightly different scaling factors, and merge back. Depending on whether you want to simulate a flint or crown effect, the factors will be increasing or decreasing.
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 4 years ago.
Improve this question
Hi and thanks for noticing my problem! Currently I have a reqiurement to adjust the input videostream by making it "frontal".
Here is the DESIRED frontal image
Here is the ACTUAL frame images from the input videostream
The algorithm required, to my knowledge, should include basic location adjustment or even modeling, and some of the image information won't find a corresponding position in the new frame. However, it's rather difficult to design such an angle-removing algorithm on my own, and I failed to find any reference on Github. So can you offer me some algorithm that I can turn to or some clue? And is it also possible to "add an angle" on a frontal image?
Much thanks! I really prefer python though the language suffers heavy "computational complexity" problem in this case.
The image must undergo a so-called homographic transform,
X = (a x + b y + c) / (g x + h y + 1)
Y = (d x + e y + f) / (g x + h y + 1)
This transform will map for instance the four corners of the screen in the input stream to four points in the destination image that form a rectangle with the correct aspect ratio.
Knowing the four correspondences between the corners, you establish a system of 8 equations in 8 unknowns, which can be written in a linear form.
Equipped with this transformation, you scan the destination image and for every pixel find the corresponding one in the source image, and copy the RGB values.
This is good enough for a low quality transform. To avoid jaggies, you can use a bilinear interpolation between the four neighboring pixels in the source.
Have a look here: https://docs.opencv.org/3.4.1/d9/dab/tutorial_homography.html
If you want to find the screen corners automatically, this is a whole other story.