Python: Removing vertical and horizontal lines in google vision api [closed] - python

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 3 years ago.
Improve this question
I am trying to extract handwritten text from:
using https://cloud.google.com/vision/docs/handwriting
Without using any third party technology, is there any option in Google vision API to remove vertical and horizontal lines from the image before extracting the text?

Hahaha I literally did the exact same thing like 2 months ago.
No, the Vision API can't do this.
Here's how I did it:
1) create an image object with the Python PILLOW library.
2) Get the matrix representation of the image.
3) binarise the matrix.
4) Loop through it line by line and row by row. When you encounter a black pixel, start a counter. If you encounter a white pixel, reset the counter. If the counter goes higher than some high number, conclude that it is a line.
5) Change the black pixels in the line to white pixels.
6) Use Pillow to get a PNG back again.

Related

Finding the top edge of a disk [closed]

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 5 days ago.
Improve this question
I have a stock of photos, of a spinning disk of varying angles. I wish to find the edge of the top of the disk. The top is colored in a distinct black color in comparison to the rest of the photo.
A
B
I first tried using canny edge detection which does a decent job, but also identifies the bottom half of the disk, which I wish to avoid.
Next idea was to use the distinct black color- perhaps by dividing the photo into domains characterized by colors\intensities- and by choosing the largest domain\most black domain or some other parameter, perhaps to isolate that black circle, and only then to use canny edge detector.
Is there any existing function that can divide a greyscale image into domains? Transferring from matlab to python, so I'm new to it's syntax and functions.
Thanks
The Canny disaster goes on !
People playing with image processing keep willing to rely on edge detection when they have beautifully segmenting scenes. With a careful selection of a binarization threshold, you can extract the ellipse as a single piece.

Is there a way to find the speed from analog speedometer? [closed]

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
I have an analog speedometer image, with the needle pointing to the current speed. I am trying to find a way to get the speed that the needle is pointing out to. I tried using HoughCircles() from OpenCV, but it is throwing an error as the image contains only speedometer and which is a semi-circle. Any resources to help me move forward will be appreciated.
Assuming the needle will have a different colour to the rest of the speedometer OR its size is distinctly larger than the rest of the elements on the speedometer (which is often the case), I'll do something like below.
Convert the image to grayscale.
Apply colour thresholding (or size-based thresholding) to detect the pixel area representing the needle.
Use HoughLines() or HoughLinesP() functions in OpenCV to fit a line to the shape you detected in Step 2.
Now it's a matter of measuring the angle of the line you generated in Step 3 (example provided here: How can I determine the angle a line found by HoughLines function using OpenCV?)
You can then map the angle of the line to the speed through a simple equation (Will need to see an image of the speedometer to generate this).
let me know how it went.

Want to get a part of a image [closed]

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 am making google's t-rex runner game. So I got a .png file which contains all the fonts, picuters of the t-rex, etc. So I am now having problem in getting a part of the image. Here is the image:
Is there anyway in which I can get a part of the image. I am using python, pygame.
Assuming you know what a Rect and Surface is, here is a way to do it:
def image_at(png, rectangle): # rectangle would be the section you want in the png
rect = pygame.Rect(rectangle)
image = pygame.Surface(rect.size)
image.blit(png, (0, 0), rect)
return image
(inspired by https://www.pygame.org/wiki/Spritesheet which could be exactly what you were looking for)
Basically you create a surface with the dimensions of your desired section of the png, they you draw (blit) the whole png on your created surface, and that will show only the part you selected throught your rectangle.

Removing lower pixel valued connected components from image [closed]

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 3 years ago.
Improve this question
Is there any way to remove the lower pixel valued connected components from the below picture? Like I want the horizontal and vertical lines and small already printed texts removed except the handwritten text.
I want the handwritten text to be extracted like in this image.
Is there any specific library I can use for this purpose?
I was trying Python OpenCV's library to threshold the noise pixels out of the image but that is not giving perfect result.
The image I'm getting after using threshold is this.
If I increase the threshold then it is removing pixels from the handwritten text itself.
Combine the OpenCV methods erode and dilate. They are able to first (erode) get rid of noise and then amplify the main signale (dilate).
You can develop an algorithm based "connected component analysis" to remove undesired connected components. You just need to detect connected components and remove the small ones to extract the desired ones. A case study about it can be found in here and can be helpful for you to develop the solution for your case.

Detect black rectangles on white sheet from webcam video using Python OpenCV [closed]

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 6 years ago.
Improve this question
I am working on a project on virtual keyboard.
Using the webcam, I want to detect black keys on a projected keyboard on a wall (projected using a projector).
The keyboard has white background with black keys -
As it is projected, there will be some continuous movement of the keyboard, although little.
From my understanding, I will have to detect this white rectangle, then further detect the black keys in it for every frame.
Can you please tell if this is correct?
How do I go about it using Python and OpenCV?
Thank you!
I imagine that you whant to create a functioning projected keyboard. If it is the case, you effectively whant to first map the position of the projected keys in the webcam image. Then detect a "press" position in this same image. By comparing the two information you will be allowed to "detect" a "keypress". first at all, since detecting the "press" position is the harder, what do you imagine to do that ? (I will then tell you what can be done to map the keys positions)(this is a seriously advanced project dude)

Categories

Resources