How to erase text from an image using OpenCV [closed] - c++

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 have a collection of photos that have text displayed in them. I'd like to replace that text with a pattern of my choosing. I'm using OCR to find the text so I know its position already and select it as a region of interest.
For example, given this photo:
OCR returns the coordinates where the text is:
I want to replace text to achieve this:
How do I select, remove, and replace the text using OpenCV?

My advice is image binaryzation. Since you get the coordinates where the text is, treat the binary image as a mask, the text in the binary image should be 255 in the regions you get, then you can assign other value to the text pixels.

Once you have the approximate region of interest, run an OTSU threshold routine on the area and you'll get a binary mask (hopefully, provided the image is not very noisy).
Tinker with that binary mask to your heart's content.

Related

OpenCV - Leaf Petiole Removal [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 would like to know how can I approach my given problem: removing petiole from a leaf, with very little to none effects to the leaf.
From research, people tried using morphological operations like top-hat to enhance and remove the petiole afterwards, but in some cases this doesn't work so well, detecting in addition peaks from the leaf (example below).
I will try also segmentation based on HSV color space, but i will very much appreciate an idea for BGR space.
From left to right (input image, contour found, morphological applied with a kernel size structuring element which depends for every leaf species)
I am using OpenCV with C++.
example problem petiole detection
As mentioned in the comments I was curious to try this out myself.
And this is what I got:
I used the distance transform, but the final solution does not appear so perfect. I have the code in python if you would like.
CODE:
dist_transform = cv2.distanceTransform(thresh1,cv2.DIST_L2,5)
ret, stalk = cv2.threshold(dist_transform,0.095*dist_transform.max(),255,0)
stalk = np.uint8(stalk)
cv2.imshow('stalk_removed.jpg',stalk)
Where thresh1 is the binary image of the leaf.

Detect High density pixel areas in a binary 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 6 years ago.
Improve this question
I am doing background subtraction, and I obtain a binary image with foreground objects and with some noise.
I want to obtain a ROI for each object on the binary image and them analyze it to ensure that is the object that I want.
How do I segment only the areas with high pixel intensity (objects)?
One example of obtained image:
Have a look at openCv simpleBlobDetector, there are several configurable parameters to it and tons of tutorials online.
The documentation can be found here: http://docs.opencv.org/trunk/d0/d7a/classcv_1_1SimpleBlobDetector.html
Alternatively you could just convolve a white rectangle across multiple scale spaces and return the median values over each scale space.

Crop an image causes outofbounds error [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 8 years ago.
Improve this question
I am trying to crop an image. Sometimes the calculated cropped image outreach the initial size (since the cropping is calculated by the use of a distance). How is it possible instead of receiving an out of bounds error, to fill the rest with black (the same effect as in wrapAffine rotation).
Well, cropping is by definition reducing the size of an image. So if you want to potentially extend the image at the same time, and fill it with black, you could enlarge it first. Something like the following algorithm:
Take maximal bounding box of the original image and the crop rect
Create an empty (black) image of the new dimensions
Copy the original image into the black image
Crop the resulting image
You could wrap this up into a class and give it the same interface as the crop filter, then you would have a generic solution.

Gradient along a path [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Is it possible to create something like this in inkscape? I have been searching and trying for quite some time, but so far no results...
So what I am looking for is a gradient which follows the direction of the path it is applied to.
Gradient along a path http://coreldraw.com/cfs-filesystemfile.ashx/__key/CommunityServer.Components.PostAttachments/00.00.02.07.23/GradientBlend2.jpg
I am not aware of a solution that perfectly satisfies your needs however here is one approach to get close:
Draw a line, open the Fill and Stroke dialog and set the width of the stroke (Stroke style tab) to 50. Transform the stroke to a path (Path > Stroke to Path).
Fill the path with a linear gradient (Fill and Stroke dialog > Fill > Linear gradient) and choose any colours you like.
Select the node tool (F2) and a line will appear stretching the area of your shape (marked with an exclamation mark on the picture below). Adjusting this line may help you to fine tune the gradient (however, strictly speaking it will not follow the path but a rectangle defined by the start and end marker of the marked line)
This should work for simple shapes that do not reverse. Let me know if this is good enough or if you need more detailed instructions.

How can I map multiple images on the sphere with C++/OpenGL? [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 2 years ago.
Improve this question
Is there anyone know how to map multiple images on the sphere using C++/OpenGL?
As the picture here;
images on sphere
You can split the sphere in multiple sections, each one having bound a single image.
It should be reltively easy to generate a sphere slice coordinate using sphere equation.
You could just combine all the images into a single texture using an image editing program. Then you would only have to apply a single texture over the entire sphere. To do this you would just need to find a way to import a model of a sphere into your program. (Unless you want to try generating one procedurally.)
The easiest way is creating texture images with alpha channel.
You can add many texture into shader code and blend them all by alpha as masking.