Remove noise line from the following captcha - captcha

I have the following captchas, each captcha contains a noise line which is of the same color as the characters. How can I automatically detect and remove the noise line and avoid the overlapping pixels of the characters removed simultaneously?

Related

Crop Whitespace above and below a Matplotlib SubPlot

I'm doing a matplotlib subplot and it results with a lot of whitespace above and below it, while on the sides it is fine.
Is there a way to crop this whitespace imposing some length or pixes values?
I'm using this code right now, I treid also without the tight but then it will result also with some white space on the sides. While if I remove the dpi nothing change, the whitespace is still present.
plt.savefig(figDir + "\VM", bbox_inches='tight', dpi=1000)

Halcon - Extract straight edge from XLD

I have a XLD edge, like the one in red in the sample picture below.
I need to extract start/endpoint of straight lines that reppresent it. Hough lines sort of work for this, but the results are not really replicable. minor changes in the contour produce unexpected results.
How can the contours be extracted as straight lines? (blue) with start and finish coordinates?
lines shorter than a specified length should not be counted as separate line.
Contour needs to be converted to a polygon using the following function:
gen_polygons_xld (Object, Polygons, 'ramer', 25.0)
The only adjustable parameter is the alpha (25.0) which decides the approximation threshold.

Inserting Upward Triangle In Mathtext String Matplotlib

I am using the function plt.text in Matplotlib to produce text within my plot. In addition, I am using Mathtext to bold a portion of the text string, as seen in this piece of code:
plt.text(0.01,0.32,fill(r"$\bf{Peaks:}$"+appended_text,57), ha='left',va="top", multialignment="left", fontsize=10.5, wrap=True)
Within my plot, I am currently denoting specific points with an filled upward triangle ("^" via plt.plot in Matplotlib), and would like to use this filled upward triangle symbol within the Mathtext bolded string above.
My initial approach was to try: r"$\bf{Peaks\ [^]:}$", however this simply moved the closed portion of the bracket as an exponential symbol.
Is there a way to replicate this filled triangle within Mathtext?
How would I use

PDF transformation matrix has a scaling of 50 units

I'm trying to highlight some text with a glyph width of 1000 (which corresponds to 1 unit of text space)and font size of 1; the transformation matrix is [50 0 0 50 0 0]. The result is text that is too big. But this is not the case. The text that is being displayed is not big at all; it's a normal size.
Any PDF reader I open the file with has no problems highlighting the word, which means that I'm missing something somewhere.
Currently I'm checking for the default font and the font array in the fonts dictionary, the font size, and the transformation matrix. Is there any other way to scale text in a PDF besides the ones I just mentioned?
This answer combines the comments to the original question:
Currently I'm checking for the default font and the font array in the fonts dictionary, the font size, and the transformation matrix. Is there any other way to scale text in a PDF besides the ones I just mentioned?
A few possibility coming to my mind immediately:
A new transformation matrix (argument to cm) does not replace the old one; instead it is multiplied to it (from the left).
In case of q ... Q you have to consider resets of the current transformation matrix.
(The current transformation matrix, line widths, colors, overprint settings, and much, much more are part of the graphics state. To get an impression, have a look at the entries in tables 57 and 58 of the PDF specification ISO 32000-1. At least all the properties described there are part of the graphics state and, therefore, saved during q and restored during Q.)
Furthermore there is the text matrix to consider.
Finally the UserUnit entry of the page might change the rules.
So there's more to look at than the text positioning operators.
For a good overview have a look at section 9.4.4 Text Space Details of the PDF specification, especially Note 2 therein. (Thanks to #plinth.)

Create a tiff with only images and no text from a postscript file with ghostscript

Is it possible to create a tiff file from a postscript-file (created from a pdf-document with readable text and images) into a tiff file without the text and only the images?
There is a way to create a tiff with no images, but I don't know how to use that way for my task. I need it to generate two images from a postscript-file - the first one with the images only and the second one with the text only.
Since the text is drawn over the top of the image, simple clipping won't do the job.
You can hack the text out by redefining the show operators to no-ops. Insert this after the %%Page comment line (where the page code really starts).
/show{pop}def
/ashow{3{pop}repeat}def
/widthshow{4{pop}repeat}def
/awidthshow{6{pop}repeat}def
/kshow{2{pop}repeat}def
/xshow{2{pop}repeat}def
/xyshow{2{pop}repeat}def
/yshow{2{pop}repeat}def
/glyphshow{pop}def
/cshow{2{pop}repeat}def
This will suppress all text-drawing operators. Edit: Now includes level 2 and 3 operators.
If you're trying to selectively suppress different kinds of elements, you may want to redefine only some of these operators. You can add % at the beginning of a line to comment-out a line of the code, keeping the full list intact (for future uses).
Another way to selectively suppress elements from a ps file is to use the powerful clipping mechanism.
144 288 72 72 rectclip % clip to a 1"x1" square 2" from the left, 4" from the bottom
Clip works with an arbitrary path. So you can even string together points in a connect-the-dots fashion to get the effect of a lasso-clip. Probably easiest if you print the image out and trace a grid to easily plot points for the trajectory.
100 100 moveto
200 200 lineto
300 100 lineto
500 500 lineto
200 700 lineto
closepath clip % clip to a non-rectangular convex polygon
Clipping will suppress all drawing operations that fall outside of the clippath while the clipping path is in effect.