How to train tesseract to recognize shape like rectangle.
I tried with tesstrain.
Using a set of PNG containing shapes in a row and handly create .box files for each shape. After creating shapes.traineddata, the result by testing is not accurate. Is there an way to enhance precision and shape recognition ?
Related
My work consists of a detection of faults existing in the contour of flywheel. More precisely at surface of teeths existing on the contour of the steering wheel.
I want to capture a video of the contour of the steering wheel, I want to eventually extract photos from this video the result will be an image containing the tooth with some details that which i will not need it.
I only need to extract the tooth so I can compare it after with a non-defective tooth to conclude if there is or there isn't a defect, since i only need the saw tooth and the tooth shape is rectangular, so I need to make a rectangular shape recognition.
I work with Eclipse C++ and OpenCV.
Now I'm following this tutorial
Example image
Expected result
I have a template image , with white background and black shape over it.I also have an image which have a similar shape but in different rotation and scale,also have some noise in image.Just like the pic as follow!I want to use a rotateRect to get a Rect which includes the template shape and use the template to find a rotateRect which includes the target sharp.I have known matchTemplate() is not good when object is rotated or scaled in scene.So I try to use matchShapes() function.But matchShapes() function is used to compare with two contours.So can see the shape in target image,the shape is mixed with noise blob and i can't segment the target shape and noise. I want to get a rotateRect which just includes target shape not noise blob.But when i use findContours in target image,the contour which i found will include target shape and noise.As a result I can't
find the target shape.How can i use template rotateRect to find a target
rotateRect in opencv?Can you share your idea.Thanks in advances!!
Considering the scenario, you can try segmenting the image on the basis of color since your object of interest is black and noise is blue in color. Then, you can proceed with the contour based approach for finding your target. You can refer this link for implementation OpenCV:Watershed algorithm
You can also refer this SO link Coca-Cola can shape recognition.
I'm attempting to implement a Connected Component Tree structure in openCV. after a series of thresholds from 0..255 with a certain interval i obtain a set of Photos - for in stance:
is there a methodes to detect for each shape in the seconed image if it is contained within another shape in the first image?
Many Thanks!
Take the image with the shape in question (2nd image), and remove all other shapes. Then 'and' the image with the 1st image. If the result is the same as the image with the single shape, it is contained.
Obviously this can be optimized to not go through the entire process for each shape.
I am working on cursor control using hand gestures. I have segmented my hand using opencv backprojection combined with backgroundsubtractorMOG. What I want to know is , How to set the ROI as a rectangle around my palm. Using this rectangle I want to calculate the average convexity defects, within the rectangle and use this to differentiate the different hand gesture. Any Ideas, I am useing Opencv in C++.
What you can do is to train a HoG classifier and do detectMultiScale.. The result would be a Rect that would contain the hand.
I'm working with images from which I would like to take parts out and make one new image. I can make use of ImageMagick or OpenCV. Here is a sample image:
From this image I would like to take out the title, two annotated texts (one in circle one in rectangle), and the text from bottom.
So, the final image would have: Image Title, Annotated Text1, Annotated TExt, and This is some test. These parts of the image don't have to be in any particular order in the new image.
Questions
What kind of strategy can I use to do this?
Will hough or canny help?
I'm thinking that since the parts of the image I want back are all text, maybe hough line can detect the straight lines and then I crop out those parts of the images...
My main goal is to extract text so I can send it to an OCR
I've tried to erode the image and came up with this:
My Strategy
Following is my strategy to only keep parts of the image with white background and text. However, I'm not sure if this is doable with OpenCV...
There will be different ROI's in the image
there will always be white background on top of the image, lets call this space title. So I crop out the rectangle part on top of the image and save it as a separate image
there will always be white background at bottom of the image, lets call this body. So I crop out the rectangle part at bottom of the image and save it as a separate image
there will be some text on top of the image, lets call this annotated text. This will be in squares or circles. I can use technique mentioned in this answer to crop out those parts of the image and save them as a separate image.
If you are dealing with only similar looking fonts, and you are not looking for something super efficient, you can simply perform correlation with each letter of the alphabet (26 upper and 26 lower). Threshold out the peaks and add them together. You can then just define you bounding boxes around the peaks.