Commit 2f3242c1 authored by Charuka_IT18114454's avatar Charuka_IT18114454

Change preprocess system and preprocess vales.

parent f6f14a6d
...@@ -215,7 +215,7 @@ public class ImageProcess extends AppCompatActivity { ...@@ -215,7 +215,7 @@ public class ImageProcess extends AppCompatActivity {
e.printStackTrace(); e.printStackTrace();
} }
tessBaseAPI.init(FinalPathToTESS_BASE_API,"eng"); tessBaseAPI.init(FinalPathToTESS_BASE_API,"eng");
tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST, "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890',.?;/=>+ "); tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST, "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYZ2346789+-=> ");
tessBaseAPI.setImage(bitmap); tessBaseAPI.setImage(bitmap);
String retStr = "No Result"; String retStr = "No Result";
try { try {
......
...@@ -10,7 +10,8 @@ def main(data): ...@@ -10,7 +10,8 @@ def main(data):
np_data = np.fromstring(decoded_data,np.uint8) np_data = np.fromstring(decoded_data,np.uint8)
img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED) img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
img = cv2.resize(img, (100, 100)) img = cv2.resize(img, None,fx=2, fy=2, interpolation = cv2.INTER_AREA)
img_gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) img_gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
...@@ -20,7 +21,7 @@ def main(data): ...@@ -20,7 +21,7 @@ def main(data):
pil_im = cv2.morphologyEx(pil_im, cv2.MORPH_OPEN, kernel) pil_im = cv2.morphologyEx(pil_im, cv2.MORPH_OPEN, kernel)
#pil_im = cv2.morphologyEx(pil_im, cv2.MORPH_CLOSE, kernel) # pil_im = cv2.morphologyEx(pil_im, cv2.MORPH_CLOSE, kernel)
#pil_im = ImageEnhance.Brightness(pil_im) #pil_im = ImageEnhance.Brightness(pil_im)
...@@ -33,10 +34,11 @@ def main(data): ...@@ -33,10 +34,11 @@ def main(data):
#image = Image.open(np_data) #image = Image.open(np_data)
#pil_im = ImageEnhance.Contrast(image) #pil_im = ImageEnhance.Contrast(image)
pil_im = cv2.GaussianBlur(pil_im,(5,5),0) #pil_im = cv2.bilateralFilter(img, 15, 75, 75)
pil_im = cv2.GaussianBlur(pil_im,(9,9),9)
pil_im = cv2.medianBlur(pil_im,5) pil_im = cv2.medianBlur(pil_im,5)
pil_im = cv2.adaptiveThreshold(pil_im,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,11,2)
pil_im = cv2.adaptiveThreshold(pil_im,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,77,10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment