|
@@ -68,9 +68,17 @@ class Table:
|
|
self.img[mask_green != 0] = color
|
|
self.img[mask_green != 0] = color
|
|
cv2.imwrite('table.jpg', self.img)
|
|
cv2.imwrite('table.jpg', self.img)
|
|
|
|
|
|
|
|
+ def get_str(self):
|
|
|
|
+ str = ''
|
|
|
|
+ for tr in self.html_arr:
|
|
|
|
+ for cell in tr:
|
|
|
|
+ str+=cell
|
|
|
|
+ return str
|
|
|
|
+
|
|
def check_html(self):
|
|
def check_html(self):
|
|
self.get_empty()
|
|
self.get_empty()
|
|
- if self.empty > 4 and self.empty > self.total // 4:
|
|
|
|
|
|
+ html_str = self.get_str()
|
|
|
|
+ if (self.empty > 4 and self.empty > self.total // 4) or ('项目' in str and '每份' in str and '营养素参考值' in str and np.max([len(a) for a in self.html_arr])<3):
|
|
self.change_green2white()
|
|
self.change_green2white()
|
|
return 1
|
|
return 1
|
|
return 0
|
|
return 0
|