Latex colours not matching when seen using opencv

by MRIDUL SHARMA   Last Updated June 13, 2019 09:23 AM

I am working on a project where I need to extract each cell in a table in a latex file. So I am coloring each of the cell with different color so that when I parse the png image of the file then I should get different colour for each of the cell. But I am getting slightly different color in both the cases. My Latex code is

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{tabular}{l}
    \cellcolor[RGB]{100,150,200}
\end{tabular}
\end{document}}

When I parse the file using opencv then I get the following colors. [(255, 255, 255), (235, 224, 214), (198, 156, 115), (199, 149, 98), (18, 18, 18)] My python script is

import numpy as np
import cv2
from PIL import Image
file_name = 'rough-1.png'
img = cv2.imread(file_name)
lst = []
for i in range(img.shape[0]):
    for j in range(img.shape[1]):
        if(tuple(img[i,j]) not in lst):
            lst.append(tuple(img[i,j]))
print(lst)
Tags : color colorbox


Related Questions


Updated July 04, 2018 12:23 PM

Updated June 07, 2019 07:23 AM

Updated February 28, 2018 06:23 AM

Updated August 16, 2018 20:23 PM

Updated January 31, 2019 22:23 PM