I am trying to turn picture information from 13 colorful blocks into some texts. For example, I need to know how many yellow and blue blocks are here and their sequence.
"C: \ target.jpg"

"C: \ blue.jpg"

"C: \ yellow.jpg"

I have:
import cv2 import numpy as np img_rgb = cv2.imread("c:\\target.jpg") img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) template = cv2.imread('c:\\blue.jpg',0)
When I run them separately, it gives the following results:
[ 13 41 69 97 125 153 181 209 237 265 293 321 349]
and
[ 10 38 66 94 122 150 178 206 234 262 290 318 346]
Well, these are all 13 numbers, but I donβt know how to handle them.
How can I turn them into texts such as:
"blue, yellow, blue, yellow, blue, blue, yellow, yellow, blue, yellow, blue, yellow, blue, yellow."
source share