28
{saturated fat: 6.7g, added sugar: 8.1g, fibre: 8.5g, proteins: 9.9g, salt: 1.4g} 1 [email protected] Practical Image Processing

Image Processing of Food Labels

Embed Size (px)

Citation preview

Page 1: Image Processing of Food Labels

{saturated fat: 6.7g,added sugar: 8.1g,

fibre: 8.5g,proteins: 9.9g,

salt: 1.4g}

[email protected]

Practical Image Processing

Page 2: Image Processing of Food Labels

Social Entrepreneur

[email protected]

Huge Machine LearningEnthusiast

ME

Page 3: Image Processing of Food Labels

[email protected]

SUGARWISE

EXCEEDS

your daily allowance

 of added sugar

try instead

Page 4: Image Processing of Food Labels

[email protected]

THE PROBLEM

Page 5: Image Processing of Food Labels

[email protected]

TESSERACT

https://github.com/tesseract-ocr

Page 6: Image Processing of Food Labels

[email protected]

CONVERT TO GRAYSCALE

python: PIL libravy

Page 7: Image Processing of Food Labels

[email protected]

PROBLEM: BINARIZATION

python: PIL library does not work here

Page 8: Image Processing of Food Labels

[email protected]

colour histogram

~ 500 000 pixel values, each pixel value is a different colour

Page 9: Image Processing of Food Labels

[email protected]

k-means clustering

image source: Wikipedia

http://stackoverflow.com/questions/3241929/python-find-dominant-most-common-color-in-an-image

Page 10: Image Processing of Food Labels

[email protected]

kmeans: let's try it out

40x40 pixel window

"first window"

Page 11: Image Processing of Food Labels

[email protected]

kmeans: let's try it out

40x40 pixel window

"first window"

154

Page 12: Image Processing of Food Labels

[email protected]

kmeans: let's try it out

40x40 pixel window

"first window"

Page 13: Image Processing of Food Labels

[email protected]

JPG v.s. PNG

40x40 pixel window

Page 14: Image Processing of Food Labels

[email protected]

kmeans: results on full image

Page 15: Image Processing of Food Labels

[email protected]

SOLUTION: sloppy way

colour (pixel values) histogram

find middle pixel valueeverything below it goes blackeverything above it goes white

Page 16: Image Processing of Food Labels

[email protected]

SOLUTION: sloppy way

Page 17: Image Processing of Food Labels

[email protected]

side to side comparison

Page 18: Image Processing of Food Labels

[email protected]

LINE DELETION

work with windows or full image?

remove black regions > 400 pixels?

remove uninterrupted blackregions?

Are we missing something?

Page 19: Image Processing of Food Labels

[email protected]

black regions > 400 pixels

window-wise

Page 20: Image Processing of Food Labels

[email protected]

uninterrupted black regions

window-wise

Page 21: Image Processing of Food Labels

[email protected]

uninterrupted black regions

window-wise

Page 22: Image Processing of Food Labels

[email protected]

SOLUTION: line detection

image-wise

Page 23: Image Processing of Food Labels

[email protected]

SOLUTION: line detection

window-wise

Page 24: Image Processing of Food Labels

[email protected]

line detection: untested

image-wise

fourier analysis

Page 25: Image Processing of Food Labels

[email protected]

bonus: MIN FILTER

min filter PIL default: 3 pixels

Page 26: Image Processing of Food Labels

[email protected]

bonus: SKELETON

python: openCV

Page 27: Image Processing of Food Labels

[email protected]

CHALLENGE: WHITE PIXELS INLETTERS

Page 28: Image Processing of Food Labels

[email protected]

THANKS!