Wavelet's CAPTCHA

Hey guys I'm trying to denoise some images using the following script.
It was originally in Mathematica 5.2 and I'm trying to convert it to Mathematica 7.0 but so far I have been unsuccessful.
I was wondering if anyone here has any idea how to help.

I will only give one of the modules to see if it helps:

DiscreteWavelets is a package from this site:

#-Link-Snipped-#


<< DiscreteWavelets`DiscreteWavelets`

SetDelayed::write: Tag Entropy in Entropy[v_] is Protected. >>

BreakIntoChars[img_] :=
Module[{a, i, j, l, p, q, lets, r, c, mins, numchar, edge, vedge,
vmins, newimg}, {r, c} = Dimensions;
newimg =
Join[ConstantArray[0, {r, 1}] + 255, img,
ConstantArray[0, {r, 1}] + 255];
newimg =
Join[ConstantArray[0, {1, c}] + 255, img,
ConstantArray[0, {1, c}] + 255, 2];(*
Gets dimensions and pads two rows and two columns onto the image. *)
\

mins = {}; (* Sets up needed lists. *)
vmins = {};
edge = {};
vedge = {};
lets = {};

For[i = 1, i < c, i++,(* for 1 *)

a = Min[Take[newimg, All, {i, i}]]; (*
Measures the minimum value of the column and notes in a list \
where there is white space and where there is black lettering. *)

If[a < 10,
mins = Append[mins, {0}];,
mins = Append[mins, {255}];];];
mins = Flatten[mins]; (*
Removes any extra brackets in the list. *)

For[j = 1, j < c - 1, j++,
If[mins[[j + 1]] - mins[[j]] != 0 &&
mins[[j + 1]] == mins[[j + 2]], (* for 2 *)

edge = Append[edge, {j}]; (* Picks out edges,
where black lettering ends and white space begins,
or vice versa. *)
]; (* end if 2 *)
]; (* end for 1 *)

p = Length[edge];
edge = Flatten[edge]; (*
Stores length and takes out extra brackets. *)

For[k = 1, k <= p/2, k++,
lets =
Append[lets,
Take[newimg, All, {edge[[2 k - 1]], edge[[2 k]]}]]; (*
Cuts vertically based off the previously generated list of where \
there are letters. *)
]; (* end for *)

lets = CutH /@ lets; (* Application of the Horizontal Cut module,
takes off any extra white space aboev and below the letter. *)

lets = PadChar /@ lets; (* Application the Padding module,
artificially making all images 68 by 72. *)
Return[lets] (*
gives back a list of all the cut and padded letters *)
];(* end \
module *)

abcs = 1./3*
Total[ImageRead[
"/Users/CAPTCHA/alphabet2.\
bmp", PowersOfTwo -> 3, GrayScale -> True]];
alpha = BreakIntoChars[abcs];

Your help is greatly appreciated.

Replies

You are reading an archived discussion.

Related Posts

The one-dimensional Haar transform is contructed by taking two numbers, a and b and mapping them to a lowpass value sqrt(2)*a/2 + sqrt(2)*b/2 and a highpass value sqrt(2)*b/2 -sqrt(2)*a/2. For...
​ Sony might think the DSi is just for kids, but it's never had any problems pumping out candy-colored PSPs -- and the next hue off the line might be...
I am attempting to run 5 digital photo frames using one power source. I have one power adapter for each digital photo frame and for asthetic purposes would like a...
dear all member : i decided to provide free lessons of HVAC in hospitals With my Best wishes; Eng.Mohamed fawzy
Hi Friends I have a workstation with windows XP installed in it. In which i have installed the VMware workstation software. In VM ware workstation i have installed WindowsXP. Now...